db

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2019 License: LGPL-3.0 Imports: 4 Imported by: 18

Documentation

Index

Constants

View Source
const (
	SEPARATOR = '/'
)

constant of mvccdb

Variables

View Source
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) Close

func (m *CacheMVCCDB) Close() error

Close will close the 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 Commit

type Commit struct {
	mvcc.Cache
	Tag string
}

Commit is the cache of specify tag

func NewCommit

func NewCommit(cache mvcc.Cache, tag string) *Commit

NewCommit returns new commit

func (*Commit) ForkCache

func (c *Commit) ForkCache() mvcc.Cache

ForkCache will fork a cache from the commit

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) Add

func (m *CommitManager) Add(c *Commit)

Add will add a commit with 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) Tags

func (m *CommitManager) Tags() []string

Tags will return last 10 tags

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

func NewMVCCDB

func NewMVCCDB(path string) (MVCCDB, error)

NewMVCCDB return new mvccdb

Directories

Path Synopsis
kv
Package db_mock is a generated GoMock package.
Package db_mock is a generated GoMock package.
map
wal
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.

Jump to

Keyboard shortcuts

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