Documentation ¶
Index ¶
- Constants
- type DeleteCallback
- type GetCallback
- type GetOpt
- type KVStore
- type Option
- type PutCallback
- type Record
- type SetOpt
- type SubscribeCallback
- type SubscribeHandler
- type SubscribeOpt
- type Trace
- func (t *Trace) Delete(ctx context.Context, key string, delete DeleteCallback) error
- func (t *Trace) Get(ctx context.Context, key string, get GetCallback, opts ...GetOpt) ([]*Record, error)
- func (t *Trace) HandlerHandle(ctx context.Context, key string, handler SubscribeHandler, args ...interface{}) error
- func (t *Trace) Put(ctx context.Context, record *Record, put PutCallback, opts ...SetOpt) (*Record, error)
- func (t *Trace) Subscribe(ctx context.Context, key string, handler SubscribeHandler, ...) error
- func (t *Trace) Txn(ctx context.Context, handler TxnHandler, txn TxnCallback) error
- type TxnCallback
- type TxnHandler
- type Wrapper
- func (w *Wrapper) Delete(ctx context.Context, key string, delete DeleteCallback) error
- func (w *Wrapper) Get(ctx context.Context, key string, get GetCallback, opts ...GetOpt) ([]*Record, error)
- func (w *Wrapper) HandlerHandle(ctx context.Context, key string, handler SubscribeHandler, args ...interface{}) error
- func (w *Wrapper) Put(ctx context.Context, record *Record, put PutCallback, opts ...SetOpt) (*Record, error)
- func (w *Wrapper) Subscribe(ctx context.Context, key string, handler SubscribeHandler, ...) error
- func (w *Wrapper) Txn(ctx context.Context, handler TxnHandler, txn TxnCallback) error
Constants ¶
View Source
const (
KV_STORE = "kv-store"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetOpt ¶
type GetOpt interface{}
GetOpts are the additional options passed during the get opertation
type KVStore ¶
type KVStore interface { component.Component // Init initializes the store with the given options Init(opts ...Option) error // Put the value for the key Put(ctx context.Context, record *Record, opts ...SetOpt) (*Record, error) // Get the value for the key Get(ctx context.Context, key string, opts ...GetOpt) ([]*Record, error) // Delete the key from the store Delete(ctx context.Context, key string) error // Txn handles transactions Txn(ctx context.Context, handler TxnHandler) error // Subscribe to the changes made to the given key Subscribe(ctx context.Context, key string, handler SubscribeHandler, opts ...SubscribeOpt) error // Unsubscribe from a subscription Unsubscribe(ctx context.Context, key string) error // String returns the name of the store implementation String() string }
KVStore is a key-value data storage interface
type Record ¶
type Record struct { // Key to store the record Key string `json:"key"` // Value for the key set in the store Value []byte `json:"value"` // Expiry is the time to expire a record Expiry time.Duration `json:"expiry,omitempty"` // Metadata is the metadata of the record Metadata map[string]interface{} `json:"metadata"` }
Record set in the store for a specific key
type SetOpt ¶
type SetOpt interface{}
SetOpts are the additional options passed during the set operation
type SubscribeCallback ¶
type SubscribeCallback func(context.Context, string, SubscribeHandler) error
type SubscribeHandler ¶
type SubscribeHandler interface { // Handle the subscription for the given key Handle(ctx context.Context, key string, args ...interface{}) error }
SubscribeHandler for the subscribe action
type SubscribeOpt ¶
type SubscribeOpt interface{}
SubscribeOpt are the additional options passed during the subscribe operation
type Trace ¶
type Trace struct {
// contains filtered or unexported fields
}
func (*Trace) HandlerHandle ¶
func (*Trace) Subscribe ¶
func (t *Trace) Subscribe(ctx context.Context, key string, handler SubscribeHandler, subscribe SubscribeCallback) error
func (*Trace) Txn ¶
func (t *Trace) Txn(ctx context.Context, handler TxnHandler, txn TxnCallback) error
type TxnCallback ¶
type TxnCallback func(context.Context, TxnHandler) error
type TxnHandler ¶
type TxnHandler interface { // Handle the transaction Handle(ctx context.Context, store KVStore) error }
TxnHandler is the interface for handling transactions
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
func (*Wrapper) HandlerHandle ¶
func (*Wrapper) Subscribe ¶
func (w *Wrapper) Subscribe( ctx context.Context, key string, handler SubscribeHandler, subscribe SubscribeCallback, ) error
func (*Wrapper) Txn ¶
func (w *Wrapper) Txn( ctx context.Context, handler TxnHandler, txn TxnCallback, ) error
Click to show internal directories.
Click to hide internal directories.