Documentation ¶
Index ¶
- Constants
- Variables
- type AppFactoryFunc
- type HistoryReader
- type HistoryReaderSpec
- type KV
- type Options
- func (opts *Options) Validate() error
- func (opts *Options) WithAppFactory(appFactory AppFactoryFunc) *Options
- func (opts *Options) WithCacheSize(cacheSize int) *Options
- func (opts *Options) WithCleanupPercentage(cleanupPercentage float32) *Options
- func (opts *Options) WithCommitLogMaxOpenedFiles(commitLogMaxOpenedFiles int) *Options
- func (opts *Options) WithCompactionThld(compactionThld int) *Options
- func (opts *Options) WithDelayDuringCompaction(delay time.Duration) *Options
- func (opts *Options) WithFileMode(fileMode os.FileMode) *Options
- func (opts *Options) WithFileSize(fileSize int) *Options
- func (opts *Options) WithFlushBufferSize(size int) *Options
- func (opts *Options) WithFlushThld(flushThld int) *Options
- func (opts *Options) WithHistoryLogMaxOpenedFiles(historyLogMaxOpenedFiles int) *Options
- func (opts *Options) WithLogger(logger logger.Logger) *Options
- func (opts *Options) WithMaxActiveSnapshots(maxActiveSnapshots int) *Options
- func (opts *Options) WithMaxKeySize(maxKeySize int) *Options
- func (opts *Options) WithMaxNodeSize(maxNodeSize int) *Options
- func (opts *Options) WithMaxValueSize(maxValueSize int) *Options
- func (opts *Options) WithNodesLogMaxOpenedFiles(nodesLogMaxOpenedFiles int) *Options
- func (opts *Options) WithReadOnly(readOnly bool) *Options
- func (opts *Options) WithRenewSnapRootAfter(renewSnapRootAfter time.Duration) *Options
- func (opts *Options) WithSyncThld(syncThld int) *Options
- type Reader
- type ReaderSpec
- type Snapshot
- func (s *Snapshot) Close() error
- func (s *Snapshot) ExistKeyWith(prefix []byte, neq []byte) (bool, error)
- func (s *Snapshot) Get(key []byte) (value []byte, ts uint64, hc uint64, err error)
- func (s *Snapshot) History(key []byte, offset uint64, descOrder bool, limit int) (tss []uint64, hCount uint64, err error)
- func (s *Snapshot) NewHistoryReader(spec *HistoryReaderSpec) (*HistoryReader, error)
- func (s *Snapshot) NewReader(spec *ReaderSpec) (r *Reader, err error)
- func (s *Snapshot) Set(key, value []byte) error
- func (s *Snapshot) Ts() uint64
- func (s *Snapshot) WriteTo(nw, hw io.Writer, writeOpts *WriteOpts) (rootOffset, minOffset int64, wN, wH int64, err error)
- type TBtree
- func (t *TBtree) BulkInsert(kvs []*KV) error
- func (t *TBtree) Close() error
- func (t *TBtree) Compact() (uint64, error)
- func (t *TBtree) ExistKeyWith(prefix []byte, neq []byte) (bool, error)
- func (t *TBtree) Flush() (wN, wH int64, err error)
- func (t *TBtree) FlushWith(cleanupPercentage float32, synced bool) (wN, wH int64, err error)
- func (t *TBtree) Get(key []byte) (value []byte, ts uint64, hc uint64, err error)
- func (t *TBtree) GetOptions() *Options
- func (t *TBtree) History(key []byte, offset uint64, descOrder bool, limit int) (tss []uint64, hCount uint64, err error)
- func (t *TBtree) IncreaseTs(ts uint64) error
- func (t *TBtree) Insert(key []byte, value []byte) error
- func (t *TBtree) Snapshot() (*Snapshot, error)
- func (t *TBtree) SnapshotCount() (uint64, error)
- func (t *TBtree) SnapshotSince(ts uint64) (*Snapshot, error)
- func (t *TBtree) Sync() error
- func (t *TBtree) Ts() uint64
- type WriteOpts
Constants ¶
View Source
const ( InnerNodeType = iota LeafNodeType )
View Source
const ( MetaVersion = "VERSION" MetaMaxNodeSize = "MAX_NODE_SIZE" MetaMaxKeySize = "MAX_KEY_SIZE" MetaMaxValueSize = "MAX_VALUE_SIZE" )
View Source
const DefaultCacheSize = 100_000
View Source
const DefaultCleanUpPercentage float32 = 0
View Source
const DefaultCommitLogMaxOpenedFiles = 1
View Source
const DefaultCompactionThld = 2
View Source
const DefaultDelayDuringCompaction = time.Duration(10) * time.Millisecond
View Source
const DefaultFileMode = os.FileMode(0755)
View Source
const DefaultFileSize = 1 << 26 // 64Mb
View Source
const DefaultFlushBufferSize = 4096
View Source
const DefaultFlushThld = 100_000
View Source
const DefaultHistoryLogMaxOpenedFiles = 1
View Source
const DefaultMaxActiveSnapshots = 100
View Source
const DefaultMaxKeySize = 1024
View Source
const DefaultMaxNodeSize = 4096
View Source
const DefaultMaxValueSize = 512
View Source
const DefaultNodesLogMaxOpenedFiles = 10
View Source
const DefaultRenewSnapRootAfter = time.Duration(1000) * time.Millisecond
View Source
const DefaultSyncThld = 1_000_000
View Source
const MinCacheSize = 1
View Source
const Version = 3
Variables ¶
View Source
var ErrAlreadyClosed = errors.New("tbtree: index already closed")
View Source
var ErrCompactAlreadyInProgress = errors.New("tbtree: compact already in progress")
View Source
var ErrCompactionThresholdNotReached = errors.New("tbtree: compaction threshold not yet reached")
View Source
var ErrCorruptedCLog = errors.New("tbtree: commit log is corrupted")
View Source
var ErrCorruptedFile = errors.New("tbtree: file is corrupted")
View Source
var ErrIllegalArguments = fmt.Errorf("tbtree: %w", embedded.ErrIllegalArguments)
View Source
var ErrIllegalState = embedded.ErrIllegalState // TODO: grpc error mapping hardly relies on the actual message, see IllegalStateHandlerInterceptor
View Source
var ErrIncompatibleDataFormat = errors.New("tbtree: incompatible data format")
View Source
var ErrInvalidOptions = fmt.Errorf("%w: invalid options", ErrIllegalArguments)
View Source
var ErrKeyNotFound = fmt.Errorf("tbtree: %w", embedded.ErrKeyNotFound)
View Source
var ErrNoMoreEntries = fmt.Errorf("tbtree: %w", embedded.ErrNoMoreEntries)
View Source
var ErrOffsetOutOfRange = fmt.Errorf("tbtree: %w", embedded.ErrOffsetOutOfRange)
View Source
var ErrReadersNotClosed = errors.New("tbtree: readers not closed")
View Source
var ErrReadingFileContent = errors.New("tbtree: error reading required file content")
View Source
var ErrSnapshotsNotClosed = errors.New("tbtree: snapshots not closed")
View Source
var ErrTargetPathAlreadyExists = errors.New("tbtree: target folder already exists")
View Source
var ErrorMaxKeySizeExceeded = errors.New("tbtree: max key size exceeded")
View Source
var ErrorMaxValueSizeExceeded = errors.New("tbtree: max value size exceeded")
View Source
var ErrorPathIsNotADirectory = errors.New("tbtree: path is not a directory")
View Source
var ErrorToManyActiveSnapshots = errors.New("tbtree: max active snapshots limit reached")
Functions ¶
This section is empty.
Types ¶
type AppFactoryFunc ¶ added in v1.0.5
type AppFactoryFunc func( rootPath string, subPath string, opts *multiapp.Options, ) (appendable.Appendable, error)
type HistoryReader ¶ added in v0.9.1
type HistoryReader struct {
// contains filtered or unexported fields
}
func (*HistoryReader) Close ¶ added in v0.9.1
func (r *HistoryReader) Close() error
func (*HistoryReader) Read ¶ added in v0.9.1
func (r *HistoryReader) Read() (tss []uint64, err error)
type HistoryReaderSpec ¶ added in v0.9.1
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func DefaultOptions ¶
func DefaultOptions() *Options
func (*Options) WithAppFactory ¶ added in v1.0.5
func (opts *Options) WithAppFactory(appFactory AppFactoryFunc) *Options
func (*Options) WithCacheSize ¶
func (*Options) WithCleanupPercentage ¶ added in v1.2.3
func (*Options) WithCommitLogMaxOpenedFiles ¶ added in v1.2.3
func (*Options) WithCompactionThld ¶ added in v0.9.2
func (*Options) WithDelayDuringCompaction ¶ added in v0.9.2
func (*Options) WithFileSize ¶
func (*Options) WithFlushBufferSize ¶ added in v1.2.3
func (*Options) WithFlushThld ¶
func (*Options) WithHistoryLogMaxOpenedFiles ¶ added in v1.2.3
func (*Options) WithLogger ¶ added in v1.2.4
func (*Options) WithMaxActiveSnapshots ¶
func (*Options) WithMaxKeySize ¶ added in v1.2.4
func (*Options) WithMaxNodeSize ¶
func (*Options) WithMaxValueSize ¶ added in v1.2.4
func (*Options) WithNodesLogMaxOpenedFiles ¶ added in v1.2.3
func (*Options) WithReadOnly ¶
func (*Options) WithRenewSnapRootAfter ¶
func (*Options) WithSyncThld ¶ added in v1.2.3
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) ReadBetween ¶ added in v1.3.0
type ReaderSpec ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
func (*Snapshot) ExistKeyWith ¶ added in v1.2.0
func (*Snapshot) NewHistoryReader ¶ added in v0.9.1
func (s *Snapshot) NewHistoryReader(spec *HistoryReaderSpec) (*HistoryReader, error)
type TBtree ¶
type TBtree struct {
// contains filtered or unexported fields
}
TBTree implements a timed-btree
func OpenWith ¶
func OpenWith(path string, nLog, hLog, cLog appendable.Appendable, opts *Options) (*TBtree, error)
func (*TBtree) BulkInsert ¶
func (*TBtree) ExistKeyWith ¶ added in v1.0.0
func (*TBtree) GetOptions ¶ added in v0.9.1
func (*TBtree) IncreaseTs ¶ added in v1.2.3
func (*TBtree) SnapshotCount ¶ added in v1.0.5
SnapshotCount returns the number of stored snapshots Note: snapshotCount(compact(t)) = 1
func (*TBtree) SnapshotSince ¶ added in v0.9.0
Click to show internal directories.
Click to hide internal directories.