redis

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package redis implements the storage.Backend interface for redis.

Index

Constants

Name of the storage backend.

Variables

View Source
var (
	ErrExceededMaxRetries = errors.New("redis: transaction reached maximum number of retries")
)

custom errors

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB implements the storage.Backend on top of redis.

func New

func New(rawURL string, options ...Option) (*DB, error)

New creates a new redis storage backend.

func (*DB) ClearDeleted

func (db *DB) ClearDeleted(ctx context.Context, cutoff time.Time)

ClearDeleted clears all the deleted records older than the cutoff time.

func (*DB) Close added in v0.11.0

func (db *DB) Close() error

Close closes the underlying redis connection and any watchers.

func (*DB) Delete

func (db *DB) Delete(ctx context.Context, id string) (err error)

Delete marks a record as deleted.

func (*DB) Get

func (db *DB) Get(ctx context.Context, id string) (record *databroker.Record, err error)

Get gets a record.

func (*DB) List

func (db *DB) List(ctx context.Context, sinceVersion string) (records []*databroker.Record, err error)

List lists all the records changed since the sinceVersion. Records are sorted in version order.

func (*DB) Put

func (db *DB) Put(ctx context.Context, id string, data *anypb.Any) (err error)

Put updates a record.

func (*DB) Watch

func (db *DB) Watch(ctx context.Context) <-chan struct{}

Watch returns a channel that is signaled any time the last version is incremented (ie on Put/Delete).

type Option

type Option func(*dbConfig)

Option customizes a DB.

func WithRecordType added in v0.12.0

func WithRecordType(recordType string) Option

WithRecordType sets the record type in the config.

func WithTLSConfig

func WithTLSConfig(tlsConfig *tls.Config) Option

WithTLSConfig sets the tls.Config which DB uses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL