Documentation
¶
Overview ¶
Package starskey
(C) Copyright Starskey
Original Author: Alex Gaetano Padula
Licensed under the Mozilla Public License, v. 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.mozilla.org/en-US/MPL/2.0/
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- type CompressionOption
- type Config
- type KLogRecord
- type Level
- type OperationType
- type OptionalConfig
- type SSTable
- type Starskey
- func (skey *Starskey) BeginTxn() *Txn
- func (skey *Starskey) Close() error
- func (skey *Starskey) Delete(key []byte) error
- func (skey *Starskey) DeleteByFilter(compare func(key []byte) bool) (int, error)
- func (skey *Starskey) DeleteByPrefix(prefix []byte) (int, error)
- func (skey *Starskey) DeleteByRange(startKey, endKey []byte) (int, error)
- func (skey *Starskey) FilterKeys(compare func(key []byte) bool) ([][]byte, error)
- func (skey *Starskey) Get(key []byte) ([]byte, error)
- func (skey *Starskey) LongestPrefixSearch(key []byte) ([]byte, int, error)
- func (skey *Starskey) PrefixSearch(prefix []byte) ([][]byte, error)
- func (skey *Starskey) Put(key, value []byte) error
- func (skey *Starskey) Range(startKey, endKey []byte) ([][]byte, error)
- func (skey *Starskey) Update(fn func(tx *Txn) error) error
- type Txn
- type TxnOperation
- type TxnRollbackOperation
- type VLogRecord
- type WAL
- type WALRecord
Constants ¶
This section is empty.
Variables ¶
var ( WALExtension = ".wal" // Write ahead log extension VLogExtension = ".vlog" // value log extension KLogExtension = ".klog" // key log extension LogExtension = ".log" // debug log extension BloomFilterExtension = ".bf" // bloom filter extension SuRFExtension = ".srf" // SuRF extension SSTPrefix = "sst_" // SSTable prefix LevelPrefix = "l" // Level prefix, i.e l1, l2, l3, etc. PageSize = 128 // Page size (default), smaller is better. The pager handles overflowing in sequence. 1024, or 1024 will cause VERY large files. SyncInterval = time.Millisecond * 256 // File sync interval (default) Tombstone = []byte{0xDE, 0xAD, 0xBE, 0xEF} // Tombstone value TTreeMin = 12 // Minimum degree of the T-Tree (default) TTreeMax = 32 // Maximum degree of the T-Tree (default) BloomFilterProbability = 0.01 // Bloom filter probability (default) )
Global system variables
Functions ¶
This section is empty.
Types ¶
type CompressionOption ¶ added in v0.0.3
type CompressionOption int
const ( NoCompression CompressionOption = iota SnappyCompression S2Compression )
Compression options
type Config ¶
type Config struct { Permission os.FileMode // Directory and file permissions Directory string // Directory to store the starskey files FlushThreshold uint64 // Flush threshold for memtable MaxLevel uint64 // Maximum number of levels SizeFactor uint64 // Size factor for each level BloomFilter bool // Enable bloom filter Logging bool // Enable log file Compression bool // Enable compression CompressionOption CompressionOption // Desired compression option SuRF bool // Enable SuRF Optional *OptionalConfig // Optional configurations }
Config represents the configuration for starskey instance
type KLogRecord ¶
type KLogRecord struct { Key []byte // The key ValPageNum uint64 // The page number of the value in the value log }
KLogRecord represents a key log record
type Level ¶
type Level struct {
// contains filtered or unexported fields
}
Level represents a disk level
type OperationType ¶
type OperationType int
OperationType represents the type of operation for a WAL record and transactions
const ( Put OperationType = iota Delete Get )
type OptionalConfig ¶ added in v0.1.5
type OptionalConfig struct { BackgroundFSync bool // You can optionally opt to not fsync writes to disk BackgroundFSyncInterval time.Duration // Interval for background fsync, if configured true TTreeMin int // Minimum degree of the T-Tree TTreeMax int // Maximum degree of the T-Tree PageSize int // Page size BloomFilterProbability float64 // Bloom filter probability }
OptionalConfig represents optional configuration for starskey instance Mainly configurations for internal data structures and operations BackgroundFSync default is true BackgroundFSyncInterval default is 256ms TTreeMin default is 12 TTreeMax default is 32 PageSize default is 128 BloomFilterProbability default is 0.01
type SSTable ¶
type SSTable struct {
// contains filtered or unexported fields
}
SSTable represents a sorted string table
type Starskey ¶
type Starskey struct {
// contains filtered or unexported fields
}
Starskey represents the main struct for the package
func (*Starskey) DeleteByFilter ¶ added in v0.1.3
DeleteByFilter deletes all keys that match the given filter function
func (*Starskey) DeleteByPrefix ¶ added in v0.1.4
DeleteByPrefix deletes all keys that match the given prefix and returns the number of keys deleted.
func (*Starskey) DeleteByRange ¶ added in v0.1.3
DeleteByRange deletes all keys in the given range [startKey, endKey]
func (*Starskey) FilterKeys ¶
FilterKeys retrieves values from the database that match a key filter
func (*Starskey) LongestPrefixSearch ¶ added in v0.1.4
LongestPrefixSearch finds the longest matching prefix for a given key Returns the value associated with the longest prefix and the length of the matched prefix
func (*Starskey) PrefixSearch ¶ added in v0.1.4
PrefixSearch finds all keys that match the given prefix
type Txn ¶
type Txn struct {
// contains filtered or unexported fields
}
Txn represents a transaction
type TxnOperation ¶
type TxnOperation struct {
// contains filtered or unexported fields
}
TxnOperation represents an operation in a transaction
type TxnRollbackOperation ¶
type TxnRollbackOperation struct {
// contains filtered or unexported fields
}
TxnRollbackOperation represents a rollback operation in a transaction
type VLogRecord ¶
type VLogRecord struct {
Value []byte // The value
}
VLogRecord represents a value log record
type WAL ¶
type WAL struct {
// contains filtered or unexported fields
}
WAL represents a write-ahead log
type WALRecord ¶
type WALRecord struct { Key []byte // Key Value []byte // Value Op OperationType // Operation type }
WALRecord represents a WAL record
Directories
¶
Path | Synopsis |
---|---|
Package bloomfilter
|
Package bloomfilter |
Package pager
|
Package pager |
Package ttree
|
Package ttree |
Package ttree
|
Package ttree |