db

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 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()

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 Commit

type Commit struct {
	mvcc.Cache
	Tags []string
}

Commit is the cache of specify tag

func NewCommit

func NewCommit(cacheType mvcc.CacheType) *Commit

NewCommit returns new commit

func (*Commit) Fork

func (c *Commit) Fork() *Commit

Fork will fork the commit thread safe between all forks of 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

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

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