Documentation ¶
Index ¶
- Constants
- Variables
- type CacheMVCCDB
- func (m *CacheMVCCDB) Checkout(t string) bool
- func (m *CacheMVCCDB) Close() error
- func (m *CacheMVCCDB) Commit(t string)
- func (m *CacheMVCCDB) CurrentTag() string
- func (m *CacheMVCCDB) Del(table string, key string) error
- func (m *CacheMVCCDB) Flush(t string) error
- func (m *CacheMVCCDB) Fork() MVCCDB
- func (m *CacheMVCCDB) Get(table string, key string) (string, error)
- func (m *CacheMVCCDB) Has(table string, key string) (bool, error)
- func (m *CacheMVCCDB) Keys(table string, prefix string) ([]string, error)
- func (m *CacheMVCCDB) Put(table string, key string, value string) error
- func (m *CacheMVCCDB) Size() (int64, error)
- type Commit
- type CommitManager
- type Item
- type MVCCDB
Constants ¶
const (
SEPARATOR = '/'
)
constant of mvccdb
Variables ¶
var (
ErrTableNotValid = fmt.Errorf("table name is not valid")
)
error of mvccdb
Functions ¶
This section is empty.
Types ¶
type CacheMVCCDB ¶
type CacheMVCCDB struct {
// contains filtered or unexported fields
}
CacheMVCCDB is the mvcc db with cache
func NewCacheMVCCDB ¶
func NewCacheMVCCDB(path string, cacheType mvcc.CacheType) (*CacheMVCCDB, error)
NewCacheMVCCDB returns new CacheMVCCDB
func (*CacheMVCCDB) Checkout ¶
func (m *CacheMVCCDB) Checkout(t string) bool
Checkout will checkout the specify tag of mvccdb
func (*CacheMVCCDB) Commit ¶
func (m *CacheMVCCDB) Commit(t string)
Commit will commit the stage and add tag to current state of mvccdb
func (*CacheMVCCDB) CurrentTag ¶
func (m *CacheMVCCDB) CurrentTag() string
CurrentTag will return current tag of mvccdb
func (*CacheMVCCDB) Del ¶
func (m *CacheMVCCDB) Del(table string, key string) error
Del will remove the specify key in the table
func (*CacheMVCCDB) Flush ¶
func (m *CacheMVCCDB) Flush(t string) error
Flush will persist the current state of mvccdb
func (*CacheMVCCDB) Fork ¶
func (m *CacheMVCCDB) Fork() MVCCDB
Fork will fork the mvcdb thread safe between all forks of the mvccdb
func (*CacheMVCCDB) Get ¶
func (m *CacheMVCCDB) Get(table string, key string) (string, error)
Get returns the value of specify key and table
func (*CacheMVCCDB) Has ¶
func (m *CacheMVCCDB) Has(table string, key string) (bool, error)
Has returns whether the specified key exists in the table
func (*CacheMVCCDB) Keys ¶
func (m *CacheMVCCDB) Keys(table string, prefix string) ([]string, error)
Keys returns the list of key prefixed with prefix in the table
func (*CacheMVCCDB) Put ¶
func (m *CacheMVCCDB) Put(table string, key string, value string) error
Put will insert the key-value pair into the table
func (*CacheMVCCDB) Size ¶
func (m *CacheMVCCDB) Size() (int64, error)
Size returns the size of mvccdb
type CommitManager ¶
type CommitManager struct {
// contains filtered or unexported fields
}
CommitManager is the commit manager, support get, delete etc.
func NewCommitManager ¶
func NewCommitManager() *CommitManager
NewCommitManager returns new commit manager
func (*CommitManager) FreeBefore ¶
func (m *CommitManager) FreeBefore(c *Commit)
FreeBefore will free the momery of commits before the commit
func (*CommitManager) Get ¶
func (m *CommitManager) Get(t string) *Commit
Get will get a commit by tag
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item is the value of cache
type MVCCDB ¶
type MVCCDB interface { Get(table string, key string) (string, error) Put(table string, key string, value string) error Del(table string, key string) error Has(table string, key string) (bool, error) Keys(table string, prefix string) ([]string, error) Checkout(t string) bool Commit(t string) CurrentTag() string Fork() MVCCDB Flush(t string) error Size() (int64, error) Close() error }
MVCCDB is the interface of mvccdb
Directories ¶
Path | Synopsis |
---|---|
Package db_mock is a generated GoMock package.
|
Package db_mock is a generated GoMock package. |
Package wal This Module is in so many aspects inspired by etcd's WAL.
|
Package wal This Module is in so many aspects inspired by etcd's WAL. |