Documentation
¶
Overview ¶
Package wildcat
(C) Copyright 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.
Package wildcat ¶
(C) Copyright 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.
Package wildcat ¶
(C) Copyright 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.
Package wildcat ¶
(C) Copyright 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.
Package wildcat ¶
(C) Copyright 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.
Package wildcat ¶
(C) Copyright 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.
Package wildcat ¶
(C) Copyright 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.
Package wildcat ¶
(C) Copyright 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.
Package wildcat ¶
(C) Copyright 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.
Package wildcat ¶
(C) Copyright 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.
Package wildcat ¶
(C) Copyright 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 ¶
- Constants
- type BlockSet
- type Compactor
- type DB
- type Flusher
- type IDGenerator
- type IDGeneratorState
- type IteratorItem
- type IteratorWithPeek
- type KLogEntry
- type Level
- type Memtable
- type MergeIterator
- type Options
- type SSTable
- type SSTableIterator
- type SSTableIteratorWrapper
- type SyncOption
- type Txn
- type WAL
Constants ¶
const ( CompactionCooldownPeriod = 1 * time.Second CompactionBatchSize = 4 // Max number of SSTables to compact at once CompactionSizeRatio = 1.2 // Level size ratio that triggers compaction CompactionSizeThreshold = 4 // Number of files to trigger size-tiered compaction CompactionScoreSizeWeight = 0.7 // Weight for size-based score CompactionScoreCountWeight = 0.3 // Weight for count-based score MaxCompactionConcurrency = 2 // Maximum concurrent compactions )
Constants for compaction policy
const ( FlusherTickerInterval = 64 * time.Microsecond // Interval for flusher ticker CompactorTickerInterval = 64 * time.Millisecond // Interval for compactor ticker )
Constants for background operations
const ( SSTablePrefix = "sst_" // Prefix for SSTable files LevelPrefix = "l" // Prefix for level directories i.e. "l0", "l1", etc. WALFileExtension = ".wal" // Extension for Write Ahead Log files <timestamp>.wal KLogExtension = ".klog" // Extension for KLog files VLogExtension = ".vlog" // Extension for VLog files IDGSTFileName = "idgstate" // Filename for ID generator state BloomFilterFalsePositiveRate = 0.01 // False positive rate for Bloom filter )
const ( DefaultWriteBufferSize = 128 * 1024 * 1024 DefaultSyncOption = SyncNone DefaultSyncInterval = 16 * time.Nanosecond DefaultLevelCount = 7 DefaultLevelMultiplier = 4 DefaultBlockManagerLRUSize = 128 // Size of the LRU cache for block managers DefaultBlockSetSize = 64 * 1024 * 1024 // Size of the block set DefaultPermission = 0750 )
Defaults
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockSet ¶
type BlockSet struct {
Entries []*KLogEntry // List of entries in the block
Size int64 // Size of the block set
}
BlockSet is a specific block with a set of klog entries
type Compactor ¶
type Compactor struct {
// contains filtered or unexported fields
}
Compactor is responsible for managing compaction jobs
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents the main Wildcat structure
func (*DB) ForceFlush ¶
ForceFlush forces the flush of all memtables and immutable memtables
type Flusher ¶
type Flusher struct {
// contains filtered or unexported fields
}
Flusher is responsible for queuing and flushing memtables to disk
type IDGenerator ¶
type IDGenerator struct {
// contains filtered or unexported fields
}
IDGenerator is a thread-safe ID generator
type IDGeneratorState ¶
type IDGeneratorState struct {
// contains filtered or unexported fields
}
IDGeneratorState represents the state of the ID generator. When system shuts down the state is saved to disk and restored on next startup.
type IteratorItem ¶
type IteratorItem struct {
Key []byte
Value []byte
Timestamp int64
Iter IteratorWithPeek
}
IteratorItem represents an item in the merge iterator heap
type IteratorWithPeek ¶
type IteratorWithPeek interface {
Next() ([]byte, []byte, int64, bool)
Prev() ([]byte, []byte, int64, bool)
Peek() ([]byte, []byte, int64, bool)
}
IteratorWithPeek is an interface for iterators that support peeking
type KLogEntry ¶
type KLogEntry struct {
Key []byte // Key of the entry
Timestamp int64 // Timestamp of the entry
ValueBlockID int64 // Block ID of the value
}
KLogEntry represents a key-value entry in the KLog
type Level ¶
type Level struct {
// contains filtered or unexported fields
}
Level is a disk level within Wildcat, which contains a list of immutable SSTables
type Memtable ¶
type Memtable struct {
// contains filtered or unexported fields
}
Memtable is a memory table structure
type MergeIterator ¶
type MergeIterator struct {
// contains filtered or unexported fields
}
MergeIterator combines results from multiple sources (memtables, immutable memtables, SSTables) in a sorted order based on key and timestamp
func NewMergeIterator ¶
func NewMergeIterator(txn *Txn, startKey []byte, prefix []byte) *MergeIterator
NewMergeIterator creates a new merge iterator that combines multiple iterators
type Options ¶
type Options struct {
Directory string // Directory for Wildcat
WriteBufferSize int64 // Size of the write buffer
SyncOption SyncOption // Sync option for write operations
SyncInterval time.Duration // Interval for syncing the write buffer
LevelCount int // Number of levels in the LSM tree
LevelMultiplier int // Multiplier for the number of levels
BlockManagerLRUSize int // Size of the LRU cache for block managers
BlockSetSize int64 // Amount of entries per klog block (in bytes)
Permission os.FileMode // Permission for created files
LogChannel chan string // Channel for logging
BloomFilter bool // Enable Bloom filter for SSTables
}
Options represents the configuration options for Wildcat
type SSTable ¶
type SSTable struct {
Id int64 // SStable ID
Min []byte // The minimum key in the SSTable
Max []byte // The maximum key in the SSTable
Size int64 // The size of the SSTable in bytes
EntryCount int // The number of entries in the SSTable
Level int // The level of the SSTable
BloomFilter *bloomfilter.BloomFilter // Optional bloom filter for fast lookups
// contains filtered or unexported fields
}
SSTable represents a sorted string table
type SSTableIterator ¶
type SSTableIterator struct {
// contains filtered or unexported fields
}
SSTableIterator is an iterator for the SSTable
func (*SSTableIterator) Seek ¶
func (it *SSTableIterator) Seek(key []byte) error
type SSTableIteratorWrapper ¶
type SSTableIteratorWrapper struct {
// contains filtered or unexported fields
}
SSTableIteratorWrapper adapts SSTableIterator to the IteratorWithPeek interface
func (*SSTableIteratorWrapper) Next ¶
func (s *SSTableIteratorWrapper) Next() ([]byte, []byte, int64, bool)
Next advances the iterator and returns the next key-value pair
type Txn ¶
type Txn struct {
Id int64 // The transactions id, can be recovered
ReadSet map[string]int64 // Key -> Timestamp
WriteSet map[string][]byte // Key -> Value
DeleteSet map[string]bool // Key -> Deleted
Timestamp int64 // The timestamp of the transaction
Committed bool // Whether the transaction is committed
// contains filtered or unexported fields
}
Txn represents a transaction in Wildcat
func (*Txn) NewIterator ¶
func (txn *Txn) NewIterator(startKey []byte, prefix []byte) *MergeIterator
NewIterator you can provide a startKey or a prefix to iterate over
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package blockmanager
|
Package blockmanager |
|
Package bloomfilter
|
Package bloomfilter |
|
Package lru
|
Package lru |
|
Package queue
|
Package queue |
|
Package skiplist
|
Package skiplist |
