Documentation ¶
Index ¶
- Variables
- type MVCCDB
- func (db *MVCCDB) Begin() error
- func (db *MVCCDB) CheckAndUpdate() ([]interface{}, error)
- func (db *MVCCDB) Close() error
- func (db *MVCCDB) Commit() error
- func (db *MVCCDB) Del(key []byte) error
- func (db *MVCCDB) DisableBatch()
- func (db *MVCCDB) EnableBatch()
- func (db *MVCCDB) Flush() error
- func (db *MVCCDB) Get(key []byte) ([]byte, error)
- func (db *MVCCDB) GetParentDB() *MVCCDB
- func (db *MVCCDB) Prepare(tid interface{}) (*MVCCDB, error)
- func (db *MVCCDB) Put(key []byte, val []byte) error
- func (db *MVCCDB) Reset() error
- func (db *MVCCDB) RollBack() error
- func (db *MVCCDB) SetStrictGlobalVersionCheck(flag bool)
- type StagingTable
- func (tbl *StagingTable) Del(key []byte) (*VersionizedValueItem, error)
- func (tbl *StagingTable) Detach() error
- func (tbl *StagingTable) Get(key []byte) (*VersionizedValueItem, error)
- func (tbl *StagingTable) GetByKey(key []byte, loadFromStorage bool) (*VersionizedValueItem, error)
- func (tbl *StagingTable) Lock()
- func (tbl *StagingTable) MergeToParent() ([]interface{}, error)
- func (tbl *StagingTable) Prepare(tid interface{}) (*StagingTable, error)
- func (tbl *StagingTable) Purge()
- func (tbl *StagingTable) Put(key []byte, val []byte) (*VersionizedValueItem, error)
- func (tbl *StagingTable) SetStrictGlobalVersionCheck(flag bool)
- func (tbl *StagingTable) Unlock()
- type VersionizedValueItem
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnsupportedNestedTransaction = errors.New("unsupported nested transaction") ErrTransactionNotStarted = errors.New("transaction is not started") ErrDisallowedCallingInNoPreparedDB = errors.New("disallowed calling in No-Prepared MVCCDB") ErrTidIsNil = errors.New("tid is nil") ErrUnsupportedBeginInPreparedDB = errors.New("unsupported begin transaction in prepared MVCCDB") ErrUnsupportedCommitInPreparedDB = errors.New("unsupported commit transaction in prepared MVCCDB") ErrUnsupportedRollBackInPreparedDB = errors.New("unsupported rollback transaction in prepared MVCCDB") ErrPreparedDBIsDirty = errors.New("prepared MVCCDB is dirty") ErrPreparedDBIsClosed = errors.New("prepared MVCCDB is closed") ErrTidIsExist = errors.New("tid is exist") )
Errors
var ( ErrStagingTableKeyConfliction = errors.New("staging table key confliction") ErrParentStagingTableIsNil = errors.New("parent Staging Table is nil") )
Error
Functions ¶
This section is empty.
Types ¶
type MVCCDB ¶
type MVCCDB struct {
// contains filtered or unexported fields
}
MVCCDB the data with MVCC supporting.
func NewMVCCDB ¶
NewMVCCDB create and return new MVCCDB. The `trieSameKeyCompatibility` is used to prevent conflict in continuous changes with same key/value.
func (*MVCCDB) CheckAndUpdate ¶
CheckAndUpdate merge current changes to `FinalVersionizedValues`.
func (*MVCCDB) GetParentDB ¶
GetParentDB return the root db.
func (*MVCCDB) SetStrictGlobalVersionCheck ¶
SetStrictGlobalVersionCheck set strict global version check flag.
type StagingTable ¶
type StagingTable struct {
// contains filtered or unexported fields
}
StagingTable a struct to store all staging changed key/value pairs. There are two map to store the key/value pairs. One are stored associated with tid, the other is `finalVersionizedValue`, record the `ready to commit` key/value pairs.
func NewStagingTable ¶
func NewStagingTable(storage storage.Storage, tid interface{}, trieSameKeyCompatibility bool) *StagingTable
NewStagingTable return new instance of StagingTable.
func (*StagingTable) Del ¶
func (tbl *StagingTable) Del(key []byte) (*VersionizedValueItem, error)
Del del the tid/key pair. If tid+key does not exist, copy and incr version from `finalVersionizedValues` to record previous version.
func (*StagingTable) Get ¶
func (tbl *StagingTable) Get(key []byte) (*VersionizedValueItem, error)
Get return value by key. If key does not exist, copy and incr version from `parentStagingTable` to record previous version.
func (*StagingTable) GetByKey ¶
func (tbl *StagingTable) GetByKey(key []byte, loadFromStorage bool) (*VersionizedValueItem, error)
GetByKey return value by key. If key does not exist, copy and incr version from `parentStagingTable` to record previous version.
func (*StagingTable) MergeToParent ¶
func (tbl *StagingTable) MergeToParent() ([]interface{}, error)
MergeToParent merge key/value pair of tid to `finalVersionizedValues` which the version of value are the same.
func (*StagingTable) Prepare ¶
func (tbl *StagingTable) Prepare(tid interface{}) (*StagingTable, error)
Prepare a independent staging table
func (*StagingTable) Put ¶
func (tbl *StagingTable) Put(key []byte, val []byte) (*VersionizedValueItem, error)
Put put the key/val pair. If key does not exist, copy and incr version from `parentStagingTable` to record previous version.
func (*StagingTable) SetStrictGlobalVersionCheck ¶
func (tbl *StagingTable) SetStrictGlobalVersionCheck(flag bool)
SetStrictGlobalVersionCheck set global version check
type VersionizedValueItem ¶
type VersionizedValueItem struct {
// contains filtered or unexported fields
}
VersionizedValueItem a struct for key/value pair, with version, dirty, deleted flags.
func CloneVersionizedValueItem ¶
func CloneVersionizedValueItem(tid interface{}, oldValue *VersionizedValueItem) *VersionizedValueItem
CloneVersionizedValueItem copy and return the version increased VersionizedValueItem.
func NewDefaultVersionizedValueItem ¶
func NewDefaultVersionizedValueItem(key []byte, val []byte, tid interface{}, globalVersion int64) *VersionizedValueItem
NewDefaultVersionizedValueItem return new instance of VersionizedValueItem, old/new version are 0, dirty is false.
func (*VersionizedValueItem) CloneForMerge ¶
func (value *VersionizedValueItem) CloneForMerge(globalVersion int64) *VersionizedValueItem
CloneForMerge shadow copy of `VersionizedValueItem` with dirty is true.