Documentation ¶
Index ¶
- Constants
- Variables
- type CacheMVCCDB
- func (m *CacheMVCCDB) Checkout(t string) bool
- func (m *CacheMVCCDB) Close() error
- func (m *CacheMVCCDB) Commit()
- 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) Rollback()
- func (m *CacheMVCCDB) Tag(t string)
- 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()
Commit will commit current state of mvccdb
func (*CacheMVCCDB) CurrentTag ¶
func (m *CacheMVCCDB) CurrentTag() string
CurrentTag will returns 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) Rollback ¶
func (m *CacheMVCCDB) Rollback()
Rollback will rollback the state of mvccdb
func (*CacheMVCCDB) Tag ¶
func (m *CacheMVCCDB) Tag(t string)
Tag will add tag to current state 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) AddTag ¶
func (m *CommitManager) AddTag(c *Commit, t string)
AddTag will make the commit with the tag
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
func (*CommitManager) GetTags ¶
func (m *CommitManager) GetTags(c *Commit) []string
GetTags returns tags of the commit
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) Commit() Rollback() Checkout(t string) bool Tag(t string) CurrentTag() string Fork() MVCCDB Flush(t string) 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. |