Documentation ¶
Index ¶
- Variables
- func CompactIndex(name, diskstore string, diskpaths []string, merge bool)
- func Defaultsettings() s.Settings
- func LogComponents(components ...string)
- func PurgeIndex(name, logpath, diskstore string, diskpaths []string)
- type Bogn
- func (bogn *Bogn) BeginTxn(id uint64) api.Transactor
- func (bogn *Bogn) Close()
- func (bogn *Bogn) Commit(appdata []byte)
- func (bogn *Bogn) Delete(key, oldvalue []byte, lsm bool) ([]byte, uint64)
- func (bogn *Bogn) Destroy()
- func (bogn *Bogn) Disksnapshots() func(fin bool) api.Disksnapshot
- func (bogn *Bogn) Get(key, value []byte) (v []byte, cas uint64, del, ok bool)
- func (bogn *Bogn) Getseqno() uint64
- func (bogn *Bogn) ID() string
- func (bogn *Bogn) Log()
- func (bogn *Bogn) Scan() api.Iterator
- func (bogn *Bogn) ScanEntries() api.EntryIterator
- func (bogn *Bogn) Set(key, value, oldvalue []byte) (ov []byte, cas uint64)
- func (bogn *Bogn) SetCAS(key, value, oldvalue []byte, cas uint64) ([]byte, uint64, error)
- func (bogn *Bogn) Start() *Bogn
- func (bogn *Bogn) TombstonePurge()
- func (bogn *Bogn) Validate()
- func (bogn *Bogn) View(id uint64) api.Transactor
- type Cursor
- func (cur *Cursor) Delcursor(lsm bool)
- func (cur *Cursor) Delete(key, oldvalue []byte, lsm bool) []byte
- func (cur *Cursor) GetNext() (key, value []byte, deleted bool, err error)
- func (cur *Cursor) Key() (key []byte, deleted bool)
- func (cur *Cursor) Set(key, value, oldvalue []byte) []byte
- func (cur *Cursor) Value() []byte
- func (cur *Cursor) YNext(fin bool) (key, value []byte, cas uint64, deleted bool, err error)
- type Txn
- func (txn *Txn) Abort()
- func (txn *Txn) Commit() error
- func (txn *Txn) Delete(key, oldvalue []byte, lsm bool) []byte
- func (txn *Txn) Get(key, value []byte) (v []byte, cas uint64, deleted, ok bool)
- func (txn *Txn) ID() uint64
- func (txn *Txn) OpenCursor(key []byte) (api.Cursor, error)
- func (txn *Txn) Set(key, value, oldvalue []byte) []byte
- type View
- func (view *View) Abort()
- func (view *View) Commit() error
- func (view *View) Delete(key, oldvalue []byte, lsm bool) []byte
- func (view *View) Get(key, value []byte) (v []byte, cas uint64, deleted, ok bool)
- func (view *View) ID() uint64
- func (view *View) OpenCursor(key []byte) (api.Cursor, error)
- func (view *View) Set(key, value, oldvalue []byte) []byte
Constants ¶
This section is empty.
Variables ¶
var Compacttick = time.Duration(1 * time.Second)
Compacttick timer tick to check for memory overflow, persistance, flushing, compacting memory stores and/or disk stores. Purger routine uses this tick to periodically purge un-referenced storage instance.
Functions ¶
func CompactIndex ¶
CompactIndex will remove older versions of disk level snapshots and if merge is true, will merge all disk-levels into single level.
func Defaultsettings ¶
Defaultsettings for bogn instances. Applications can get the default settings and tune settings parameter for desired behaviour. Default settings include llrb.Defaultsettings().
"logpath" (string, default: "")
Directory path to store log files. If not supplied, and durable is true, then one of the diskpath from diskstore will be used.
"memstore" (string, default: "llrb")
Type of index for in memory storage, can be "llrb" or "mvcc".
"diskstore" (string, default: "bubt")
Type of index for in disk storage, can be "bubt".
"durable" (bool, default:false)
Persist index on disk.
"dgm" (bool, default:false)
Disk-Greater-than-Memory, configure bogn-index whose size won't fit in memory.
"workingset" (bool, default: false)
This configuration is valid only when `dgm` is set to true. Set this as true only when a subset of keys in bogn-index will be actived accessed, either for read or write.
"autocommit" (int64, default: 100)
Time is seconds to periodically persist transient writes onto disk. If set to ZERO, then it is upto the application to issue a Commit() call to persist the transient writes.
"flushratio" (floating, default: .25)
This configuration is valid only when `dgm` is set to true. When ratio between memory footprint, for the latest batch of mutations, and latest level's disk-footprint falls below flushratio, then a newer level will be created to flush the latest batch of mutations in memory.
"compactratio" (floating, default: .50)
This configuration is valid only when `dgm` is set to true. Two succesive disk levels will be merged together into a single snapshot if their ratio exceed compactratio.
"compactperiod" (int64, default: 3600)
If the lifetime, measured in seconds, of a disk snapshot exceeds compactperiod, then it will be merged with next disk level snapshot.
"bubt.mblocksize" (int64, default: 4096)
BottomsUpBTree, size of intermediate node, m-nodes, on disk.
"bubt.zblocksize" (int64, default: same as mblocksize)
BottomsUpBTree, size of leaf node, z-nodes, on disk.
"bubt.vblocksize" (int64, default: same as mblocksize)
BottomsUpBTree, size of value log blocsk, on disk.
"bubt.mmap" (bool, default: true)
BottomsUpBTree, whether to memory-map leaf node, intermediate nodes are always memory-mapped.
"bubt.diskpaths" (string, default: "/opt/bogn/")
BottomsUpBTree, comma separated list of path to persist intermediate nodes and leaf nodes.
func LogComponents ¶
func LogComponents(components ...string)
LogComponents enable logging. By default logging is disabled, if applications want log information for bogn components call this function with "self" or "bogn" as argument. To enable logging for bogn and all of its components call this function with "all" or "bogn","bubt","llrb" as argument.
func PurgeIndex ¶
PurgeIndex will purge all the disk level snapshots for index `name` founder under `diskpaths`.
Types ¶
type Bogn ¶
type Bogn struct {
// contains filtered or unexported fields
}
Bogn instance to index key,value pairs.
func (*Bogn) BeginTxn ¶
func (bogn *Bogn) BeginTxn(id uint64) api.Transactor
BeginTxn starts a read-write transaction. All transactions should either be committed or aborted. If transactions are not released for long time it might increase the memory pressure on the system. Concurrent transactions are allowed, and serialized internally.
func (*Bogn) Commit ¶
Commit will trigger a memory to disk flush and/or disk compaction. Applications can supply appdata that will be stored as part of the lastest snapshot.
func (*Bogn) Delete ¶
Delete key from index. Key should not be nil, if key found return its value. If lsm is true, then don't delete the node instead mark the node as deleted. Again, if lsm is true but key is not found in index, a new entry will inserted.
func (*Bogn) Destroy ¶
func (bogn *Bogn) Destroy()
Destroy the disk snapshots of this instance, no calls allowed after Destroy.
func (*Bogn) Disksnapshots ¶
func (bogn *Bogn) Disksnapshots() func(fin bool) api.Disksnapshot
Disksnapshots return a iterator to iterate on disk snapshots. Until the iterator is closed, by calling diskiterator(true /*fin*/), all write operations will be blocked. Caller can iterate until a nil is return for api.Disksnapshot
func (*Bogn) Get ¶
Get value for key, if value argument points to valid buffer it will, be used to copy the entry's value. Also returns entry's cas, whether entry is marked as deleted by LSM. If ok is false, then key is not found.
func (*Bogn) Scan ¶
Scan return a full table iterator, if iteration is stopped before reaching end of table (io.EOF), application should call iterator with fin as true. EG: iter(true)
func (*Bogn) ScanEntries ¶
func (bogn *Bogn) ScanEntries() api.EntryIterator
ScanEntries is not supported by Bogn.
func (*Bogn) Set ¶
Set a key, value pair in the index, if key is already present, its value will be over-written. Make sure key is not nil. Return old value if oldvalue points to valid buffer.
func (*Bogn) SetCAS ¶
SetCAS a key, value pair in the index, if CAS is ZERO then key should not be present in the index, otherwise existing CAS should match the supplied CAS. Value will be over-written. Make sure key is not nil. Return old value if oldvalue points to valid buffer.
func (*Bogn) Start ¶
Start bogn service. Typically bogn instances are created and started as:
inst := NewBogn("storage", setts).Start()
func (*Bogn) TombstonePurge ¶
func (bogn *Bogn) TombstonePurge()
TombstonePurge call will remove all entries marked as deleted from the oldest and top-most disk level, provided the highest seqno stored in that level is less that `seqno`.
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor object maintains an active pointer into index. Use OpenCursor on Txn object to create a new cursor.
func (*Cursor) Delete ¶
Delete is an alias to txn.Delete call. The current position of the cursor does not affect the delete operation.
func (*Cursor) GetNext ¶
GetNext move cursor to next entry in snapshot and return its key and value. Returned byte slices will be a reference to index entry, hence must not be used after transaction is committed or aborted.
func (*Cursor) Key ¶
Key return current key under the cursor. Returned byte slice will be a reference to index-key, hence must not be used after transaction is commited or aborted.
func (*Cursor) Set ¶
Set is an alias to txn.Set call. The current position of the cursor does not affect the set operation.
type Txn ¶
type Txn struct {
// contains filtered or unexported fields
}
Txn transaction definition. Transaction gives a gaurantee of isolation and atomicity on the latest snapshot.
func (*Txn) Commit ¶
Commit transaction, commit will block until all write operations under the transaction are successfully applied. Return ErrorRollback if ACID properties are not met while applying the write operations. Transactions are never partially committed.
func (*Txn) Delete ¶
Delete key from index. The Delete operation will be remembered as a log entry and applied on the underlying structure during commit.
func (*Txn) OpenCursor ¶
OpenCursor open an active cursor inside the index.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View transaction definition. Read only version of Txn.
func (*View) OpenCursor ¶
OpenCursor open an active cursor inside the index.