Documentation ¶
Index ¶
- type KV
- type Measured
- func (m *Measured) Del(ctx context.Context, key string) error
- func (m *Measured) Get(ctx context.Context, key string) ([]byte, error)
- func (m *Measured) GetPrefix(ctx context.Context, prefix string) (map[string][]byte, error)
- func (m *Measured) Put(ctx context.Context, key string, value string) error
- func (m *Measured) Start(ctx context.Context) error
- func (m *Measured) Stop(ctx context.Context) error
- func (m *Measured) Watch(ctx context.Context, prefix string, withPrevVal bool) <-chan WatchResp
- type WatchEvent
- type WatchEventType
- type WatchResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KV ¶
type KV interface { // Put stores a new value associated to a given key. Put(ctx context.Context, key string, value string) error // Get retrieves a value associated to a given key. Get(ctx context.Context, key string) ([]byte, error) // GetPrefix retrieves all values whose key matches prefix. GetPrefix(ctx context.Context, prefix string) (map[string][]byte, error) // Del deletes a value associated to a given key. Del(ctx context.Context, key string) error // Watch watches on a key or prefix. Watch(ctx context.Context, prefix string, withPrevVal bool) <-chan WatchResp // Start initializes key-value store. Start(ctx context.Context) error // Stop releases all underlying key-value store resources. Stop(ctx context.Context) error }
KV represents a generic key-value store interface.
type Measured ¶
type Measured struct {
// contains filtered or unexported fields
}
Measured represents a measured KV type.
func NewMeasured ¶
NewMeasured returns an initialized measured KV instance.
type WatchEvent ¶
type WatchEvent struct { Type WatchEventType Key string Val []byte PrevVal []byte }
WatchEvent represents a single watched event.
type WatchEventType ¶
type WatchEventType uint8
WatchEventType represents a key watch event type.
const ( // Put represents a put key-value event type. Put WatchEventType = iota // Del represents a delete key-value event type. Del )
type WatchResp ¶
type WatchResp struct { Events []WatchEvent Err error }
WatchResp contains a watch operation response value.
Click to show internal directories.
Click to hide internal directories.