Documentation
¶
Index ¶
- Variables
- func AppendScoreToSet(set []byte, score float64) []byte
- func BuildSetKey(key []byte, set []byte, score float64, index *schema.Index) (ik []byte)
- func Bytes2float(bytes []byte) float64
- func Float642bytes(float float64) []byte
- func SetKeyScore(key []byte, set []byte) (score float64)
- func UnwrapValueWithTS(tsv []byte) ([]byte, uint64)
- func UnwrapZIndexReference(reference []byte) (key []byte, flag byte, idx uint64)
- func WrapSeparatorToSet(set []byte) []byte
- func WrapValueWithTS(v []byte, ts uint64) []byte
- func WrapZIndexReference(key []byte, index *schema.Index) []byte
- type Options
- type Store
- func (t *Store) ByIndex(index schema.Index) (item *schema.Item, err error)
- func (t *Store) BySafeIndex(options schema.SafeIndexOptions) (safeitem *schema.SafeItem, err error)
- func (t *Store) Close() error
- func (s *Store) ConsistencyProof(index schema.Index) (*schema.ConsistencyProof, error)
- func (t *Store) Count(prefix schema.KeyPrefix) (count *schema.ItemsCount, err error)
- func (t *Store) CountAll() (count uint64)
- func (t *Store) CurrentRoot() (root *schema.Root, err error)
- func (t *Store) DbSize() (int64, int64)
- func (t *Store) Dump(kvChan chan *pb.KVList) (err error)
- func (t *Store) ExecAllOps(ops *schema.Ops, options ...WriteOption) (index *schema.Index, err error)
- func (t *Store) FlushToDisk()
- func (t *Store) Get(key schema.Key) (item *schema.Item, err error)
- func (t *Store) GetReference(key schema.Key) (item *schema.Item, err error)
- func (t *Store) GetTree() *schema.Tree
- func (t *Store) HealthCheck() bool
- func (t *Store) History(options *schema.HistoryOptions) (list *schema.ItemList, err error)
- func (t *Store) IScan(options schema.IScanOptions) (list *schema.Page, err error)
- func (s *Store) InclusionProof(index schema.Index) (*schema.InclusionProof, error)
- func (t *Store) Reference(refOpts *schema.ReferenceOptions, options ...WriteOption) (index *schema.Index, err error)
- func (t *Store) Restore(kvChan chan *pb.KVList) (i uint64, err error)
- func (t *Store) SafeGet(options schema.SafeGetOptions) (safeItem *schema.SafeItem, err error)
- func (t *Store) SafeGetReference(options schema.SafeGetOptions) (safeItem *schema.SafeItem, err error)
- func (t *Store) SafeReference(options schema.SafeReferenceOptions) (proof *schema.Proof, err error)
- func (t *Store) SafeSet(options schema.SafeSetOptions) (proof *schema.Proof, err error)
- func (t *Store) SafeZAdd(options schema.SafeZAddOptions) (proof *schema.Proof, err error)
- func (t *Store) Scan(options schema.ScanOptions) (list *schema.ItemList, err error)
- func (t *Store) Set(kv schema.KeyValue, options ...WriteOption) (index *schema.Index, err error)
- func (t *Store) SetBatch(list schema.KVList, options ...WriteOption) (index *schema.Index, err error)
- func (t *Store) Wait()
- func (t *Store) ZAdd(zaddOpts schema.ZAddOptions, options ...WriteOption) (index *schema.Index, err error)
- func (t *Store) ZScan(options schema.ZScanOptions) (list *schema.ZItemList, err error)
- type WriteOption
- type WriteOptions
Constants ¶
This section is empty.
Variables ¶
var ( ErrInconsistentState = status.New(codes.Unknown, "inconsistent state").Err() ErrIndexNotFound = status.New(codes.NotFound, "index not found").Err() ErrInvalidKey = status.New(codes.InvalidArgument, "invalid key").Err() ErrInvalidReference = status.New(codes.InvalidArgument, "invalid reference").Err() ErrInvalidKeyPrefix = status.New(codes.InvalidArgument, "invalid key prefix").Err() ErrInvalidSet = status.New(codes.InvalidArgument, "invalid set").Err() ErrInvalidOffset = status.New(codes.InvalidArgument, "invalid offset").Err() ErrInvalidRootIndex = status.New(codes.InvalidArgument, "invalid root index").Err() ErrObsoleteDataFormat = status.New(codes.Unknown, "data format in which elements are written on disk is not up to date to the current version of immudb server. Please upgrade to access to complete functionalities").Err() ErrInconsistentDigest = status.New(codes.Unknown, "insertion order index hash is not equal to the digest of the related value").Err() ErrIndexKeyMismatch = status.New(codes.InvalidArgument, "mismatch between provided index and key").Err() ErrZAddIndexMissing = status.New(codes.InvalidArgument, "zAdd index not provided").Err() ErrReferenceIndexMissing = status.New(codes.InvalidArgument, "reference index not provided").Err() ErrNoReferenceProvided = status.New(codes.InvalidArgument, "provided argument is not a reference").Err() )
immudb errors
var ( // ErrValueLogSize is returned when opt.ValueLogFileSize option is not within the valid // range. ErrValueLogSize = status.New(codes.Unknown, badger.ErrValueLogSize.Error()).Err() // ErrKeyNotFound is returned when key isn't found on a txn.Get. ErrKeyNotFound = status.New(codes.NotFound, badger.ErrKeyNotFound.Error()).Err() // ErrTxnTooBig is returned if too many writes are fit into a single transaction. ErrTxnTooBig = status.New(codes.Unknown, badger.ErrTxnTooBig.Error()).Err() // ErrConflict is returned when a transaction conflicts with another transaction. This can // happen if the read rows had been updated concurrently by another transaction. ErrConflict = status.New(codes.Unknown, badger.ErrConflict.Error()).Err() // ErrReadOnlyTxn is returned if an update function is called on a read-only transaction. ErrReadOnlyTxn = status.New(codes.Unknown, badger.ErrReadOnlyTxn.Error()).Err() // ErrDiscardedTxn is returned if a previously discarded transaction is re-used. ErrDiscardedTxn = status.New(codes.Unknown, badger.ErrDiscardedTxn.Error()).Err() // ErrEmptyKey is returned if an empty key is passed on an update function. ErrEmptyKey = status.New(codes.Unknown, badger.ErrEmptyKey.Error()).Err() // ErrRetry is returned when a log file containing the value is not found. // This usually indicates that it may have been garbage collected, and the // operation needs to be retried. ErrRetry = status.New(codes.Unknown, badger.ErrRetry.Error()).Err() // ErrThresholdZero is returned if threshold is set to zero, and value log GC is called. // In such a case, GC can't be run. ErrThresholdZero = status.New(codes.Unknown, badger.ErrThresholdZero.Error()).Err() // ErrNoRewrite is returned if a call for value log GC doesn't result in a log file rewrite. ErrNoRewrite = status.New(codes.Unknown, badger.ErrNoRewrite.Error()).Err() // ErrRejected is returned if a value log GC is called either while another GC is running, or // after DB::Close has been called. ErrRejected = status.New(codes.Unknown, badger.ErrRejected.Error()).Err() // ErrInvalidRequest is returned if the user request is invalid. ErrInvalidRequest = status.New(codes.Unknown, badger.ErrInvalidRequest.Error()).Err() // ErrManagedTxn is returned if the user tries to use an API which isn't // allowed due to external management of transactions, when using ManagedDB. ErrManagedTxn = status.New(codes.Unknown, badger.ErrManagedTxn.Error()).Err() // ErrInvalidDump if a data dump made previously cannot be loaded into the database. ErrInvalidDump = status.New(codes.Unknown, badger.ErrInvalidDump.Error()).Err() // ErrZeroBandwidth is returned if the user passes in zero bandwidth for sequence. ErrZeroBandwidth = status.New(codes.Unknown, badger.ErrZeroBandwidth.Error()).Err() // ErrInvalidLoadingMode is returned when opt.ValueLogLoadingMode option is not // within the valid range ErrInvalidLoadingMode = status.New(codes.Unknown, badger.ErrInvalidLoadingMode.Error()).Err() // ErrReplayNeeded is returned when opt.ReadOnly is set but the // database requires a value log replay. ErrReplayNeeded = status.New(codes.Unknown, badger.ErrReplayNeeded.Error()).Err() // ErrWindowsNotSupported is returned when opt.ReadOnly is used on Windows ErrWindowsNotSupported = status.New(codes.Unknown, badger.ErrWindowsNotSupported.Error()).Err() // ErrTruncateNeeded is returned when the value log gets corrupt, and requires truncation of // corrupt data to allow Badger to run properly. ErrTruncateNeeded = status.New(codes.Unknown, badger.ErrTruncateNeeded.Error()).Err() // ErrBlockedWrites is returned if the user called DropAll. During the process of dropping all // data from Badger, we stop accepting new writes, by returning this error. ErrBlockedWrites = status.New(codes.Unknown, badger.ErrBlockedWrites.Error()).Err() // ErrNilCallback is returned when subscriber's callback is nil. ErrNilCallback = status.New(codes.Unknown, badger.ErrNilCallback.Error()).Err() // ErrEncryptionKeyMismatch is returned when the storage key is not // matched with the key previously given. ErrEncryptionKeyMismatch = status.New(codes.Unknown, badger.ErrEncryptionKeyMismatch.Error()).Err() // ErrInvalidDataKeyID is returned if the datakey id is invalid. ErrInvalidDataKeyID = status.New(codes.Unknown, badger.ErrInvalidDataKeyID.Error()).Err() ErrInvalidEncryptionKey = status.New(codes.Unknown, badger.ErrInvalidEncryptionKey.Error()).Err() ErrGCInMemoryMode = status.New(codes.Unknown, badger.ErrGCInMemoryMode.Error()).Err() )
fixme(leogr): review codes and fix/remove errors which do not make sense in this context, finally correct comments accordingly.
Functions ¶
func AppendScoreToSet ¶ added in v0.8.1
AppendScore
func BuildSetKey ¶ added in v0.8.1
BuildSetKey composes the key of the set {separator}{set}{separator}{score}{key}{bit index presence flag}{index}
func SetKeyScore ¶ added in v0.8.1
SetKeyScore return the score of an item given key and set name
func UnwrapValueWithTS ¶ added in v0.8.1
func UnwrapZIndexReference ¶ added in v0.8.1
UnwrapZIndexReference returns the referenced key and the index of the key if provided in ZAdd or SafeZAdd operations
func WrapSeparatorToSet ¶ added in v0.8.1
WrapSeparatorToSet
func WrapValueWithTS ¶ added in v0.8.1
func WrapZIndexReference ¶ added in v0.8.1
WrapZIndexReference if index is not nil this method append to the key the timestamp at the end of the reference and a bit flag 1. If index is not provided it append a 0 uint64 and a bit flag 0. Flag is put at the end of the key to ensure lexicographical capabilities This is needed to maintain compatibility with solutions that are not using the resolution facilities with timestamp
Types ¶
type Store ¶
Store ...
func (*Store) BySafeIndex ¶
BySafeIndex fetches the entry at the specified index together with the inclusion proof for it and the consistency proof for the current root
func (*Store) ConsistencyProof ¶
ConsistencyProof returns the consistency proof between the specified index and the current root
func (*Store) CurrentRoot ¶
CurrentRoot returns the index and the hash of the current tree root, if any. When the tree is empty and no root is available then the zerovalue for _schema.Root_ is returned instead.
func (*Store) ExecAllOps ¶ added in v0.8.1
func (t *Store) ExecAllOps(ops *schema.Ops, options ...WriteOption) (index *schema.Index, err error)
ExecAllOps like SetBatch it permits many insertions at once. The difference is that is possible to to specify a list of a mix of key value set and zAdd insertions. If zAdd reference is not yet present on disk it's possible to add it as a regular key value and the reference is done onFly
func (*Store) FlushToDisk ¶
func (t *Store) FlushToDisk()
FlushToDisk flushes cached data from memory to disk
func (*Store) Get ¶
Get fetches the entry having the specified key or resolve the reference with the specified key
func (*Store) GetReference ¶ added in v0.8.1
GetReference fetches the reference having the specified key or index
func (*Store) GetTree ¶ added in v0.6.1
GetTree returns a structure that rapresents merkle tree. Every node is marked as in memory, root and with reference key.
func (*Store) InclusionProof ¶
InclusionProof returns the inclusion proof of the specified index in the current tree
func (*Store) Reference ¶
func (t *Store) Reference(refOpts *schema.ReferenceOptions, options ...WriteOption) (index *schema.Index, err error)
Reference adds a new entry who's value is an existing key If the ReferenceOption.index is not provided the resolution will use only the key and last version of the item will be returned If ReferenceOption.index is provided key is optional
func (*Store) SafeGet ¶
SafeGet fetches the entry having the specified key together with the inclusion proof for it and the consistency proof for the current root
func (*Store) SafeGetReference ¶ added in v0.8.1
func (t *Store) SafeGetReference(options schema.SafeGetOptions) (safeItem *schema.SafeItem, err error)
SafeGetReference fetches the reference having the specified key or index together with the inclusion proof for it and the consistency proof for the current root
func (*Store) SafeReference ¶
SafeReference adds a reference entry to an existing key and returns the inclusion proof for it and the consistency proof for the previous root
func (*Store) SafeSet ¶
SafeSet adds an entry and returns the inclusion proof for it and the consistency proof for the previous root
func (*Store) SafeZAdd ¶
SafeZAdd adds the specified score and key to a sorted set and returns the inclusion proof for it and the consistency proof for the previous root As a parameter of SafeZAddOptions is possible to provide the associated index of the provided key. In this way, when resolving reference, the specified version of the key will be returned. If the index is not provided the resolution will use only the key and last version of the item will be returned If SafeZAddOptions.Zopts.index is provided key is optional
func (*Store) SetBatch ¶
func (t *Store) SetBatch(list schema.KVList, options ...WriteOption) (index *schema.Index, err error)
SetBatch adds many entries at once
func (*Store) ZAdd ¶
func (t *Store) ZAdd(zaddOpts schema.ZAddOptions, options ...WriteOption) (index *schema.Index, err error)
ZAdd adds a score for an existing key in a sorted set As a parameter of ZAddOptions is possible to provide the associated index of the provided key. In this way, when resolving reference, the specified version of the key will be returned. If the index is not provided the resolution will use only the key and last version of the item will be returned If ZAddOptions.index is provided key is optional
type WriteOptions ¶
type WriteOptions struct {
// contains filtered or unexported fields
}
WriteOptions ...