stores

package
v0.0.0-...-b4eea1d Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RecordKindSet    RecordKind = "SET"
	RecordKindDelete            = "DEL"
	RecordKindCommit            = "COMMIT"
)

Variables

View Source
var ContextKeyTransactionID = contextKey{"TXID"}

ContextKeyTransactionID is a context key for the transaction ID.

Functions

This section is empty.

Types

type Reader

type Reader interface {
	Read(ctx context.Context, records chan<- Record) error
}

type Record

type Record struct {
	Kind          RecordKind
	TransactionID int64
	Key           string
	Value         string
}

func (Record) String

func (r Record) String() string

type RecordKind

type RecordKind string

type Store

type Store interface {
	Set(ctx context.Context, key, value string) error
	Get(ctx context.Context, key string) (string, error)
	Delete(ctx context.Context, key string) error
	Keys(ctx context.Context) ([]string, error)
	Release(ctx context.Context)
}

func FromPersistence

func FromPersistence(ctx context.Context, reader Reader, store Store) (Store, error)

func NewInMemoryStore

func NewInMemoryStore() Store

func WithPersistence

func WithPersistence(writer Writer, store Store) Store

type Writer

type Writer interface {
	Write(ctx context.Context, record Record) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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