redis storage backend (#1082)

* pkg/storage: add redis storage backend

* pkg/storage/redis: set record create time correctly

* pkg/storage/redis: add docs

* pkg/storage/redis: run test with redis tag only

* pkg/storage/redis: use localhost

* pkg/storage/redis: use 127.0.0.1

* pkg/storage/redis: honor REDIS_URL env

* .github/workflows: add missing config for redis service

* .github/workflows: map redis ports to host

* pkg/storage/redis: use proto marshaler instead of json one

* pkg/storage/redis: use better implementation

By using redis supported datastructure:

 - Hash for storing record
 - Sorted set for storing by version
 - Set for storing deleted ids

List operation will be now performed in O(log(N)+M) instead of O(N) like
previous implementation.

* pkg/storage/redis: add tx to wrap redis transaction

* pkg/storage/redis: set record type in New

* pkg/storage/redis: make sure tx commands appear in right order

* pkg/storage/redis: make deletePermanentAfter as argument

* pkg/storage/redis: make sure version is incremented when deleting

* pkg/storage/redis: fix linter

* pkg/storage/redis: fix cmd construction
This commit is contained in:
Cuong Manh Le 2020-07-22 03:07:20 +07:00 committed by GitHub
parent 858077b3b6
commit 26f099b49d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 372 additions and 0 deletions

View file

@ -125,3 +125,27 @@ jobs:
- name: test
run: go test -v ./integration/...
storage-backend-test-redis:
runs-on: ubuntu-latest
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: install go
uses: actions/setup-go@v1
with:
go-version: 1.14.x
- name: checkout code
uses: actions/checkout@v2
- name: test
run: go test -v -tags redis ./pkg/storage/redis/...