Documentation
¶
Overview ¶
* Copyright (c) 2023 * John's Page All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY [Name of Organization] “AS IS” AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL [Name of Organisation] BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE.
* Copyright (c) 2023 * John's Page All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY [Name of Organization] “AS IS” AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL [Name of Organisation] BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE.
* Copyright (c) 2023 * John's Page All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY [Name of Organization] “AS IS” AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL [Name of Organisation] BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE.
* Copyright (c) 2023 * John's Page All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY [Name of Organization] “AS IS” AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL [Name of Organisation] BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE.
* Copyright (c) 2023 * John's Page All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY [Name of Organization] “AS IS” AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL [Name of Organisation] BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE.
* Copyright (c) 2023 * John's Page All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY [Name of Organization] “AS IS” AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL [Name of Organisation] BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE.
* Copyright (c) 2023 * John's Page All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY [Name of Organization] “AS IS” AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL [Name of Organisation] BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE.
* Copyright (c) 2023 * John's Page All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY [Name of Organization] “AS IS” AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL [Name of Organisation] BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE.
* Copyright (c) 2023 * John's Page All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY [Name of Organization] “AS IS” AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL [Name of Organisation] BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE.
* Copyright (c) 2023 * John's Page All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * THIS SOFTWARE IS PROVIDED BY [Name of Organization] “AS IS” AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL [Name of Organisation] BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE.
Index ¶
- Constants
- func DeleteWAL(path string, id int)
- func SortTableRow(rows *[]*TableRow)
- func WriteSSTable(sorted []*TableRow, minBlockCount uint64, maxBlockSize uint64, path string, ...) error
- type AbstractTable
- type Bloomfilter
- type CompactionStrategy
- type Compactor
- func (i *Compactor) CalculateScore()
- func (i *Compactor) CreateTaskList() []*LSMLevel
- func (i *Compactor) RunCompactor()
- func (i *Compactor) RunLevelZeroCompaction()
- func (i *Compactor) SSTableLoader(tables []*SSTableReaderRef) []*TableRow
- func (i *Compactor) SplitAndSave(sorted []*TableRow, partitionSize int, writeLevel int) []*SSTableReferance
- func (i *Compactor) Start()
- type Comparator
- type Compression
- type CreateIteratorCallback
- type DB
- func (i *DB) Close()
- func (i *DB) Delete(key any)
- func (i *DB) FirstRow() *TableRow
- func (i *DB) Get(key any) *DataSlice
- func (i *DB) Head(key any) *DBIterator
- func (i *DB) LastRow() *TableRow
- func (i *DB) LockSnapshot() int
- func (i *DB) Put(key any, value any)
- func (i *DB) ReleaseSnapshot(snapshot int)
- func (i *DB) Sub(key any, endKey any) *DBIterator
- func (i *DB) Tail(key any) *DBIterator
- type DBIterator
- type DBOption
- func (i *DBOption) SetComparator(name string, comparator Comparator[*DataSlice])
- func (i *DBOption) SetCompression(compression Compression)
- func (i *DBOption) SetLSMOptions(options LSMOptions)
- func (i *DBOption) SetMaxInmemoryWriteBuffer(newSize int)
- func (i *DBOption) SetPath(newPath string)
- func (i *DBOption) SetShouldCreateIfNotExists()
- func (i *DBOption) SetShouldNotCreateIfNotExists()
- type DataSlice
- type EnhancedIterator
- type FilterCallback
- type FilterIterator
- type FirstNodeWhenCallback
- type IndexRow
- type Iterable
- type IterableInterface
- type IteratorBase
- type LSMLevel
- type LSMOptions
- func (i *LSMOptions) GetLevelFactor(levelFactor int) int
- func (i *LSMOptions) GetMaxBaseLevelSize(maxBaseLevelSize int) int
- func (i *LSMOptions) GetMaxLevelZeroFileCount(maxLevelZeroFileCount int) int
- func (i *LSMOptions) GetSSTableFileSize(sstableFileSize int) int
- func (i *LSMOptions) SetLevelFactor(levelFactor int)
- func (i *LSMOptions) SetMaxBaseLevelSize(maxBaseLevelSize int)
- func (i *LSMOptions) SetMaxLevelZeroFileCount(maxLevelZeroFileCount int)
- func (i *LSMOptions) SetSSTableFileSize(sstableFileSize int)
- type LZ4Compression
- type LeveledCompaction
- type Manifest
- func (m *Manifest) AddTable(table *SSTableReferance)
- func (m *Manifest) AddTables(tables []*SSTableReferance)
- func (m *Manifest) AddWalId(id int)
- func (m *Manifest) AddWalIds(ids []int)
- func (m *Manifest) Commit()
- func (m *Manifest) GetAllTables() []*SSTableReferance
- func (m *Manifest) GetAllWALIds() []int
- func (m *Manifest) GetDBid() string
- func (m *Manifest) GetLastSnapshot() int
- func (m *Manifest) GetNextSSTableID() int64
- func (m *Manifest) GetNextWALID() int64
- func (m *Manifest) GetVersion() int64
- func (i *Manifest) PackSSTableMetadata(writer io.Writer)
- func (m *Manifest) RemoveTable(table SSTableReferance)
- func (m *Manifest) RemoveTables(tables []*SSTableReferance)
- func (m *Manifest) RemoveWALId(id int)
- func (m *Manifest) RemoveWALIds(ids []int)
- func (m *Manifest) SetLastSnapshot(snapshot int64)
- func (m *Manifest) String() string
- type Memtable
- type NavigableList
- type NoCompression
- type SSTableIterator
- type SSTableManager
- func (i *SSTableManager) AddAllSSTables(refs []*SSTableReferance)
- func (i *SSTableManager) DeleteSSTablesByIds(ids []*SSTableReferance)
- func (i *SSTableManager) FilesInRangeInLayer(start *DataSlice, end *DataSlice, ln int) []*SSTableReader
- func (i *SSTableManager) GetFileCount() int
- func (i *SSTableManager) GetFilesFromLayer(ln int) []*SSTableReaderRef
- func (i *SSTableManager) LayerCount() int
- func (i *SSTableManager) PlanSSTableQueryStrategy(key *DataSlice, ln int, across int) []*SSTableReader
- func (i *SSTableManager) RemoveAllSSTable(refs []*SSTableReferance)
- func (i *SSTableManager) Updater(val []SSTableUpdate)
- type SSTableMetadata
- type SSTableReader
- func (i *SSTableReader) Ceiling(k TableRow) *TableRow
- func (i *SSTableReader) Close() error
- func (i *SSTableReader) EstimateExistance(key any) bool
- func (i *SSTableReader) First() **TableRow
- func (i *SSTableReader) Floor(k TableRow) *TableRow
- func (i *SSTableReader) Get(value *TableRow) Iterable[*TableRow]
- func (i *SSTableReader) GetBlock(idx int) (*SortedList[*TableRow], error)
- func (i *SSTableReader) GetBlocksForRange(a *DataSlice, b *DataSlice) []int
- func (i *SSTableReader) GetID() uint64
- func (i *SSTableReader) GetIterator() IteratorBase[*TableRow]
- func (i *SSTableReader) GetLevel() uint64
- func (i *SSTableReader) GetMetadata() SSTableMetadata
- func (i *SSTableReader) GetPath() string
- func (i *SSTableReader) Head(fromKey TableRow, inclusive bool) Iterable[*TableRow]
- func (i *SSTableReader) Higher(k TableRow) *TableRow
- func (i *SSTableReader) IsInRange(key any) bool
- func (i *SSTableReader) Last() **TableRow
- func (i *SSTableReader) Lower(k TableRow) *TableRow
- func (i *SSTableReader) Print()
- func (i *SSTableReader) Size() int
- func (i *SSTableReader) Sub(fromKey *TableRow, toKey *TableRow, fromInclusive bool, toInclusive bool) Iterable[*TableRow]
- func (i *SSTableReader) Tail(fromKey TableRow, inclusive bool) Iterable[*TableRow]
- type SSTableReaderRef
- type SSTableReferance
- type SSTableUpdate
- type SkipListIterator
- type SkipListMemtable
- func (i *SkipListMemtable) Delete(key any)
- func (i *SkipListMemtable) EstimateExistance(key any) bool
- func (i *SkipListMemtable) Get(key any) Iterable[*TableRow]
- func (i *SkipListMemtable) GetSize() int
- func (i *SkipListMemtable) IsInRange(key any) bool
- func (i *SkipListMemtable) Put(key any, value any)
- func (i *SkipListMemtable) ToList() []*TableRow
- type Skiplist
- func (v *Skiplist[V]) Add(value V)
- func (v *Skiplist[V]) Ceiling(k V) *V
- func (v *Skiplist[V]) First() *V
- func (v *Skiplist[V]) FirstNodeWhen(key *V, callback FirstNodeWhenCallback[V]) *skiplistNode[V]
- func (v *Skiplist[V]) Floor(k V) *V
- func (v *Skiplist[V]) Get(value V) Iterable[V]
- func (v *Skiplist[V]) GetIterator() IteratorBase[V]
- func (v *Skiplist[V]) Head(toKey V, inclusive bool) Iterable[V]
- func (v *Skiplist[V]) Higher(k V) *V
- func (v *Skiplist[V]) Last() *V
- func (v *Skiplist[V]) Lower(k V) *V
- func (v *Skiplist[V]) Sub(fromKey V, toKey V, fromInclusive bool, toInclusive bool) Iterable[V]
- func (v *Skiplist[V]) Tail(fromKey V, inclusive bool) Iterable[V]
- type SnappyCompression
- type SortedList
- func (v *SortedList[V]) Add(value V)
- func (v *SortedList[V]) AddAll(values []V)
- func (v *SortedList[V]) Ceiling(k V) *V
- func (v *SortedList[V]) Clear()
- func (v *SortedList[V]) First() *V
- func (v *SortedList[V]) Floor(k V) *V
- func (v *SortedList[V]) Get(value V) Iterable[V]
- func (v *SortedList[V]) GetIterator() IteratorBase[V]
- func (v *SortedList[V]) GetSize() int
- func (v *SortedList[V]) Head(toKey V, inclusive bool) Iterable[V]
- func (v *SortedList[V]) Higher(k V) *V
- func (v *SortedList[V]) Last() *V
- func (v *SortedList[V]) Lower(k V) *V
- func (v *SortedList[V]) Merge(other []V)
- func (v *SortedList[V]) Remove(value V) *V
- func (v *SortedList[V]) RemoveWhere(predicate func(V) bool) []V
- func (v *SortedList[V]) Sub(fromKey V, toKey V, fromInclusive bool, toInclusive bool) Iterable[V]
- func (v *SortedList[V]) Tail(fromKey V, inclusive bool) Iterable[V]
- func (v *SortedList[V]) ToList() []V
- type SortedListIterator
- type StopCallback
- type TableRow
- func Merge(a []*TableRow, b []*TableRow, comparator Comparator[*TableRow]) []*TableRow
- func MergeRows(rows []*TableRow, snapshot *SortedList[int]) []*TableRow
- func NewTableRow(key *DataSlice, value *DataSlice, timestamp uint64, snapshotId uint64, ...) *TableRow
- func NewTableRowFrom(reader io.Reader) (*TableRow, error)
- func NewTableRowFromKey(key any) *TableRow
- type TableRowSortBy
- type WALReader
- type WALReference
- type WALWriter
- type ZlibCompression
- type ZstdCompression
Constants ¶
const ( ADD = 0 REMOVE = 1 )
const ( PUT int8 = 0 DELETE int8 = 1 )
Variables ¶
This section is empty.
Functions ¶
func WriteSSTable ¶
Types ¶
type AbstractTable ¶
type AbstractTable interface { NavigableList[TableRow] // Checks if a key is in the tables range // minKey <= key <= maxKey IsInRange(key any) bool // checks if an item is in the table // usually uses memtable EstimateExistance(key any) bool // returns the size of the table Size() int }
All data store manager struct should implement these
type Bloomfilter ¶
type Bloomfilter struct {
// contains filtered or unexported fields
}
A Bloom filter is a space-efficient probabilistic data structure can as "possibly in set" or "definitely not in set" question efficiently
func NewBloomfilter ¶
func NewBloomfilter(estimatedLength int, hashCount int) *Bloomfilter
creates a new bloomfilter
func (Bloomfilter) Contains ¶
func (x Bloomfilter) Contains(value *DataSlice) bool
checks if a DataSlice in the filter
type CompactionStrategy ¶
type Compactor ¶
type Compactor struct {
// contains filtered or unexported fields
}
func NewCompactor ¶
func NewCompactor(options *DBOption, snapshotsHolds *SortedList[int], lsmUpdateStream *chan bool, sstableManager *SSTableManager, manifest *Manifest, comparator Comparator[*TableRow], wg *sync.WaitGroup, log *log.Logger) *Compactor
func (*Compactor) CalculateScore ¶
func (i *Compactor) CalculateScore()
func (*Compactor) CreateTaskList ¶
func (*Compactor) RunCompactor ¶
func (i *Compactor) RunCompactor()
func (*Compactor) RunLevelZeroCompaction ¶
func (i *Compactor) RunLevelZeroCompaction()
func (*Compactor) SSTableLoader ¶
func (i *Compactor) SSTableLoader(tables []*SSTableReaderRef) []*TableRow
func (*Compactor) SplitAndSave ¶
func (i *Compactor) SplitAndSave(sorted []*TableRow, partitionSize int, writeLevel int) []*SSTableReferance
type Comparator ¶
type Compression ¶
type CreateIteratorCallback ¶
type CreateIteratorCallback[V any] func() IteratorBase[V]
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) Head ¶
func (i *DB) Head(key any) *DBIterator
func (*DB) LockSnapshot ¶
func (*DB) ReleaseSnapshot ¶
func (*DB) Tail ¶
func (i *DB) Tail(key any) *DBIterator
type DBIterator ¶
type DBIterator struct {
// contains filtered or unexported fields
}
func NewDBIterator ¶
func NewDBIterator(db *DB, startKey *DataSlice, endKey *DataSlice) *DBIterator
func (*DBIterator) Close ¶
func (i *DBIterator) Close()
func (*DBIterator) GetCurrent ¶
func (i *DBIterator) GetCurrent() *TableRow
func (*DBIterator) MoveNext ¶
func (i *DBIterator) MoveNext() bool
type DBOption ¶
type DBOption struct {
// contains filtered or unexported fields
}
func NewDBOption ¶
func NewDBOption() *DBOption
func (*DBOption) SetComparator ¶
func (i *DBOption) SetComparator(name string, comparator Comparator[*DataSlice])
func (*DBOption) SetCompression ¶
func (i *DBOption) SetCompression(compression Compression)
func (*DBOption) SetLSMOptions ¶
func (i *DBOption) SetLSMOptions(options LSMOptions)
func (*DBOption) SetMaxInmemoryWriteBuffer ¶
func (*DBOption) SetShouldCreateIfNotExists ¶
func (i *DBOption) SetShouldCreateIfNotExists()
func (*DBOption) SetShouldNotCreateIfNotExists ¶
func (i *DBOption) SetShouldNotCreateIfNotExists()
type DataSlice ¶
type DataSlice struct {
// contains filtered or unexported fields
}
Container that holds the data
type EnhancedIterator ¶
type EnhancedIterator[V any] struct { // contains filtered or unexported fields }
func (EnhancedIterator[V]) ToList ¶
func (v EnhancedIterator[V]) ToList() []V
func (EnhancedIterator[V]) Where ¶
func (v EnhancedIterator[V]) Where(filter FilterCallback[V]) Iterable[V]
type FilterCallback ¶
type FilterIterator ¶
type FilterIterator[V any] struct { // contains filtered or unexported fields }
func (*FilterIterator[V]) GetCurrent ¶
func (i *FilterIterator[V]) GetCurrent() V
func (*FilterIterator[V]) MoveNext ¶
func (i *FilterIterator[V]) MoveNext() bool
type FirstNodeWhenCallback ¶
type Iterable ¶
type Iterable[V any] struct { EnhancedIterator[V] // contains filtered or unexported fields }
func (Iterable[V]) GetIterator ¶
func (i Iterable[V]) GetIterator() IteratorBase[V]
type IterableInterface ¶
type IterableInterface[V any] interface { GetIterator() IteratorBase[V] }
type IteratorBase ¶
type LSMOptions ¶
type LSMOptions struct {
// contains filtered or unexported fields
}
func NewLSMOptions ¶
func NewLSMOptions(maxBaseLevelSize int, levelFactor int, maxLevelZeroFileCount int, sstableFileSize int) LSMOptions
func (*LSMOptions) GetLevelFactor ¶
func (i *LSMOptions) GetLevelFactor(levelFactor int) int
func (*LSMOptions) GetMaxBaseLevelSize ¶
func (i *LSMOptions) GetMaxBaseLevelSize(maxBaseLevelSize int) int
func (*LSMOptions) GetMaxLevelZeroFileCount ¶
func (i *LSMOptions) GetMaxLevelZeroFileCount(maxLevelZeroFileCount int) int
func (*LSMOptions) GetSSTableFileSize ¶
func (i *LSMOptions) GetSSTableFileSize(sstableFileSize int) int
func (*LSMOptions) SetLevelFactor ¶
func (i *LSMOptions) SetLevelFactor(levelFactor int)
func (*LSMOptions) SetMaxBaseLevelSize ¶
func (i *LSMOptions) SetMaxBaseLevelSize(maxBaseLevelSize int)
func (*LSMOptions) SetMaxLevelZeroFileCount ¶
func (i *LSMOptions) SetMaxLevelZeroFileCount(maxLevelZeroFileCount int)
func (*LSMOptions) SetSSTableFileSize ¶
func (i *LSMOptions) SetSSTableFileSize(sstableFileSize int)
type LZ4Compression ¶
type LZ4Compression struct{}
func NewLZ4Compression ¶
func NewLZ4Compression() *LZ4Compression
func (*LZ4Compression) Encode ¶
func (c *LZ4Compression) Encode(data []byte) []byte
type LeveledCompaction ¶
type LeveledCompaction struct {
// contains filtered or unexported fields
}
func (*LeveledCompaction) CalculateDelta ¶
func (i *LeveledCompaction) CalculateDelta(lsm []*LSMLevel, level int) int
func (*LeveledCompaction) CalculateLevelTargetSize ¶
func (i *LeveledCompaction) CalculateLevelTargetSize(level int) int
func (*LeveledCompaction) CalculateScore ¶
func (i *LeveledCompaction) CalculateScore(lsm []*LSMLevel, level int) float64
func (*LeveledCompaction) PartitionSize ¶
func (i *LeveledCompaction) PartitionSize(lsm []*LSMLevel, level int) int
type Manifest ¶
type Manifest struct {
// contains filtered or unexported fields
}
func OpenManifest ¶
func (*Manifest) AddTable ¶
func (m *Manifest) AddTable(table *SSTableReferance)
func (*Manifest) AddTables ¶
func (m *Manifest) AddTables(tables []*SSTableReferance)
func (*Manifest) GetAllTables ¶
func (m *Manifest) GetAllTables() []*SSTableReferance
func (*Manifest) GetAllWALIds ¶
func (*Manifest) GetLastSnapshot ¶
func (*Manifest) GetNextSSTableID ¶
func (*Manifest) GetNextWALID ¶
func (*Manifest) PackSSTableMetadata ¶
func (*Manifest) RemoveTable ¶
func (m *Manifest) RemoveTable(table SSTableReferance)
func (*Manifest) RemoveTables ¶
func (m *Manifest) RemoveTables(tables []*SSTableReferance)
func (*Manifest) RemoveWALId ¶
func (*Manifest) RemoveWALIds ¶
func (*Manifest) SetLastSnapshot ¶
type Memtable ¶
type Memtable interface { AbstractTable // Deletes an item from the table Delete(key any) // updates/adds something to the table Put(key any, value any) }
In memory memtable/buffer
type NavigableList ¶
type NavigableList[V any] interface { ToList() []V First() *V Last() *V // than or equal to the given key, or null if there is no such key. Ceiling(k V) *V // strictly greater than the given key, or null if there is // no such key. Higher(k V) *V // than or equal to the given key, or null if there is no such key. Floor(k V) *V // strictly less than the given key, or null if there is no such // key. Lower(k V) *V // strictly less than toKey. Tail(fromKey V, inclusive bool) Iterable[V] // greater than or equal to fromKey. Head(toKey V, inclusive bool) Iterable[V] // from fromKey, inclusive, to toKey, exclusive. Sub(fromKey V, toKey V, fromInclusive bool, toInclusive bool) Iterable[V] Get(value V) Iterable[V] GetIterator() IteratorBase[V] }
Sorted list/map that can be navigated easily
type NoCompression ¶
type NoCompression struct{}
func NewNoCompression ¶
func NewNoCompression() *NoCompression
func (*NoCompression) Encode ¶
func (c *NoCompression) Encode(data []byte) []byte
type SSTableIterator ¶
type SSTableIterator struct {
// contains filtered or unexported fields
}
Iterator for a sstable
func (*SSTableIterator) GetCurrent ¶
func (i *SSTableIterator) GetCurrent() *TableRow
func (*SSTableIterator) MoveNext ¶
func (i *SSTableIterator) MoveNext() bool
type SSTableManager ¶
type SSTableManager struct {
// contains filtered or unexported fields
}
func NewSSTableManager ¶
func NewSSTableManager(options *DBOption, snapshotsHolds *SortedList[int], manifest *Manifest, rowComparator Comparator[*TableRow], wg *sync.WaitGroup, log *log.Logger) *SSTableManager
func (*SSTableManager) AddAllSSTables ¶
func (i *SSTableManager) AddAllSSTables(refs []*SSTableReferance)
func (*SSTableManager) DeleteSSTablesByIds ¶
func (i *SSTableManager) DeleteSSTablesByIds(ids []*SSTableReferance)
func (*SSTableManager) FilesInRangeInLayer ¶
func (i *SSTableManager) FilesInRangeInLayer(start *DataSlice, end *DataSlice, ln int) []*SSTableReader
func (*SSTableManager) GetFileCount ¶
func (i *SSTableManager) GetFileCount() int
func (*SSTableManager) GetFilesFromLayer ¶
func (i *SSTableManager) GetFilesFromLayer(ln int) []*SSTableReaderRef
func (*SSTableManager) LayerCount ¶
func (i *SSTableManager) LayerCount() int
func (*SSTableManager) PlanSSTableQueryStrategy ¶
func (i *SSTableManager) PlanSSTableQueryStrategy(key *DataSlice, ln int, across int) []*SSTableReader
func (*SSTableManager) RemoveAllSSTable ¶
func (i *SSTableManager) RemoveAllSSTable(refs []*SSTableReferance)
func (*SSTableManager) Updater ¶
func (i *SSTableManager) Updater(val []SSTableUpdate)
type SSTableMetadata ¶
type SSTableMetadata struct {
// contains filtered or unexported fields
}
func (SSTableMetadata) PackSSTableMetadata ¶
func (i SSTableMetadata) PackSSTableMetadata(writer io.Writer)
type SSTableReader ¶
type SSTableReader struct { EnhancedIterator[*TableRow] // contains filtered or unexported fields }
func NewSSTableReader ¶
func NewSSTableReader(path string, level uint64, id uint64, compression Compression, comparator Comparator[*DataSlice]) (SSTableReader, error)
func (*SSTableReader) Ceiling ¶
func (i *SSTableReader) Ceiling(k TableRow) *TableRow
Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key.
func (*SSTableReader) EstimateExistance ¶
func (i *SSTableReader) EstimateExistance(key any) bool
func (*SSTableReader) Floor ¶
func (i *SSTableReader) Floor(k TableRow) *TableRow
Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.
func (*SSTableReader) Get ¶
func (i *SSTableReader) Get(value *TableRow) Iterable[*TableRow]
Returns all the entry matching the value
func (*SSTableReader) GetBlock ¶
func (i *SSTableReader) GetBlock(idx int) (*SortedList[*TableRow], error)
func (*SSTableReader) GetBlocksForRange ¶
func (i *SSTableReader) GetBlocksForRange(a *DataSlice, b *DataSlice) []int
func (*SSTableReader) GetID ¶
func (i *SSTableReader) GetID() uint64
func (*SSTableReader) GetIterator ¶
func (i *SSTableReader) GetIterator() IteratorBase[*TableRow]
iterates through all the items
func (*SSTableReader) GetLevel ¶
func (i *SSTableReader) GetLevel() uint64
func (*SSTableReader) GetMetadata ¶
func (i *SSTableReader) GetMetadata() SSTableMetadata
func (*SSTableReader) GetPath ¶
func (i *SSTableReader) GetPath() string
func (*SSTableReader) Head ¶
func (i *SSTableReader) Head(fromKey TableRow, inclusive bool) Iterable[*TableRow]
Returns a view of the portion of this map whose keys are strictly less than fromKey. O(log n)
func (*SSTableReader) Higher ¶
func (i *SSTableReader) Higher(k TableRow) *TableRow
Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.
func (*SSTableReader) IsInRange ¶
func (i *SSTableReader) IsInRange(key any) bool
Checks if a key is in the tables range minKey <= key <= maxKey
func (*SSTableReader) Lower ¶
func (i *SSTableReader) Lower(k TableRow) *TableRow
Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key.
type SSTableReaderRef ¶
type SSTableReaderRef struct {
// contains filtered or unexported fields
}
type SSTableReferance ¶
type SSTableReferance struct {
// contains filtered or unexported fields
}
func NewSSTableRef ¶
func NewSSTableRef(level int, id int) *SSTableReferance
func (*SSTableReferance) GetId ¶
func (i *SSTableReferance) GetId() int
func (*SSTableReferance) GetLevel ¶
func (i *SSTableReferance) GetLevel() int
type SSTableUpdate ¶
type SSTableUpdate struct {
// contains filtered or unexported fields
}
type SkipListIterator ¶
type SkipListIterator[V any] struct { // contains filtered or unexported fields }
func (*SkipListIterator[V]) GetCurrent ¶
func (i *SkipListIterator[V]) GetCurrent() V
func (*SkipListIterator[V]) MoveNext ¶
func (i *SkipListIterator[V]) MoveNext() bool
type SkipListMemtable ¶
type SkipListMemtable struct {
// contains filtered or unexported fields
}
func NewSkipListMemtable ¶
func NewSkipListMemtable(path string, id int64, comparator Comparator[*DataSlice]) *SkipListMemtable
func (*SkipListMemtable) Delete ¶
func (i *SkipListMemtable) Delete(key any)
func (*SkipListMemtable) EstimateExistance ¶
func (i *SkipListMemtable) EstimateExistance(key any) bool
func (*SkipListMemtable) GetSize ¶
func (i *SkipListMemtable) GetSize() int
func (*SkipListMemtable) IsInRange ¶
func (i *SkipListMemtable) IsInRange(key any) bool
func (*SkipListMemtable) Put ¶
func (i *SkipListMemtable) Put(key any, value any)
func (*SkipListMemtable) ToList ¶
func (i *SkipListMemtable) ToList() []*TableRow
type Skiplist ¶
type Skiplist[V any] struct { EnhancedIterator[V] // contains filtered or unexported fields }
func CreateSkiplist ¶
func CreateSkiplist[V any](estimateSize int, comparator Comparator[V]) *Skiplist[V]
func (*Skiplist[V]) Ceiling ¶
func (v *Skiplist[V]) Ceiling(k V) *V
Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key. O(log n)
func (*Skiplist[V]) FirstNodeWhen ¶
func (v *Skiplist[V]) FirstNodeWhen(key *V, callback FirstNodeWhenCallback[V]) *skiplistNode[V]
func (*Skiplist[V]) Floor ¶
func (v *Skiplist[V]) Floor(k V) *V
Returns a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key. O(log n)
func (*Skiplist[V]) GetIterator ¶
func (v *Skiplist[V]) GetIterator() IteratorBase[V]
func (*Skiplist[V]) Head ¶
Returns a view of the portion of this map whose keys are greater than or equal to fromKey. O(log n)
func (*Skiplist[V]) Higher ¶
func (v *Skiplist[V]) Higher(k V) *V
Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key. O(log n)
func (*Skiplist[V]) Lower ¶
func (v *Skiplist[V]) Lower(k V) *V
Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key. O(log n)
type SnappyCompression ¶
type SnappyCompression struct{}
func NewSnappyCompression ¶
func NewSnappyCompression() *SnappyCompression
func (*SnappyCompression) Encode ¶
func (c *SnappyCompression) Encode(data []byte) []byte
type SortedList ¶
type SortedList[V any] struct { EnhancedIterator[V] // contains filtered or unexported fields }
func NewSortedList ¶
func NewSortedList[V any](list []V, comparator Comparator[V]) *SortedList[V]
func (*SortedList[V]) Add ¶
func (v *SortedList[V]) Add(value V)
Add adds a value to the list efficiently
func (*SortedList[V]) AddAll ¶
func (v *SortedList[V]) AddAll(values []V)
Add all values to the list efficiently
func (*SortedList[V]) Ceiling ¶
func (v *SortedList[V]) Ceiling(k V) *V
Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key.
func (*SortedList[V]) Clear ¶
func (v *SortedList[V]) Clear()
func (*SortedList[V]) Floor ¶
func (v *SortedList[V]) Floor(k V) *V
Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key. O(log n)
func (*SortedList[V]) Get ¶
func (v *SortedList[V]) Get(value V) Iterable[V]
Returns all the entry matching the value. O(log n)
func (*SortedList[V]) GetIterator ¶
func (v *SortedList[V]) GetIterator() IteratorBase[V]
returns sortedlist iterator
func (*SortedList[V]) GetSize ¶
func (v *SortedList[V]) GetSize() int
func (*SortedList[V]) Head ¶
func (v *SortedList[V]) Head(toKey V, inclusive bool) Iterable[V]
Returns a view of the portion of this map whose keys are greater than or equal to toKey.
func (*SortedList[V]) Higher ¶
func (v *SortedList[V]) Higher(k V) *V
Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.
func (*SortedList[V]) Lower ¶
func (v *SortedList[V]) Lower(k V) *V
Returns a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key.
func (*SortedList[V]) Merge ¶
func (v *SortedList[V]) Merge(other []V)
func (*SortedList[V]) Remove ¶
func (v *SortedList[V]) Remove(value V) *V
Remove removes a value from the list efficiently
func (*SortedList[V]) RemoveWhere ¶
func (v *SortedList[V]) RemoveWhere(predicate func(V) bool) []V
Remove removes a value from the list efficiently
func (*SortedList[V]) Sub ¶
func (v *SortedList[V]) Sub(fromKey V, toKey V, fromInclusive bool, toInclusive bool) Iterable[V]
Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.
func (*SortedList[V]) Tail ¶
func (v *SortedList[V]) Tail(fromKey V, inclusive bool) Iterable[V]
Returns a view of the portion of this map whose keys are strictly less than toKey.
func (*SortedList[V]) ToList ¶
func (v *SortedList[V]) ToList() []V
type SortedListIterator ¶
type SortedListIterator[V any] struct { // contains filtered or unexported fields }
Iterator for a sortedlist
func (*SortedListIterator[V]) GetCurrent ¶
func (i *SortedListIterator[V]) GetCurrent() V
get current for SortedListIterator
func (*SortedListIterator[V]) MoveNext ¶
func (i *SortedListIterator[V]) MoveNext() bool
move next for SortedListIterator
type StopCallback ¶
type TableRow ¶
type TableRow struct {
// contains filtered or unexported fields
}
This represents a row in the table
func NewTableRow ¶
func NewTableRow(key *DataSlice, value *DataSlice, timestamp uint64, snapshotId uint64, rowType int8) *TableRow
creates a new TableRow struct
func NewTableRowFrom ¶
parses a row from an io writer
func NewTableRowFromKey ¶
func (*TableRow) GetRowType ¶
type TableRowSortBy ¶
type TableRowSortBy struct {
// contains filtered or unexported fields
}
struct that helps in sorting TableRows implements Sort Interface
func NewTableRowSortBy ¶
func NewTableRowSortBy(list []*TableRow, comparator Comparator[*DataSlice]) TableRowSortBy
func (*TableRowSortBy) Len ¶
func (a *TableRowSortBy) Len() int
func (*TableRowSortBy) Less ¶
func (a *TableRowSortBy) Less(i, j int) bool
func (*TableRowSortBy) Swap ¶
func (a *TableRowSortBy) Swap(i, j int)
type WALReader ¶
type WALReader struct {
// contains filtered or unexported fields
}
Reads a Write Ahead Log from disk
func NewWALReader ¶
Creates a WALReader struct to read
func (WALReader) ReadAllRows ¶
read all entries in the log as an array of TableRow
type WALReference ¶
type WALReference struct {
// contains filtered or unexported fields
}
func (*WALReference) GetId ¶
func (i *WALReference) GetId() int
type WALWriter ¶
type WALWriter struct {
// contains filtered or unexported fields
}
Write Ahead Log is used to store the mutations to memtable
func NewWALWriter ¶
Creates a new log at path with [id]
func (WALWriter) AddTableRow ¶
Add an entry to the log
type ZlibCompression ¶
type ZlibCompression struct{}
func NewZlibCompression ¶
func NewZlibCompression() *ZlibCompression
func (*ZlibCompression) Encode ¶
func (c *ZlibCompression) Encode(data []byte) []byte
type ZstdCompression ¶
type ZstdCompression struct{}
func NewZstdCompression ¶
func NewZstdCompression() *ZstdCompression
func (*ZstdCompression) Encode ¶
func (c *ZstdCompression) Encode(data []byte) []byte