store

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2015 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyFullSyncEnd    = "full-sync-end"
	KeyIncrSyncEnd    = "incr-sync-end"
	KeySyncLogMissing = "sync-log-missing"
)

AdminDB keys, reserved tableId=0(no migration on this table)

Variables

This section is empty.

Functions

func SeekAndCopySyncPkg

func SeekAndCopySyncPkg(it *Iterator, p *proto.PkgMultiOp,
	migration bool, migUnitId uint16) bool

Types

type Authorize

type Authorize interface {
	// Check whether dbId is authorized
	IsAuth(dbId uint8) bool

	// If dbId is already authorized, SetAuth keeps this infomation
	SetAuth(dbId uint8)
}

type DB

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

func NewDB

func NewDB() *DB

func (*DB) Close

func (db *DB) Close()

func (*DB) Commit

func (db *DB) Commit(wb *WriteBatch) error

func (*DB) Del

func (db *DB) Del(rawKey []byte, wb *WriteBatch) error

func (*DB) Get

func (db *DB) Get(opt *ReadOptions, rawKey []byte) ([]byte, error)

func (*DB) NewIterator

func (db *DB) NewIterator(opt *ReadOptions) *Iterator

func (*DB) NewReadOptions

func (db *DB) NewReadOptions(createSnapshot bool) *ReadOptions

func (*DB) NewWriteBatch

func (db *DB) NewWriteBatch() *WriteBatch

func (*DB) Open

func (db *DB) Open(name string, createIfMissing bool, maxOpenFiles int,
	writeBufSize int, cacheSize int64, compression int) error

func (*DB) Put

func (db *DB) Put(rawKey, value []byte, wb *WriteBatch) error

type Iterator

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

func (*Iterator) Destroy

func (iter *Iterator) Destroy()

func (*Iterator) Key

func (iter *Iterator) Key() []byte

func (*Iterator) Next

func (iter *Iterator) Next()

func (*Iterator) Prev

func (iter *Iterator) Prev()

func (*Iterator) Seek

func (iter *Iterator) Seek(key []byte)

func (*Iterator) SeekToFirst

func (iter *Iterator) SeekToFirst()

func (*Iterator) SeekToLast

func (iter *Iterator) SeekToLast()

func (*Iterator) Valid

func (iter *Iterator) Valid() bool

func (*Iterator) Value

func (iter *Iterator) Value() []byte

type PkgArgs

type PkgArgs struct {
	Cmd  uint8
	DbId uint8
	Seq  uint64
	Pkg  []byte
}

type ReadOptions

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

func (*ReadOptions) Destroy

func (opt *ReadOptions) Destroy()

func (*ReadOptions) SetFillCache

func (opt *ReadOptions) SetFillCache(fillCache bool)

type Table

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

func NewTable

func NewTable(tableDir string, maxOpenFiles int,
	writeBufSize int, cacheSize int64, compression string) *Table

func (*Table) Auth

func (tbl *Table) Auth(req *PkgArgs, au Authorize) []byte

func (*Table) Close

func (tbl *Table) Close()

func (*Table) Del

func (tbl *Table) Del(req *PkgArgs, au Authorize, wa *WriteAccess) ([]byte, bool)

func (*Table) DeleteUnit added in v1.0.3

func (tbl *Table) DeleteUnit(unitId uint16) error

func (*Table) Dump

func (tbl *Table) Dump(req *PkgArgs, au Authorize) []byte

func (*Table) Get

func (tbl *Table) Get(req *PkgArgs, au Authorize, wa *WriteAccess) []byte

func (*Table) GetRWMutex

func (tbl *Table) GetRWMutex() *sync.RWMutex

func (*Table) HasUnitData added in v1.0.3

func (tbl *Table) HasUnitData(unitId uint16) bool

func (*Table) Incr

func (tbl *Table) Incr(req *PkgArgs, au Authorize, wa *WriteAccess) ([]byte, bool)

func (*Table) MDel

func (tbl *Table) MDel(req *PkgArgs, au Authorize, wa *WriteAccess) ([]byte, bool)

func (*Table) MGet

func (tbl *Table) MGet(req *PkgArgs, au Authorize, wa *WriteAccess) []byte

func (*Table) MIncr

func (tbl *Table) MIncr(req *PkgArgs, au Authorize, wa *WriteAccess) ([]byte, bool)

func (*Table) MSet

func (tbl *Table) MSet(req *PkgArgs, au Authorize, wa *WriteAccess) ([]byte, bool)

func (*Table) NewIterator

func (tbl *Table) NewIterator(fillCache bool) *Iterator

func (*Table) Scan

func (tbl *Table) Scan(req *PkgArgs, au Authorize) []byte

func (*Table) Set

func (tbl *Table) Set(req *PkgArgs, au Authorize, wa *WriteAccess) ([]byte, bool)

func (*Table) SetPassword

func (tbl *Table) SetPassword(dbId uint8, password string)

func (*Table) Sync

func (tbl *Table) Sync(req *PkgArgs) ([]byte, bool)

type TableLock

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

func NewTableLock

func NewTableLock() *TableLock

func (*TableLock) GetLock

func (tl *TableLock) GetLock(key []byte) *UnitLock

type UnitLock added in v1.0.3

type UnitLock struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*UnitLock) ClearCas added in v1.0.3

func (u *UnitLock) ClearCas(key []byte)

func (*UnitLock) GetCas added in v1.0.3

func (u *UnitLock) GetCas(key []byte) uint32

func (*UnitLock) NewCas added in v1.0.3

func (u *UnitLock) NewCas(key []byte) uint32

type WriteAccess

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

func NewWriteAccess

func NewWriteAccess(replication bool, mc *config.MasterConfig) *WriteAccess

func (*WriteAccess) Check

func (m *WriteAccess) Check() bool

return false: no right to write! return true: may have right to write, need to check key or unit again

func (*WriteAccess) CheckKey

func (m *WriteAccess) CheckKey(dbId, tableId uint8, rowKey []byte) bool

Do we have right to write this key?

func (*WriteAccess) CheckUnit added in v1.0.3

func (m *WriteAccess) CheckUnit(unitId uint16) bool

Do we have right to write this unit?

type WriteBatch

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

func (*WriteBatch) Destroy

func (wb *WriteBatch) Destroy()

Jump to

Keyboard shortcuts

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