Documentation ¶
Index ¶
- Variables
- type BatchSession
- func (s *BatchSession) Close() error
- func (s *BatchSession) Commit() error
- func (s *BatchSession) Delete(k []byte) error
- func (s *BatchSession) DeleteRange(start []byte, end []byte) error
- func (s *BatchSession) Exists(k []byte) (bool, error)
- func (s *BatchSession) Get(k []byte) ([]byte, error)
- func (s *BatchSession) Insert(k, v []byte) error
- func (s *BatchSession) Iterator(opts *IterOptions) (Iterator, error)
- func (s *BatchSession) Put(k, v []byte) error
- type IterOptions
- type Iterator
- type Options
- type RollbackSegment
- type Session
- type SnapshotSession
- func (s *SnapshotSession) Close() error
- func (s *SnapshotSession) Commit() error
- func (s *SnapshotSession) Delete(k []byte) error
- func (s *SnapshotSession) DeleteRange(start []byte, end []byte) error
- func (s *SnapshotSession) Exists(k []byte) (bool, error)
- func (s *SnapshotSession) Get(k []byte) ([]byte, error)
- func (s *SnapshotSession) Insert(k, v []byte) error
- func (s *SnapshotSession) Iterator(opts *IterOptions) (Iterator, error)
- func (s *SnapshotSession) Put(k, v []byte) error
- type Store
- func (s *Store) CleanupTransientNamespaces() error
- func (s *Store) Close() error
- func (s *Store) DB() *pebble.DB
- func (s *Store) LockSharedSnapshot()
- func (s *Store) NewBatchSession() *BatchSession
- func (s *Store) NewSnapshotSession() *SnapshotSession
- func (s *Store) NewTransientSession() *TransientSession
- func (s *Store) ResetRollbackSegment() error
- func (s *Store) Rollback() error
- func (s *Store) UnlockSharedSnapshot()
- type TransientSession
- func (s *TransientSession) Close() error
- func (s *TransientSession) Commit() error
- func (s *TransientSession) Delete(k []byte) error
- func (s *TransientSession) DeleteRange(start []byte, end []byte) error
- func (s *TransientSession) Exists(k []byte) (bool, error)
- func (s *TransientSession) Get(k []byte) ([]byte, error)
- func (s *TransientSession) Insert(k, v []byte) error
- func (s *TransientSession) Iterator(opts *IterOptions) (Iterator, error)
- func (s *TransientSession) Put(k, v []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyNotFound is returned when the targeted key doesn't exist. ErrKeyNotFound = errors.New("key not found") // ErrKeyAlreadyExists is returned when the targeted key already exists. ErrKeyAlreadyExists = errors.New("key already exists") )
Common errors returned by the engine.
var DefaultComparer = &pebble.Comparer{ Compare: encoding.Compare, Equal: encoding.Equal, AbbreviatedKey: encoding.AbbreviatedKey, FormatKey: pebble.DefaultComparer.FormatKey, Separator: encoding.Separator, Successor: encoding.Successor, Name: "leveldb.BytewiseComparator", }
DefaultComparer is the default implementation of the Comparer interface for chai.
Functions ¶
This section is empty.
Types ¶
type BatchSession ¶
type BatchSession struct { Store *Store DB *pebble.DB Batch *pebble.Batch // contains filtered or unexported fields }
func (*BatchSession) Close ¶
func (s *BatchSession) Close() error
func (*BatchSession) Commit ¶
func (s *BatchSession) Commit() error
func (*BatchSession) Delete ¶
func (s *BatchSession) Delete(k []byte) error
Delete a record by key. If the key doesn't exist, it doesn't do anything.
func (*BatchSession) DeleteRange ¶
func (s *BatchSession) DeleteRange(start []byte, end []byte) error
DeleteRange deletes all keys in the given range. This implementation deletes all keys one by one to simplify the rollback.
func (*BatchSession) Exists ¶
func (s *BatchSession) Exists(k []byte) (bool, error)
Exists returns whether a key exists and is visible by the current session.
func (*BatchSession) Get ¶
func (s *BatchSession) Get(k []byte) ([]byte, error)
Get returns a value associated with the given key. If not found, returns ErrKeyNotFound.
func (*BatchSession) Insert ¶
func (s *BatchSession) Insert(k, v []byte) error
Insert inserts a key-value pair. If it already exists, it returns ErrKeyAlreadyExists.
func (*BatchSession) Iterator ¶
func (s *BatchSession) Iterator(opts *IterOptions) (Iterator, error)
func (*BatchSession) Put ¶
func (s *BatchSession) Put(k, v []byte) error
Put stores a key value pair. If it already exists, it overrides it.
type IterOptions ¶
type IterOptions struct { // LowerBound specifies the smallest key (inclusive) that the iterator will // return during iteration. If the iterator is seeked or iterated past this // boundary the iterator will return Valid()==false. Setting LowerBound // effectively truncates the key space visible to the iterator. LowerBound []byte // UpperBound specifies the largest key (exclusive) that the iterator will // return during iteration. If the iterator is seeked or iterated past this // boundary the iterator will return Valid()==false. Setting UpperBound // effectively truncates the key space visible to the iterator. UpperBound []byte }
type RollbackSegment ¶
type RollbackSegment struct {
// contains filtered or unexported fields
}
func NewRollbackSegment ¶
func NewRollbackSegment(db *pebble.DB, namespace int64) *RollbackSegment
func (*RollbackSegment) Reset ¶
func (s *RollbackSegment) Reset() error
func (*RollbackSegment) Rollback ¶
func (s *RollbackSegment) Rollback() error
type Session ¶
type Session interface { Commit() error Close() error // Insert inserts a key-value pair. If it already exists, it returns ErrKeyAlreadyExists. Insert(k, v []byte) error // Put stores a key-value pair. If it already exists, it overrides it. Put(k, v []byte) error // Get returns a value associated with the given key. If not found, returns ErrKeyNotFound. Get(k []byte) ([]byte, error) // Exists returns whether a key exists and is visible by the current session. Exists(k []byte) (bool, error) // Delete a record by key. If not found, returns ErrKeyNotFound. Delete(k []byte) error DeleteRange(start []byte, end []byte) error Iterator(opts *IterOptions) (Iterator, error) }
type SnapshotSession ¶
type SnapshotSession struct { Store *Store Snapshot *snapshot // contains filtered or unexported fields }
func (*SnapshotSession) Close ¶
func (s *SnapshotSession) Close() error
func (*SnapshotSession) Commit ¶
func (s *SnapshotSession) Commit() error
func (*SnapshotSession) Delete ¶
func (s *SnapshotSession) Delete(k []byte) error
Delete a record by key. If not found, returns ErrKeyNotFound.
func (*SnapshotSession) DeleteRange ¶
func (s *SnapshotSession) DeleteRange(start []byte, end []byte) error
func (*SnapshotSession) Exists ¶
func (s *SnapshotSession) Exists(k []byte) (bool, error)
Exists returns whether a key exists and is visible by the current session.
func (*SnapshotSession) Get ¶
func (s *SnapshotSession) Get(k []byte) ([]byte, error)
Get returns a value associated with the given key. If not found, returns ErrKeyNotFound.
func (*SnapshotSession) Insert ¶
func (s *SnapshotSession) Insert(k, v []byte) error
func (*SnapshotSession) Iterator ¶
func (s *SnapshotSession) Iterator(opts *IterOptions) (Iterator, error)
func (*SnapshotSession) Put ¶
func (s *SnapshotSession) Put(k, v []byte) error
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewEngineWith ¶
func (*Store) CleanupTransientNamespaces ¶
func (*Store) LockSharedSnapshot ¶
func (s *Store) LockSharedSnapshot()
func (*Store) NewBatchSession ¶
func (s *Store) NewBatchSession() *BatchSession
func (*Store) NewSnapshotSession ¶
func (s *Store) NewSnapshotSession() *SnapshotSession
func (*Store) NewTransientSession ¶
func (s *Store) NewTransientSession() *TransientSession
func (*Store) ResetRollbackSegment ¶
func (*Store) UnlockSharedSnapshot ¶
func (s *Store) UnlockSharedSnapshot()
type TransientSession ¶
type TransientSession struct {
// contains filtered or unexported fields
}
func (*TransientSession) Close ¶
func (s *TransientSession) Close() error
func (*TransientSession) Commit ¶
func (s *TransientSession) Commit() error
func (*TransientSession) Delete ¶
func (s *TransientSession) Delete(k []byte) error
Delete a record by key. If not found, returns ErrKeyNotFound.
func (*TransientSession) DeleteRange ¶
func (s *TransientSession) DeleteRange(start []byte, end []byte) error
func (*TransientSession) Exists ¶
func (s *TransientSession) Exists(k []byte) (bool, error)
Exists returns whether a key exists and is visible by the current session.
func (*TransientSession) Get ¶
func (s *TransientSession) Get(k []byte) ([]byte, error)
Get returns a value associated with the given key. If not found, returns ErrKeyNotFound.
func (*TransientSession) Insert ¶
func (s *TransientSession) Insert(k, v []byte) error
func (*TransientSession) Iterator ¶
func (s *TransientSession) Iterator(opts *IterOptions) (Iterator, error)
func (*TransientSession) Put ¶
func (s *TransientSession) Put(k, v []byte) error
Put stores a key value pair. If it already exists, it overrides it.