Documentation
¶
Index ¶
- Constants
- func KVKey(key string) string
- type IKV
- type KV
- func (k *KV) Create(ctx context.Context, kvs []*protos.KVObject, overwrite bool) error
- func (k *KV) Delete(ctx context.Context, key string) error
- func (k *KV) DeleteAll(ctx context.Context) error
- func (k *KV) Get(ctx context.Context, key string) (*protos.KVObject, error)
- func (k *KV) GetAll(ctx context.Context) ([]*protos.KVObject, error)
- func (k *KV) GetUsage(ctx context.Context) (*Usage, error)
- func (k *KV) Update(ctx context.Context, kv *protos.KVObject) (*protos.KVObject, error)
- type Options
- type Usage
Constants ¶
View Source
const (
Prefix = "kv:"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IKV ¶
type IKV interface {
GetUsage(ctx context.Context) (*Usage, error)
GetAll(ctx context.Context) ([]*protos.KVObject, error)
Get(ctx context.Context, key string) (*protos.KVObject, error)
Create(ctx context.Context, kvs []*protos.KVObject, overwrite bool) error
Update(ctx context.Context, kv *protos.KVObject) (*protos.KVObject, error)
Delete(ctx context.Context, key string) error
DeleteAll(ctx context.Context) error
}
type KV ¶
type KV struct {
Options *Options
// contains filtered or unexported fields
}
func (*KV) Create ¶
Create creates a kv object in RedisBackend. "overwrite" allows you to adjust create behavior - if set and the key already exists - it the method will overwrite the key. If not set and the key already exists - it will error.
Think of "overwrite" as an "upsert".
type Usage ¶
type Usage struct {
// This does NOT include history -- we get this value by doing Keys() on the
// bucket
NumItems int `json:"num_items"`
// This includes history entries (ie. when you delete a KV, a copy of it is
// kept around until the key is purged or the bucket is compacted)
NumBytes int64 `json:"num_bytes"`
}
Click to show internal directories.
Click to hide internal directories.