Documentation
¶
Overview ¶
Package db implements ...
Index ¶
- Variables
- func DeliverHintsToEndpoint(endpoint *network.EndPoint)
- func DoRowMutation(args *RowMutationArgs, reply *RowMutationReply) error
- func DoRowRead(args *RowReadArgs, reply *RowReadReply) error
- type AColumnFactory
- type AQueryFilter
- type AReadCommand
- type AbstractColumnIterator
- type BinaryMemtable
- type BlockMetadata
- type ByFileName
- type ByKey
- type ByName
- type ByPart
- type ByTime
- type CollatedIterator
- type Column
- type ColumnFactory
- type ColumnFamily
- type ColumnFamilySerializer
- type ColumnFamilyStore
- type ColumnGroupReader
- type ColumnIndexer
- type ColumnIterator
- type ColumnSerializer
- type CommitLog
- type CommitLogContext
- type CommitLogHeader
- type FPQ
- type FileSSTableMap
- type FileStruct
- type HintedHandOffManager
- type IColumn
- type IColumnSerializer
- type IdentityQueryFilter
- type IndexInfo
- type IteratingRow
- type KeyPositionInfo
- type Manager
- type Memtable
- type MemtableManager
- type NamesQueryFilter
- type PrimaryKey
- type QueryFilter
- type QueryPath
- type ReadCommand
- type RecoveryManager
- type Row
- type RowMutation
- func (rm *RowMutation) Add(columnFamilyColumn, value string, timestamp int64)
- func (rm *RowMutation) AddCF(columnFamily *ColumnFamily)
- func (rm *RowMutation) AddHints(key, host string)
- func (rm *RowMutation) AddQ(path *QueryPath, value []byte, timestamp int64)
- func (rm *RowMutation) Apply(row *Row)
- func (rm *RowMutation) ApplyE()
- func (rm *RowMutation) Delete(path *QueryPath, timestamp int64)
- type RowMutationArgs
- type RowMutationReply
- type RowReadArgs
- type RowReadReply
- type SSTable
- type SSTableNamesIterator
- type SSTableReader
- type SSTableSliceIterator
- type SSTableWriter
- type SimpleColumnIterator
- type SliceByNamesReadCommand
- type SliceFromReadCommand
- type SliceQueryFilter
- type StorageMetadata
- type SuperColumn
- type SuperColumnFactory
- type SuperColumnSerializer
- type Table
- type TableMetadata
- type TouchKeyCache
Constants ¶
This section is empty.
Variables ¶
var ( HINT = "HINT" DoREPAIR = "READ-REPAIR" )
HINT string
var ( // SSTableTmpFile is the tmp file name for sstable SSTableTmpFile = "tmp" SSTVersion = int64(0) SSTIndexMetadataMap map[string][]*KeyPositionInfo // every 128th key is an index SSTIndexInterval = 128 // key associated with block index written to disk SSTBlockIndexKey = "BLOCK-INDEX" // position in SSTable after the first Block Index SSTPositionAfterFirstBlockIndex = int64(0) // this map has the SSTable as key and a BloomFilter // as value. This BloomFilter will tell us if a key/ // column pair is in the SSTable. If not, we can avoid // scanning it. SSTbfs = make(map[string]*utils.BloomFilter) // maintains a touched set of keys SSTTouchCache = NewTouchKeyCache(config.TouchKeyCacheSize) SSTBlkIdxKey = "BLOCK-INDEX" )
*
var CFSerializer = NewCFSerializer()
CFSerializer ...
var CIndexer = &ColumnIndexer{}
CIndexer ...
var CSerializer = NewColumnSerializer()
CSerializer ...
var SCSerializer = NewSuperColumnSerializer()
SCSerializer ...
Functions ¶
func DeliverHintsToEndpoint ¶
DeliverHintsToEndpoint ...
func DoRowMutation ¶
func DoRowMutation(args *RowMutationArgs, reply *RowMutationReply) error
DoRowMutation ...
Types ¶
type AColumnFactory ¶
type AColumnFactory interface {
// contains filtered or unexported methods
}
AColumnFactory -> Abstract Column Factory ColumnFactory and SuperColumnFactory are two specific impl.
type AQueryFilter ¶
type AQueryFilter struct {
// contains filtered or unexported fields
}
AQueryFilter ...
func NewAQueryFilter ¶
func NewAQueryFilter(key string, path *QueryPath) *AQueryFilter
NewAQueryFilter ...
type AReadCommand ¶
AReadCommand ...
func NewAReadCommand ¶
func NewAReadCommand(table, key string, queryPath QueryPath, cmdType byte) *AReadCommand
NewAReadCommand ...
type AbstractColumnIterator ¶
type AbstractColumnIterator struct {
// contains filtered or unexported fields
}
AbstractColumnIterator ...
func NewAColumnIterator ¶
func NewAColumnIterator(curIndex int, columnFamily *ColumnFamily, columns []IColumn) *AbstractColumnIterator
NewAColumnIterator ...
type BinaryMemtable ¶
type BinaryMemtable struct {
// contains filtered or unexported fields
}
BinaryMemtable is the binary version of memtable
func NewBinaryMemtable ¶
func NewBinaryMemtable(table, cfName string) *BinaryMemtable
NewBinaryMemtable initializes a BinaryMemtable
type BlockMetadata ¶
type BlockMetadata struct {
// contains filtered or unexported fields
}
BlockMetadata ...
func NewBlockMetadata ¶
func NewBlockMetadata(position, size int64) *BlockMetadata
NewBlockMetadata ...
type CollatedIterator ¶
type CollatedIterator struct {
// contains filtered or unexported fields
}
CollatedIterator ...
func NewCollatedIterator ¶
func NewCollatedIterator(iterators []ColumnIterator) *CollatedIterator
NewCollatedIterator ...
type Column ¶
type Column struct { Name string Value string Timestamp int64 // contains filtered or unexported fields }
Column stores name and value etc.
type ColumnFamily ¶
type ColumnFamily struct { ColumnFamilyName string ColumnType string Factory AColumnFactory Columns map[string]IColumn // contains filtered or unexported fields }
ColumnFamily definition
func NewColumnFamily ¶
func NewColumnFamily(columnFamilyName, columnType string) *ColumnFamily
NewColumnFamily create a new column family, set columnfactory according to its type
func (*ColumnFamily) CreateColumn ¶
func (cf *ColumnFamily) CreateColumn(columnName, value string, timestamp int64)
CreateColumn setup a new column in columnFamily
func (*ColumnFamily) GetColumn ¶
func (cf *ColumnFamily) GetColumn(name string) IColumn
GetColumn ...
func (*ColumnFamily) GetSortedColumns ¶
func (cf *ColumnFamily) GetSortedColumns() []IColumn
GetSortedColumns ...
type ColumnFamilySerializer ¶
type ColumnFamilySerializer struct {
// contains filtered or unexported fields
}
ColumnFamilySerializer ...
type ColumnFamilyStore ¶
type ColumnFamilyStore struct {
// contains filtered or unexported fields
}
ColumnFamilyStore provides storage specification of column family
func NewColumnFamilyStore ¶
func NewColumnFamilyStore(table, columnFamily string) *ColumnFamilyStore
NewColumnFamilyStore initializes a new ColumnFamilyStore
type ColumnGroupReader ¶
type ColumnGroupReader struct {
// contains filtered or unexported fields
}
ColumnGroupReader finds the block for a starting column and returns blocks before/after it for each next call. This function assumes that the CF is sorted by name and exploits the name index
func NewColumnGroupReader ¶
func NewColumnGroupReader(ssTable *SSTableReader, key string, position int64, startColumn []byte, reversed bool) *ColumnGroupReader
NewColumnGroupReader ...
type ColumnIterator ¶
type ColumnIterator interface {
// contains filtered or unexported methods
}
ColumnIterator ...
type ColumnSerializer ¶
type ColumnSerializer struct {
// contains filtered or unexported fields
}
ColumnSerializer ...
type CommitLog ¶
type CommitLog struct {
// contains filtered or unexported fields
}
CommitLog tracks every write operation into the system. The aim of the commit log is to be able to successfully recover data that was not stored to disk via the memtable. Every commit log maintains a header represented by the abstraction CommitLogHeader. The header contains a bit array and an array of int64 and both the arrays are of size: # column families. Whenever a ColumnFamily is written to, for the first time its bit flag is set to one in the CommitLogHeader. When it is flushed to disk by the Memtable its corresponding bit in the header is set to zero. This helps track which CommitLog can be thrown away as a result of Memtable flushes. However if a ColumnFamily is flushed and again written to disk then its entry in the array of int64 is updated with the offset in the CommitLog file where it was written. This helps speed up recovery since we can seek to these offsets and start processing the commit log. Every Commit Log is rolled over everytime it reaches its threshold in size. Over time there could be a number of commit logs that would be generated. However whenever we flush a column family disk and update its bit flag we take this bit array and bitwise & it with the headers of the other commit logs that are older.
func NewCommitLog ¶
NewCommitLog creates a new commit log
func NewCommitLogE ¶
NewCommitLogE creates a new commit log
type CommitLogContext ¶
type CommitLogContext struct {
// contains filtered or unexported fields
}
CommitLogContext represents the context of commit log
func NewCommitLogContext ¶
func NewCommitLogContext(file string, position int64) *CommitLogContext
NewCommitLogContext creates a new commitLogContext
type CommitLogHeader ¶
type CommitLogHeader struct {
// contains filtered or unexported fields
}
CommitLogHeader represents the header of commit log
func NewCommitLogHeader ¶
func NewCommitLogHeader(size int) *CommitLogHeader
NewCommitLogHeader creates a new commit log header size is the number of column families
func NewCommitLogHeaderC ¶
func NewCommitLogHeaderC(clHeader *CommitLogHeader) *CommitLogHeader
NewCommitLogHeaderC used in copy
func NewCommitLogHeaderD ¶
func NewCommitLogHeaderD(dirty *bitset.BitSet, lastFlushedAt []int) *CommitLogHeader
NewCommitLogHeaderD used in deserializing
type FileSSTableMap ¶
type FileSSTableMap struct {
// contains filtered or unexported fields
}
FileSSTableMap ...
type FileStruct ¶
type FileStruct struct {
// contains filtered or unexported fields
}
FileStruct ...
type HintedHandOffManager ¶
type HintedHandOffManager struct{}
HintedHandOffManager ...
var (
HHOMInstance *HintedHandOffManager
)
HHOMInstance ...
func GetHintedHandOffManagerInstance ¶
func GetHintedHandOffManagerInstance() *HintedHandOffManager
GetHintedHandOffManagerInstance ...
func (*HintedHandOffManager) DeliverHints ¶
func (h *HintedHandOffManager) DeliverHints(to *network.EndPoint)
DeliverHints ...
type IColumn ¶
type IColumn interface { GetName() string GetTimestamp() int64 GetSubColumns() map[string]IColumn IsMarkedForDelete() bool GetValue() []byte // contains filtered or unexported methods }
IColumn provide interface for Column and SuperColumn
type IColumnSerializer ¶
type IColumnSerializer interface {
// contains filtered or unexported methods
}
IColumnSerializer ...
type IdentityQueryFilter ¶
type IdentityQueryFilter struct { *SliceQueryFilter // contains filtered or unexported fields }
IdentityQueryFilter ...
type IteratingRow ¶
type IteratingRow struct {
// contains filtered or unexported fields
}
IteratingRow ...
func NewIteratingRow ¶
func NewIteratingRow(file *os.File, sstable *SSTableReader) *IteratingRow
NewIteratingRow ...
type KeyPositionInfo ¶
type KeyPositionInfo struct {
// contains filtered or unexported fields
}
KeyPositionInfo contains index key and its corresponding position in the data file. Binary search is performed on a list of these objects to lookup keys within the SSTable data file.
func NewKeyPositionInfo ¶
func NewKeyPositionInfo(key string, position int64) *KeyPositionInfo
NewKeyPositionInfo ...
type Manager ¶
type Manager struct { }
Manager manages database
func GetManagerInstance ¶
func GetManagerInstance() *Manager
GetManagerInstance return an instance of DBManager
func (*Manager) Start ¶
func (d *Manager) Start() *StorageMetadata
Start reads the system table and retrives the metadata associated with this storage instance. The metadata is stored in a Column Family called LocationInfo which has two columns: "Token" and "Generation". This is the token that gets gossiped around and the generation info is used for FD. We also store whether we're in bootstrap mode in a third column.
type Memtable ¶
type Memtable struct {
// contains filtered or unexported fields
}
Memtable specifies memtable
func NewMemtable ¶
NewMemtable initializes a new memtable
type MemtableManager ¶
type MemtableManager struct {
// contains filtered or unexported fields
}
MemtableManager coordinates memtables to be flushed into disk
func GetMemtableManager ¶
func GetMemtableManager() *MemtableManager
GetMemtableManager will retrieve memtableManagerInstance or create a new one if not exist
func NewMemtableManager ¶
func NewMemtableManager() *MemtableManager
NewMemtableManager creates a new MemtableManager
type NamesQueryFilter ¶
type NamesQueryFilter struct {
// contains filtered or unexported fields
}
NamesQueryFilter ...
type PrimaryKey ¶
type PrimaryKey struct {
// contains filtered or unexported fields
}
PrimaryKey ...
type QueryFilter ¶
type QueryFilter interface {
// contains filtered or unexported methods
}
QueryFilter ...
func NewIdentityQueryFilter ¶
func NewIdentityQueryFilter(key string, path *QueryPath) QueryFilter
NewIdentityQueryFilter ...
func NewNamesQueryFilter ¶
func NewNamesQueryFilter(key string, columnParent *QueryPath, column []byte) QueryFilter
NewNamesQueryFilter ...
func NewNamesQueryFilterS ¶
func NewNamesQueryFilterS(key string, columnParent *QueryPath, columns [][]byte) QueryFilter
NewNamesQueryFilterS ...
type ReadCommand ¶
type ReadCommand interface { GetKey() string GetQPath() QueryPath GetCFName() string GetTable() string GetRow(table *Table) *Row }
ReadCommand ...
type RecoveryManager ¶
type RecoveryManager struct { }
RecoveryManager manages recovery
func GetRecoveryManager ¶
func GetRecoveryManager() *RecoveryManager
GetRecoveryManager fetch existing instance or create a new one.
func NewRecoveryManager ¶
func NewRecoveryManager() *RecoveryManager
NewRecoveryManager creates a new instance
type Row ¶
type Row struct { Table string Key string ColumnFamilies map[string]*ColumnFamily Size int32 }
Row for key and cf
type RowMutation ¶
type RowMutation struct { TableName string RowKey string Modification map[string]*ColumnFamily }
RowMutation definition
func NewRowMutation ¶
func NewRowMutation(tableName, rowKey string) RowMutation
NewRowMutation creates a new row mutation
func NewRowMutationR ¶
func NewRowMutationR(tableName string, row *Row) *RowMutation
NewRowMutationR init it with given row
func (*RowMutation) Add ¶
func (rm *RowMutation) Add(columnFamilyColumn, value string, timestamp int64)
Add store columnFamilyName and columnName inside rowMutation
func (*RowMutation) AddCF ¶
func (rm *RowMutation) AddCF(columnFamily *ColumnFamily)
AddCF adds column family to modification
func (*RowMutation) AddQ ¶
func (rm *RowMutation) AddQ(path *QueryPath, value []byte, timestamp int64)
AddQ ...
func (*RowMutation) Apply ¶
func (rm *RowMutation) Apply(row *Row)
Apply is equivalent to calling commit. This will applies the changes to the table that is obtained by calling Table.open()
func (*RowMutation) Delete ¶
func (rm *RowMutation) Delete(path *QueryPath, timestamp int64)
Delete ...
type RowMutationArgs ¶
type RowMutationArgs struct { HeaderKey string HeaderValue network.EndPoint From network.EndPoint RM RowMutation }
RowMutationArgs for rm arguments
type RowMutationReply ¶
RowMutationReply for rm reply structure
type RowReadArgs ¶
type RowReadArgs struct { HeaderKey string HeaderValue network.EndPoint From network.EndPoint RCommand ReadCommand }
RowReadArgs ...
type SSTable ¶
type SSTable struct {
// contains filtered or unexported fields
}
SSTable is the struct for SSTable
func NewSSTableP ¶
NewSSTableP is used for DB writes into the SSTable Use this version to write to the SSTable
type SSTableNamesIterator ¶
type SSTableNamesIterator struct {
// contains filtered or unexported fields
}
SSTableNamesIterator ...
func NewSSTableNamesIterator ¶
func NewSSTableNamesIterator(sstable *SSTableReader, key string, columns [][]byte) *SSTableNamesIterator
NewSSTableNamesIterator ...
type SSTableReader ¶
type SSTableReader struct {
*SSTable
}
SSTableReader ...
func NewSSTableReaderI ¶
func NewSSTableReaderI(filename string, indexPositions []*KeyPositionInfo, bf *utils.BloomFilter) *SSTableReader
NewSSTableReaderI ...
type SSTableSliceIterator ¶
type SSTableSliceIterator struct {
// contains filtered or unexported fields
}
SSTableSliceIterator ...
func NewSSTableSliceIterator ¶
func NewSSTableSliceIterator(ssTable *SSTableReader, key string, startColumn []byte, reversed bool) *SSTableSliceIterator
NewSSTableSliceIterator ...
type SSTableWriter ¶
type SSTableWriter struct { *SSTable // contains filtered or unexported fields }
SSTableWriter ...
func NewSSTableWriter ¶
func NewSSTableWriter(filename string, keyCount int) *SSTableWriter
NewSSTableWriter ...
type SimpleColumnIterator ¶
type SimpleColumnIterator struct {
// contains filtered or unexported fields
}
SimpleColumnIterator ...
func NewSColumnIterator ¶
func NewSColumnIterator(curIndex int, cf *ColumnFamily, columns [][]byte) *SimpleColumnIterator
NewSColumnIterator ...
type SliceByNamesReadCommand ¶
type SliceByNamesReadCommand struct { *AReadCommand // contains filtered or unexported fields }
SliceByNamesReadCommand ...
func NewSliceByNamesReadCommand ¶
func NewSliceByNamesReadCommand(table, key string, path QueryPath, columnNames [][]byte) *SliceByNamesReadCommand
NewSliceByNamesReadCommand ...
func (*SliceByNamesReadCommand) GetCFName ¶
func (s *SliceByNamesReadCommand) GetCFName() string
GetCFName ...
func (*SliceByNamesReadCommand) GetKey ¶
func (s *SliceByNamesReadCommand) GetKey() string
GetKey ...
func (*SliceByNamesReadCommand) GetQPath ¶
func (s *SliceByNamesReadCommand) GetQPath() QueryPath
GetQPath ...
func (*SliceByNamesReadCommand) GetRow ¶
func (s *SliceByNamesReadCommand) GetRow(table *Table) *Row
GetRow ...
func (*SliceByNamesReadCommand) GetTable ¶
func (s *SliceByNamesReadCommand) GetTable() string
GetTable ...
type SliceFromReadCommand ¶
type SliceFromReadCommand struct { *AReadCommand Start []byte Finish []byte Reversed bool Count int }
SliceFromReadCommand ...
func NewSliceFromReadCommand ¶
func NewSliceFromReadCommand(table, key string, path QueryPath, start, finish []byte, reversed bool, count int) *SliceFromReadCommand
NewSliceFromReadCommand ...
func (*SliceFromReadCommand) GetCFName ¶
func (s *SliceFromReadCommand) GetCFName() string
GetCFName ...
func (*SliceFromReadCommand) GetQPath ¶
func (s *SliceFromReadCommand) GetQPath() QueryPath
GetQPath ...
func (*SliceFromReadCommand) GetRow ¶
func (s *SliceFromReadCommand) GetRow(table *Table) *Row
GetRow ...
func (*SliceFromReadCommand) GetTable ¶
func (s *SliceFromReadCommand) GetTable() string
GetTable ...
type SliceQueryFilter ¶
type SliceQueryFilter struct { *AQueryFilter // contains filtered or unexported fields }
SliceQueryFilter ...
func NewSliceQueryFilter ¶
func NewSliceQueryFilter(key string, columnParent *QueryPath, start, finish []byte, reversed bool, count int) *SliceQueryFilter
NewSliceQueryFilter ...
type StorageMetadata ¶
StorageMetadata stores id and generation
func (*StorageMetadata) GetGeneration ¶
func (s *StorageMetadata) GetGeneration() int
GetGeneration return generation for this storage metadata
type SuperColumn ¶
type SuperColumn struct { Name string Columns map[string]IColumn Timestamp int64 // contains filtered or unexported fields }
SuperColumn implements IColumn interface
func NewSuperColumn ¶
func NewSuperColumn(name string) SuperColumn
NewSuperColumn constructs a SuperColun
func NewSuperColumnN ¶
func NewSuperColumnN(name string, subcolumns map[string]IColumn) SuperColumn
NewSuperColumnN constructs a SuperColun
func (SuperColumn) GetSubColumns ¶
func (sc SuperColumn) GetSubColumns() map[string]IColumn
GetSubColumns ...
func (SuperColumn) IsMarkedForDelete ¶
func (sc SuperColumn) IsMarkedForDelete() bool
IsMarkedForDelete ...
type SuperColumnFactory ¶
type SuperColumnFactory struct{}
SuperColumnFactory implements AColumnFactory
type SuperColumnSerializer ¶
type SuperColumnSerializer struct {
// contains filtered or unexported fields
}
SuperColumnSerializer ...
func NewSuperColumnSerializer ¶
func NewSuperColumnSerializer() *SuperColumnSerializer
NewSuperColumnSerializer ...
type TableMetadata ¶
type TableMetadata struct {
// contains filtered or unexported fields
}
TableMetadata stores infos about table and its columnFamilies
func NewTableMetadata ¶
func NewTableMetadata() *TableMetadata
NewTableMetadata initializes a TableMetadata
type TouchKeyCache ¶
type TouchKeyCache struct {
// contains filtered or unexported fields
}
TouchKeyCache implements LRU cache
func NewTouchKeyCache ¶
func NewTouchKeyCache(size int) *TouchKeyCache
NewTouchKeyCache initializes a cache with given size
Source Files
¶
- acolumnfactory.go
- binarymemtable.go
- cfserializer.go
- collatediterator.go
- column.go
- columnfamily.go
- columnfamilystore.go
- columnindexer.go
- columniterator.go
- commitlog.go
- commitlogheader.go
- dbmanager.go
- filestruct.go
- hintedhandoffmanager.go
- icolumn.go
- identityqueryfilter.go
- indexhelper.go
- iteratingrow.go
- memtable.go
- memtablemanager.go
- namesqueryfilter.go
- primarykey.go
- queryfilter.go
- querypath.go
- readcommand.go
- recoverymanager.go
- row.go
- rowmutation.go
- rowread.go
- slicebynamesreadcommand.go
- slicefromreadcommand.go
- slicequeryfilter.go
- sstable.go
- sstablenamesiterator.go
- sstablereader.go
- sstablesliceiterator.go
- sstablewriter.go
- supercolumn.go
- table.go
- tablemetadata.go