storage

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeWriteTask

func EncodeWriteTask(task *WriteTask) []byte

func NewDBDeque added in v1.0.2

func NewDBDeque(db Database, readFront bool) *dbDeque

Types

type Batch

type Batch interface {
	DatabaseWriter

	// execute all batched operations
	Write() error

	// reset the batch to empty
	Reset()
}

interface for transaction executor methods must be thread safe write operations must be executed atomically

type Database

interface for full functional database methods must be thread safe

func NewMemoryDatabase

func NewMemoryDatabase() Database

type DatabaseBatcher

type DatabaseBatcher interface {
	// create a batch which can pack DatabasePutter & DatabaseDeleter operations and execute them atomically
	NewBatch() Batch

	// release a Batch
	DeleteBatch(b Batch)
}

interface for transactional execution of multiple writes methods must be thread safe

type DatabaseDeleter

type DatabaseDeleter interface {
	// delete the given key and its value
	// if the given key does not exist, just return nil, indicating a successful deletion without doing anything.
	Delete(key []byte) error
}

interface for deletion methods must be thread safe

type DatabaseDispatcher

type DatabaseDispatcher interface {
	// return members of database group.
	// members must be fixed once the DatabaseDispatcher object is created
	MemberDatabases() []Database

	// return the index number of the mapped member database
	DatabaseForKey(key []byte) int

	// return databases who possibly contains keys from given range
	DatabasesForKeyRange(start []byte, limit []byte) []int
}

interface for key->database mapping policy for a group of databases

type DatabaseGetter

type DatabaseGetter interface {
	// check existence of the given key
	Has(key []byte) (bool, error)

	// query the value of the given key
	Get(key []byte) ([]byte, error)
}

interface for key & value query methods must be thread safe

type DatabaseGroup

type DatabaseGroup interface {
	DatabaseDispatcher
	Database
}

interface for a logical database consisting of a group of databases

type DatabasePatch added in v1.0.2

type DatabasePatch struct {
	// contains filtered or unexported fields
}

func NewDatabasePatch added in v1.0.2

func NewDatabasePatch(serviceId uint32, branchId string, db Database) *DatabasePatch

func (*DatabasePatch) Apply added in v1.0.2

func (p *DatabasePatch) Apply() error

func (*DatabasePatch) BranchId added in v1.0.2

func (p *DatabasePatch) BranchId() string

func (*DatabasePatch) Delete added in v1.0.2

func (p *DatabasePatch) Delete(key []byte) error

func (*DatabasePatch) DeleteBatch added in v1.0.2

func (p *DatabasePatch) DeleteBatch(b iservices.IDatabaseBatch)

func (*DatabasePatch) Get added in v1.0.2

func (p *DatabasePatch) Get(key []byte) ([]byte, error)

func (*DatabasePatch) Has added in v1.0.2

func (p *DatabasePatch) Has(key []byte) (bool, error)

func (*DatabasePatch) Iterate added in v1.0.2

func (p *DatabasePatch) Iterate(start, limit []byte, reverse bool, callback func(key, value []byte) bool)

func (*DatabasePatch) NewBatch added in v1.0.2

func (p *DatabasePatch) NewBatch() iservices.IDatabaseBatch

func (*DatabasePatch) NewPatch added in v1.0.2

func (p *DatabasePatch) NewPatch(branchId ...string) iservices.IDatabasePatch

func (*DatabasePatch) Put added in v1.0.2

func (p *DatabasePatch) Put(key []byte, value []byte) error

func (*DatabasePatch) ServiceId added in v1.0.2

func (p *DatabasePatch) ServiceId() uint32

type DatabasePutter

type DatabasePutter interface {
	// insert a new key-value pair, or update the value if the given key already exists
	Put(key []byte, value []byte) error
}

interface for insertion and updating methods must be thread safe

type DatabaseScanner

type DatabaseScanner interface {
	// Iterate enumerates keys in range [start, limit) and calls callback with each enumerated key and its value.
	// If callback returns false, the enumeration stops immediately, otherwise all matched keys will be enumerated.
	// a nil start is the logical minimal key that is lesser than any existing keys
	// a nil limit is the logical maximum key that is greater than any existing keys
	Iterate(start, limit []byte, reverse bool, callback func(key, value []byte) bool)
}

interface for key-space range scan methods must be thread safe

func NewMergedIterator added in v1.0.2

func NewMergedIterator(databases []Database) DatabaseScanner

NewMergedIterator returns a DatabaseScanner for given group of databases. Group members must have zero-intersection of their key spaces. In other words, they must be shards.

func NewPatchedIterator added in v1.0.2

func NewPatchedIterator(patch, base Database, patchDeletes map[string]bool) DatabaseScanner

NewPatchedIterator returns a DatabaseScanner for given patch and base database.

type DatabaseService

type DatabaseService struct {
	// contains filtered or unexported fields
}

the service type

func NewDatabase

func NewDatabase(dbPath string) (*DatabaseService, error)

func NewDatabaseService

func NewDatabaseService(ctx *node.ServiceContext, dbPath string) (*DatabaseService, error)

service constructor

func (*DatabaseService) BeginTransaction

func (s *DatabaseService) BeginTransaction()

func (*DatabaseService) BeginTransactionWithTag added in v1.0.2

func (s *DatabaseService) BeginTransactionWithTag(tag string)

func (*DatabaseService) BranchId added in v1.0.2

func (s *DatabaseService) BranchId() string

func (*DatabaseService) Close

func (s *DatabaseService) Close()

func (*DatabaseService) Delete

func (s *DatabaseService) Delete(key []byte) error

func (*DatabaseService) DeleteAll

func (s *DatabaseService) DeleteAll() error

func (*DatabaseService) DeleteBatch

func (s *DatabaseService) DeleteBatch(b iservices.IDatabaseBatch)

func (*DatabaseService) EnableReversion added in v1.0.2

func (s *DatabaseService) EnableReversion(b bool) error

func (*DatabaseService) EndTransaction

func (s *DatabaseService) EndTransaction(commit bool) error

func (*DatabaseService) Get

func (s *DatabaseService) Get(key []byte) ([]byte, error)

func (*DatabaseService) GetRevision

func (s *DatabaseService) GetRevision() uint64

func (*DatabaseService) GetRevisionAndBase

func (s *DatabaseService) GetRevisionAndBase() (current uint64, base uint64)

func (*DatabaseService) GetRevisionTag

func (s *DatabaseService) GetRevisionTag(r uint64) string

func (*DatabaseService) GetTagRevision

func (s *DatabaseService) GetTagRevision(tag string) (uint64, error)

func (*DatabaseService) Has

func (s *DatabaseService) Has(key []byte) (bool, error)

implementation of Database interface

func (*DatabaseService) HashOfTopTransaction added in v1.0.2

func (s *DatabaseService) HashOfTopTransaction() uint32

func (*DatabaseService) Iterate added in v1.0.2

func (s *DatabaseService) Iterate(start, limit []byte, reverse bool, callback func(key, value []byte) bool)

func (*DatabaseService) Lock added in v1.0.2

func (s *DatabaseService) Lock()

func (*DatabaseService) NewBatch

func (*DatabaseService) NewPatch added in v1.0.2

func (s *DatabaseService) NewPatch(branchId ...string) iservices.IDatabasePatch

func (*DatabaseService) Put

func (s *DatabaseService) Put(key []byte, value []byte) error

func (*DatabaseService) RLock added in v1.0.2

func (s *DatabaseService) RLock()

func (*DatabaseService) RUnlock added in v1.0.2

func (s *DatabaseService) RUnlock()

func (*DatabaseService) RebaseToRevision

func (s *DatabaseService) RebaseToRevision(r uint64) error

func (*DatabaseService) RebaseToTag

func (s *DatabaseService) RebaseToTag(tag string) error

func (*DatabaseService) ReversionEnabled added in v1.0.2

func (s *DatabaseService) ReversionEnabled() bool

func (*DatabaseService) RevertToRevision

func (s *DatabaseService) RevertToRevision(r uint64) error

func (*DatabaseService) RevertToTag

func (s *DatabaseService) RevertToTag(tag string) error

func (*DatabaseService) RollbackTag added in v1.0.2

func (s *DatabaseService) RollbackTag(tag string) error

func (*DatabaseService) ServiceId added in v1.0.2

func (s *DatabaseService) ServiceId() uint32

func (*DatabaseService) Squash added in v1.0.2

func (s *DatabaseService) Squash(tag string) error

func (*DatabaseService) Start

func (s *DatabaseService) Start(node *node.Node) error

func (*DatabaseService) Stop

func (s *DatabaseService) Stop() error

func (*DatabaseService) TagRevision

func (s *DatabaseService) TagRevision(r uint64, tag string) error

func (*DatabaseService) TransactionHeight

func (s *DatabaseService) TransactionHeight() uint

func (*DatabaseService) Unlock added in v1.0.2

func (s *DatabaseService) Unlock()

type DatabaseWriter added in v1.0.2

type DatabaseWriter interface {
	DatabasePutter
	DatabaseDeleter
}

type GuardedDatabaseService

type GuardedDatabaseService struct {
	DatabaseService
}

func NewGuardedDatabaseService

func NewGuardedDatabaseService(ctx *node.ServiceContext, dbPath string) (*GuardedDatabaseService, error)

func (*GuardedDatabaseService) RevertToRevision

func (s *GuardedDatabaseService) RevertToRevision(r uint64) error

func (*GuardedDatabaseService) RevertToTag

func (s *GuardedDatabaseService) RevertToTag(tag string) error

type KeyHashDispatcher

type KeyHashDispatcher struct {
	// contains filtered or unexported fields
}

func NewKeyHashDispatcher

func NewKeyHashDispatcher(databases []Database) *KeyHashDispatcher

func (*KeyHashDispatcher) DatabaseForKey

func (dp *KeyHashDispatcher) DatabaseForKey(key []byte) int

func (*KeyHashDispatcher) DatabasesForKeyRange

func (dp *KeyHashDispatcher) DatabasesForKeyRange(start []byte, limit []byte) []int

func (*KeyHashDispatcher) MemberDatabases

func (dp *KeyHashDispatcher) MemberDatabases() []Database

type LevelDatabase

type LevelDatabase struct {
	// contains filtered or unexported fields
}

func NewLevelDatabase

func NewLevelDatabase(file string) (*LevelDatabase, error)

create a database

func (*LevelDatabase) Close

func (db *LevelDatabase) Close()

close a database

func (*LevelDatabase) Delete

func (db *LevelDatabase) Delete(key []byte) error

delete the given key and its value

func (*LevelDatabase) DeleteBatch

func (db *LevelDatabase) DeleteBatch(b Batch)

release a Batch

func (*LevelDatabase) FileName

func (db *LevelDatabase) FileName() string

get the disk file path

func (*LevelDatabase) Get

func (db *LevelDatabase) Get(key []byte) ([]byte, error)

query the value of the given key

func (*LevelDatabase) Has

func (db *LevelDatabase) Has(key []byte) (bool, error)

check existence of the given key

func (*LevelDatabase) Iterate added in v1.0.2

func (db *LevelDatabase) Iterate(start, limit []byte, reverse bool, callback func(key, value []byte) bool)

func (*LevelDatabase) NewBatch

func (db *LevelDatabase) NewBatch() Batch

create a batch which can pack DatabasePutter & DatabaseDeleter operations and execute them atomically

func (*LevelDatabase) Put

func (db *LevelDatabase) Put(key []byte, value []byte) error

insert a new key-value pair, or update the value if the given key already exists

type LevelDatabaseBatch

type LevelDatabaseBatch struct {
	// contains filtered or unexported fields
}

func (*LevelDatabaseBatch) Delete

func (b *LevelDatabaseBatch) Delete(key []byte) error

func (*LevelDatabaseBatch) Put

func (b *LevelDatabaseBatch) Put(key []byte, value []byte) error

func (*LevelDatabaseBatch) Reset

func (b *LevelDatabaseBatch) Reset()

reset the batch to empty

func (*LevelDatabaseBatch) Write

func (b *LevelDatabaseBatch) Write() error

execute all batched operations

type LevelWriteAheadLog

type LevelWriteAheadLog struct {
	// contains filtered or unexported fields
}

func NewLevelWriteAheadLog

func NewLevelWriteAheadLog(file string) (*LevelWriteAheadLog, error)

func (*LevelWriteAheadLog) Close

func (wal *LevelWriteAheadLog) Close()

func (*LevelWriteAheadLog) DeleteTask

func (wal *LevelWriteAheadLog) DeleteTask(taskId uint64) error

func (*LevelWriteAheadLog) DeleteTasks

func (wal *LevelWriteAheadLog) DeleteTasks(taskIds []uint64) error

func (*LevelWriteAheadLog) GetTask

func (wal *LevelWriteAheadLog) GetTask(taskId uint64) (*WriteTask, error)

func (*LevelWriteAheadLog) GetTasks

func (wal *LevelWriteAheadLog) GetTasks() ([]*WriteTask, error)

func (*LevelWriteAheadLog) NewTaskID

func (wal *LevelWriteAheadLog) NewTaskID() uint64

func (*LevelWriteAheadLog) PutTask

func (wal *LevelWriteAheadLog) PutTask(task *WriteTask) error

func (*LevelWriteAheadLog) PutTasks

func (wal *LevelWriteAheadLog) PutTasks(tasks []*WriteTask) error

type RedblackDatabase added in v1.0.2

type RedblackDatabase struct {
	// contains filtered or unexported fields
}

func NewRedblackDatabase added in v1.0.2

func NewRedblackDatabase() *RedblackDatabase

func (*RedblackDatabase) Close added in v1.0.2

func (db *RedblackDatabase) Close()

func (*RedblackDatabase) Delete added in v1.0.2

func (db *RedblackDatabase) Delete(key []byte) error

func (*RedblackDatabase) DeleteBatch added in v1.0.2

func (db *RedblackDatabase) DeleteBatch(b Batch)

func (*RedblackDatabase) Get added in v1.0.2

func (db *RedblackDatabase) Get(key []byte) ([]byte, error)

func (*RedblackDatabase) Has added in v1.0.2

func (db *RedblackDatabase) Has(key []byte) (bool, error)

func (*RedblackDatabase) Iterate added in v1.0.2

func (db *RedblackDatabase) Iterate(start, limit []byte, reverse bool, callback func(key, value []byte) bool)

func (*RedblackDatabase) NewBatch added in v1.0.2

func (db *RedblackDatabase) NewBatch() Batch

func (*RedblackDatabase) Put added in v1.0.2

func (db *RedblackDatabase) Put(key []byte, value []byte) error

type RevDatabase

type RevDatabase interface {
	Revertible
	Database
}

interface for databases that support reversion

type Revertible

type Revertible interface {
	// get current revision
	GetRevision() uint64

	// get current revision and base revision
	GetRevisionAndBase() (current uint64, base uint64)

	// revert to the given revision
	// you can only revert to a revision that is less than or equal to current revision.
	// after reverted to revision r, r will be the current revision.
	RevertToRevision(r uint64) error

	// rebase to the given revision
	// after rebased to revision r, r will be the minimal revision you can revert to.
	RebaseToRevision(r uint64) error

	EnableReversion(b bool) error
	ReversionEnabled() bool
}

interface for revertible feature methods must be thread safe

type RevertibleDatabase

type RevertibleDatabase struct {
	// contains filtered or unexported fields
}

func NewRevertibleDatabase

func NewRevertibleDatabase(db Database) *RevertibleDatabase

func (*RevertibleDatabase) Close

func (db *RevertibleDatabase) Close()

func (*RevertibleDatabase) Delete

func (db *RevertibleDatabase) Delete(key []byte) error

func (*RevertibleDatabase) DeleteBatch

func (db *RevertibleDatabase) DeleteBatch(b Batch)

func (*RevertibleDatabase) EnableReversion added in v1.0.2

func (db *RevertibleDatabase) EnableReversion(b bool) error

func (*RevertibleDatabase) Get

func (db *RevertibleDatabase) Get(key []byte) ([]byte, error)

func (*RevertibleDatabase) GetRevision

func (db *RevertibleDatabase) GetRevision() uint64

func (*RevertibleDatabase) GetRevisionAndBase

func (db *RevertibleDatabase) GetRevisionAndBase() (current uint64, base uint64)

func (*RevertibleDatabase) GetRevisionTag

func (db *RevertibleDatabase) GetRevisionTag(r uint64) string

func (*RevertibleDatabase) GetTagRevision

func (db *RevertibleDatabase) GetTagRevision(tag string) (uint64, error)

func (*RevertibleDatabase) Has

func (db *RevertibleDatabase) Has(key []byte) (bool, error)

func (*RevertibleDatabase) Iterate added in v1.0.2

func (db *RevertibleDatabase) Iterate(start, limit []byte, reverse bool, callback func(key, value []byte) bool)

func (*RevertibleDatabase) NewBatch

func (db *RevertibleDatabase) NewBatch() Batch

func (*RevertibleDatabase) PresetTag added in v1.0.2

func (db *RevertibleDatabase) PresetTag(tag string)

func (*RevertibleDatabase) Put

func (db *RevertibleDatabase) Put(key []byte, value []byte) error

func (*RevertibleDatabase) RebaseToRevision

func (db *RevertibleDatabase) RebaseToRevision(r uint64) error

func (*RevertibleDatabase) RebaseToTag

func (db *RevertibleDatabase) RebaseToTag(tag string) error

func (*RevertibleDatabase) ReversionEnabled added in v1.0.2

func (db *RevertibleDatabase) ReversionEnabled() bool

func (*RevertibleDatabase) RevertToRevision

func (db *RevertibleDatabase) RevertToRevision(r uint64) error

func (*RevertibleDatabase) RevertToTag

func (db *RevertibleDatabase) RevertToTag(tag string) error

func (*RevertibleDatabase) TagRevision

func (db *RevertibleDatabase) TagRevision(r uint64, tag string) (err error)

type SimpleDatabaseGroup

type SimpleDatabaseGroup struct {
	// contains filtered or unexported fields
}

the database group

func NewSimpleDatabaseGroup

func NewSimpleDatabaseGroup(dp DatabaseDispatcher, wal WriteAheadLog) (*SimpleDatabaseGroup, error)

func (*SimpleDatabaseGroup) Close

func (g *SimpleDatabaseGroup) Close()

func (*SimpleDatabaseGroup) Crashed

func (g *SimpleDatabaseGroup) Crashed() bool

func (*SimpleDatabaseGroup) Delete

func (g *SimpleDatabaseGroup) Delete(key []byte) error

func (*SimpleDatabaseGroup) DeleteBatch

func (g *SimpleDatabaseGroup) DeleteBatch(b Batch)

func (*SimpleDatabaseGroup) Get

func (g *SimpleDatabaseGroup) Get(key []byte) ([]byte, error)

func (*SimpleDatabaseGroup) Has

func (g *SimpleDatabaseGroup) Has(key []byte) (bool, error)

func (*SimpleDatabaseGroup) Iterate added in v1.0.2

func (g *SimpleDatabaseGroup) Iterate(start, limit []byte, reverse bool, callback func(key, value []byte) bool)

func (*SimpleDatabaseGroup) NewBatch

func (g *SimpleDatabaseGroup) NewBatch() Batch

func (*SimpleDatabaseGroup) Put

func (g *SimpleDatabaseGroup) Put(key []byte, value []byte) error

type SquashDatabase added in v1.0.2

type SquashDatabase interface {
	Squashable
	Database
}

type Squashable added in v1.0.2

type Squashable interface {
	Transactional

	// start a new transaction session named @tag
	BeginTransactionWithTag(tag string)

	// Squash() commits the transaction named @tag.
	// If the transaction is nested, its ancestor transactions will get committed too.
	Squash(tag string) error

	// RollbackTag() discards the transaction named @tag.
	// If any nested transactions were atop the target transaction, they will get discarded too.
	RollbackTag(tag string) error
}

interface for squashable transactional feature

type SquashableDatabase added in v1.0.2

type SquashableDatabase struct {
	TransactionalDatabase
	// contains filtered or unexported fields
}

func NewSquashableDatabase added in v1.0.2

func NewSquashableDatabase(db Database, dirtyRead bool) *SquashableDatabase

func (*SquashableDatabase) BeginTransaction added in v1.0.2

func (db *SquashableDatabase) BeginTransaction()

func (*SquashableDatabase) BeginTransactionWithTag added in v1.0.2

func (db *SquashableDatabase) BeginTransactionWithTag(tag string)

func (*SquashableDatabase) Close added in v1.0.2

func (dq *SquashableDatabase) Close()

func (*SquashableDatabase) Delete added in v1.0.2

func (dq *SquashableDatabase) Delete(key []byte) error

func (*SquashableDatabase) DeleteBatch added in v1.0.2

func (dq *SquashableDatabase) DeleteBatch(b Batch)

func (*SquashableDatabase) EndTransaction added in v1.0.2

func (db *SquashableDatabase) EndTransaction(commit bool) error

func (*SquashableDatabase) Get added in v1.0.2

func (dq *SquashableDatabase) Get(key []byte) ([]byte, error)

func (*SquashableDatabase) Has added in v1.0.2

func (dq *SquashableDatabase) Has(key []byte) (bool, error)

func (*SquashableDatabase) HashOfTopSession added in v1.0.2

func (dq *SquashableDatabase) HashOfTopSession() (hash uint32)

func (*SquashableDatabase) Iterate added in v1.0.2

func (dq *SquashableDatabase) Iterate(start, limit []byte, reverse bool, callback func(key, value []byte) bool)

func (*SquashableDatabase) NewBatch added in v1.0.2

func (dq *SquashableDatabase) NewBatch() Batch

func (*SquashableDatabase) PopBack added in v1.0.2

func (dq *SquashableDatabase) PopBack(commit bool) error

func (*SquashableDatabase) PopBackN added in v1.0.2

func (dq *SquashableDatabase) PopBackN(n int, commit bool) error

func (*SquashableDatabase) PopFront added in v1.0.2

func (dq *SquashableDatabase) PopFront(commit bool) error

func (*SquashableDatabase) PushBack added in v1.0.2

func (dq *SquashableDatabase) PushBack()

func (*SquashableDatabase) PushFront added in v1.0.2

func (dq *SquashableDatabase) PushFront()

func (*SquashableDatabase) Put added in v1.0.2

func (dq *SquashableDatabase) Put(key []byte, value []byte) error

func (*SquashableDatabase) RollbackTag added in v1.0.2

func (db *SquashableDatabase) RollbackTag(tag string) error

func (*SquashableDatabase) Size added in v1.0.2

func (dq *SquashableDatabase) Size() uint

func (*SquashableDatabase) Squash added in v1.0.2

func (db *SquashableDatabase) Squash(tag string) error

type TagRevDatabase

type TagRevDatabase interface {
	TagRevertible
	Database
}

interface for databases that support reversion and revision tagging

type TagRevertible

type TagRevertible interface {
	Revertible

	// tag a revision
	TagRevision(r uint64, tag string) error

	// get revision of a tag
	GetTagRevision(tag string) (uint64, error)

	// get tag of a revision
	GetRevisionTag(r uint64) string

	// revert to a revision by its tag
	RevertToTag(tag string) error

	// rebase to a revision by its tag
	RebaseToTag(tag string) error
}

interface for databases that support reversion and revision tagging

type Transactional

type Transactional interface {
	// start a new transaction session
	BeginTransaction()

	// end current transaction session, Commit or discard changes
	EndTransaction(commit bool) error

	// current transaction height
	TransactionHeight() uint
}

interface for transaction feature methods must be thread safe transaction sessions can be nested. BeginTransaction()/EndTransaction() must be paired.

type TransactionalDatabase

type TransactionalDatabase struct {
	// contains filtered or unexported fields
}

TransactionalDatabase adds transactional feature on its underlying database

func NewTransactionalDatabase

func NewTransactionalDatabase(db Database, dirtyRead bool) *TransactionalDatabase

func (*TransactionalDatabase) BeginTransaction

func (db *TransactionalDatabase) BeginTransaction()

start a transaction session

func (*TransactionalDatabase) Close

func (dq *TransactionalDatabase) Close()

func (*TransactionalDatabase) Delete

func (dq *TransactionalDatabase) Delete(key []byte) error

func (*TransactionalDatabase) DeleteBatch

func (dq *TransactionalDatabase) DeleteBatch(b Batch)

func (*TransactionalDatabase) EndTransaction

func (db *TransactionalDatabase) EndTransaction(commit bool) error

end a transaction session. Commit or discard changes

func (*TransactionalDatabase) Get

func (dq *TransactionalDatabase) Get(key []byte) ([]byte, error)

func (*TransactionalDatabase) Has

func (dq *TransactionalDatabase) Has(key []byte) (bool, error)

func (*TransactionalDatabase) HashOfTopSession added in v1.0.2

func (dq *TransactionalDatabase) HashOfTopSession() (hash uint32)

func (*TransactionalDatabase) HashOfTopTransaction added in v1.0.2

func (db *TransactionalDatabase) HashOfTopTransaction() uint32

func (*TransactionalDatabase) Iterate added in v1.0.2

func (dq *TransactionalDatabase) Iterate(start, limit []byte, reverse bool, callback func(key, value []byte) bool)

func (*TransactionalDatabase) NewBatch

func (dq *TransactionalDatabase) NewBatch() Batch

func (*TransactionalDatabase) PopBack added in v1.0.2

func (dq *TransactionalDatabase) PopBack(commit bool) error

func (*TransactionalDatabase) PopBackN added in v1.0.2

func (dq *TransactionalDatabase) PopBackN(n int, commit bool) error

func (*TransactionalDatabase) PopFront added in v1.0.2

func (dq *TransactionalDatabase) PopFront(commit bool) error

func (*TransactionalDatabase) PushBack added in v1.0.2

func (dq *TransactionalDatabase) PushBack()

func (*TransactionalDatabase) PushFront added in v1.0.2

func (dq *TransactionalDatabase) PushFront()

func (*TransactionalDatabase) Put

func (dq *TransactionalDatabase) Put(key []byte, value []byte) error

func (*TransactionalDatabase) Size added in v1.0.2

func (dq *TransactionalDatabase) Size() uint

func (*TransactionalDatabase) TransactionHeight

func (db *TransactionalDatabase) TransactionHeight() uint

type TrxDatabase

type TrxDatabase interface {
	Transactional
	Database
}

interface for databases that support transactions

type WriteAheadLog

type WriteAheadLog interface {
	NewTaskID() uint64
	GetTasks() ([]*WriteTask, error)
	GetTask(taskId uint64) (*WriteTask, error)
	PutTask(task *WriteTask) error
	PutTasks(tasks []*WriteTask) error
	DeleteTask(taskId uint64) error
	DeleteTasks(taskIds []uint64) error
}

type WriteTask

type WriteTask struct {
	TaskID     uint64
	DatabaseID string
	Operations []writeOp
}

func DecodeWriteTask

func DecodeWriteTask(data []byte) *WriteTask

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL