Documentation ¶
Index ¶
- Constants
- Variables
- type KVTx
- func (tx *KVTx) Delete(ctx *core.Context, key core.Path) error
- func (tx *KVTx) Get(ctx *core.Context, key core.Path) (result core.Value, valueFound core.Bool, finalErr error)
- func (tx *KVTx) GetSerialized(ctx *core.Context, key core.Path) (result string, valueFound core.Bool, finalErr error)
- func (tx *KVTx) Insert(ctx *core.Context, key core.Path, value core.Serializable) error
- func (tx *KVTx) InsertSerialized(ctx *core.Context, key core.Path, serialized string) error
- func (tx *KVTx) Set(ctx *core.Context, key core.Path, value core.Serializable) error
- func (tx *KVTx) SetSerialized(ctx *core.Context, key core.Path, serialized string) error
- type KvStoreConfig
- type SerializedValueStorageAdapter
- func (a *SerializedValueStorageAdapter) BaseURL() core.URL
- func (a *SerializedValueStorageAdapter) GetSerialized(ctx *core.Context, key core.Path) (string, bool)
- func (a SerializedValueStorageAdapter) Has(ctx *core.Context, key core.Path) bool
- func (a *SerializedValueStorageAdapter) InsertSerialized(ctx *core.Context, key core.Path, serialized string)
- func (a *SerializedValueStorageAdapter) SetSerialized(ctx *core.Context, key core.Path, serialized string)
- type SingleFileKV
- func (kv *SingleFileKV) Close(ctx *core.Context) (bboltError error)
- func (kv *SingleFileKV) Delete(ctx *core.Context, key core.Path, db any)
- func (kv *SingleFileKV) ForEach(ctx *core.Context, fn func(key core.Path, getVal func() core.Value) error, ...) error
- func (kv *SingleFileKV) Get(ctx *core.Context, key core.Path, db any) (core.Value, core.Bool, error)
- func (kv *SingleFileKV) GetSerialized(ctx *core.Context, key core.Path, db any) (string, core.Bool, error)
- func (kv *SingleFileKV) Has(ctx *core.Context, key core.Path, db any) core.Bool
- func (kv *SingleFileKV) Insert(ctx *core.Context, key core.Path, value core.Serializable, db any)
- func (kv *SingleFileKV) InsertSerialized(ctx *core.Context, key core.Path, serialized string, db any)
- func (kv *SingleFileKV) Set(ctx *core.Context, key core.Path, value core.Serializable, db any)
- func (kv *SingleFileKV) SetSerialized(ctx *core.Context, key core.Path, serialized string, db any)
- func (kv *SingleFileKV) UpdateNoCtx(fn func(dbTx *KVTx) error) error
Constants ¶
View Source
const ( KV_STORE_LOG_SRC = "kv" BBOLT_FILE_FPERMS = 0700 )
Variables ¶
View Source
var ( ErrInvalidPathKey = errors.New("invalid path used as local database key") ErrKeyAlreadyPresent = errors.New("key already present") ErrClosedKvStore = errors.New("closed KV store") ErrEntryNotFound = errors.New("entry not found") ErrOpenKvStore = errors.New("KV store is already open") BBOLT_DATA_BUCKET = []byte("data") JSON_SERIALIZATION_CONFIG = core.JSONSerializationConfig{ReprConfig: core.ALL_VISIBLE_REPR_CONFIG} )
Functions ¶
This section is empty.
Types ¶
type KVTx ¶
type KVTx struct {
// contains filtered or unexported fields
}
func NewDatabaseTxIL ¶
func (*KVTx) GetSerialized ¶
func (*KVTx) InsertSerialized ¶
type KvStoreConfig ¶
type SerializedValueStorageAdapter ¶
type SerializedValueStorageAdapter struct {
// contains filtered or unexported fields
}
func NewSerializedValueStorage ¶
func NewSerializedValueStorage(kv *SingleFileKV, url core.URL) *SerializedValueStorageAdapter
func (*SerializedValueStorageAdapter) BaseURL ¶
func (a *SerializedValueStorageAdapter) BaseURL() core.URL
func (*SerializedValueStorageAdapter) GetSerialized ¶
func (*SerializedValueStorageAdapter) InsertSerialized ¶
func (*SerializedValueStorageAdapter) SetSerialized ¶
func (a *SerializedValueStorageAdapter) SetSerialized(ctx *core.Context, key core.Path, serialized string)
SetSerialized implements core.SerializedValueStorage.
type SingleFileKV ¶
type SingleFileKV struct {
// contains filtered or unexported fields
}
A SingleFileKV is a key-value store that uses a Bbolt database under the hood, therefore data is stored on a single on-disk file.
func OpenSingleFileKV ¶
func OpenSingleFileKV(config KvStoreConfig) (_ *SingleFileKV, finalErr error)
func (*SingleFileKV) ForEach ¶
func (kv *SingleFileKV) ForEach(ctx *core.Context, fn func(key core.Path, getVal func() core.Value) error, db any) error
ForEach calls a function for each item in the database, the provided getVal function should not be stored as it only returns the value at the time of the iteration.
func (*SingleFileKV) GetSerialized ¶
func (*SingleFileKV) Insert ¶
func (kv *SingleFileKV) Insert(ctx *core.Context, key core.Path, value core.Serializable, db any)
func (*SingleFileKV) InsertSerialized ¶
func (*SingleFileKV) Set ¶
func (kv *SingleFileKV) Set(ctx *core.Context, key core.Path, value core.Serializable, db any)
func (*SingleFileKV) SetSerialized ¶
func (*SingleFileKV) UpdateNoCtx ¶
func (kv *SingleFileKV) UpdateNoCtx(fn func(dbTx *KVTx) error) error
Click to show internal directories.
Click to hide internal directories.