Documentation
¶
Overview ¶
Package tidesdb_go Copyright (C) TidesDB
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 ¶
- Constants
- type ColumnFamily
- type ColumnFamilyConfig
- type ColumnFamilySSTableStat
- type ColumnFamilyStat
- type Config
- type Iterator
- type TidesDB
- func (db *TidesDB) BeginReadTxn() (*Transaction, error)
- func (db *TidesDB) BeginTxn() (*Transaction, error)
- func (db *TidesDB) Close() error
- func (db *TidesDB) CreateColumnFamily(name string, config ColumnFamilyConfig) error
- func (db *TidesDB) DropColumnFamily(name string) error
- func (db *TidesDB) GetColumnFamily(name string) (*ColumnFamily, error)
- func (db *TidesDB) GetColumnFamilyStats(name string) (*ColumnFamilyStat, error)
- func (db *TidesDB) ListColumnFamilies() ([]string, error)
- type TidesDBCompressionAlgo
- type TidesDBSyncMode
- type Transaction
- func (txn *Transaction) Commit() error
- func (txn *Transaction) Delete(columnFamily string, key []byte) error
- func (txn *Transaction) Free()
- func (txn *Transaction) Get(columnFamily string, key []byte) ([]byte, error)
- func (txn *Transaction) NewIterator(columnFamily string) (*Iterator, error)
- func (txn *Transaction) Put(columnFamily string, key, value []byte, ttl int64) error
- func (txn *Transaction) Rollback() error
Constants ¶
const ( TDB_SUCCESS = C.TDB_SUCCESS TDB_ERROR = C.TDB_ERROR TDB_ERR_MEMORY = C.TDB_ERR_MEMORY TDB_ERR_INVALID_ARGS = C.TDB_ERR_INVALID_ARGS TDB_ERR_IO = C.TDB_ERR_IO TDB_ERR_NOT_FOUND = C.TDB_ERR_NOT_FOUND TDB_ERR_EXISTS = C.TDB_ERR_EXISTS TDB_ERR_CORRUPT = C.TDB_ERR_CORRUPT TDB_ERR_LOCK = C.TDB_ERR_LOCK TDB_ERR_TXN_COMMITTED = C.TDB_ERR_TXN_COMMITTED TDB_ERR_TXN_ABORTED = C.TDB_ERR_TXN_ABORTED TDB_ERR_READONLY = C.TDB_ERR_READONLY TDB_ERR_FULL = C.TDB_ERR_FULL TDB_ERR_INVALID_NAME = C.TDB_ERR_INVALID_NAME TDB_ERR_COMPARATOR_NOT_FOUND = C.TDB_ERR_COMPARATOR_NOT_FOUND TDB_ERR_MAX_COMPARATORS = C.TDB_ERR_MAX_COMPARATORS TDB_ERR_INVALID_CF = C.TDB_ERR_INVALID_CF TDB_ERR_THREAD = C.TDB_ERR_THREAD TDB_ERR_CHECKSUM = C.TDB_ERR_CHECKSUM )
Error codes from TidesDB
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnFamily ¶ added in v0.5.0
type ColumnFamily struct {
// contains filtered or unexported fields
}
ColumnFamily represents a TidesDB column family.
func (*ColumnFamily) Compact ¶ added in v0.5.0
func (cf *ColumnFamily) Compact() error
Compact manually triggers compaction for a column family.
type ColumnFamilyConfig ¶ added in v0.3.0
type ColumnFamilyConfig struct {
MemtableFlushSize int
MaxSSTablesBeforeCompaction int
CompactionThreads int
MaxLevel int
Probability float32
Compressed bool
CompressAlgo TidesDBCompressionAlgo
BloomFilterFPRate float64
EnableBackgroundCompaction bool
BackgroundCompactionInterval int
UseSBHA bool
SyncMode TidesDBSyncMode
SyncInterval int
ComparatorName *string
}
ColumnFamilyConfig represents the configuration for a column family.
func DefaultColumnFamilyConfig ¶ added in v0.5.0
func DefaultColumnFamilyConfig() ColumnFamilyConfig
DefaultColumnFamilyConfig returns a default column family configuration.
type ColumnFamilySSTableStat ¶ added in v0.3.0
ColumnFamilySSTableStat represents statistics about an SSTable in a column family.
type ColumnFamilyStat ¶ added in v0.3.0
type ColumnFamilyStat struct {
Name string
ComparatorName string
NumSSTables int
TotalSSTableSize int64
MemtableSize int64
MemtableEntries int
Config ColumnFamilyConfig
}
ColumnFamilyStat represents statistics about a column family.
type Iterator ¶ added in v0.5.0
type Iterator struct {
// contains filtered or unexported fields
}
Iterator represents a TidesDB iterator.
func (*Iterator) Free ¶ added in v0.5.0
func (iter *Iterator) Free()
Free frees the iterator resources.
func (*Iterator) Next ¶ added in v0.5.0
func (iter *Iterator) Next()
Next moves the iterator to the next entry.
func (*Iterator) Prev ¶ added in v0.5.0
func (iter *Iterator) Prev()
Prev moves the iterator to the previous entry.
func (*Iterator) SeekToFirst ¶ added in v0.5.0
SeekToFirst positions the iterator at the first key. Note: This automatically advances to the first valid entry.
func (*Iterator) SeekToLast ¶ added in v0.5.0
SeekToLast positions the iterator at the last key. Note: This automatically moves to the last valid entry.
type TidesDB ¶
type TidesDB struct {
// contains filtered or unexported fields
}
TidesDB represents a TidesDB instance.
func (*TidesDB) BeginReadTxn ¶ added in v0.5.0
func (db *TidesDB) BeginReadTxn() (*Transaction, error)
BeginReadTxn begins a new read-only transaction.
func (*TidesDB) BeginTxn ¶
func (db *TidesDB) BeginTxn() (*Transaction, error)
BeginTxn begins a new write transaction.
func (*TidesDB) CreateColumnFamily ¶
func (db *TidesDB) CreateColumnFamily(name string, config ColumnFamilyConfig) error
CreateColumnFamily creates a new column family with the given configuration.
func (*TidesDB) DropColumnFamily ¶
DropColumnFamily drops a column family and all associated data.
func (*TidesDB) GetColumnFamily ¶ added in v0.5.0
func (db *TidesDB) GetColumnFamily(name string) (*ColumnFamily, error)
GetColumnFamily retrieves a column family by name.
func (*TidesDB) GetColumnFamilyStats ¶ added in v0.5.0
func (db *TidesDB) GetColumnFamilyStats(name string) (*ColumnFamilyStat, error)
GetColumnFamilyStats retrieves statistics about a column family.
func (*TidesDB) ListColumnFamilies ¶
ListColumnFamilies lists all column families in the database.
type TidesDBCompressionAlgo ¶
type TidesDBCompressionAlgo int
TidesDBCompressionAlgo represents the compression algorithm type.
const ( TDB_COMPRESS_SNAPPY TidesDBCompressionAlgo = C.COMPRESS_SNAPPY TDB_COMPRESS_LZ4 TidesDBCompressionAlgo = C.COMPRESS_LZ4 TDB_COMPRESS_ZSTD TidesDBCompressionAlgo = C.COMPRESS_ZSTD )
type TidesDBSyncMode ¶ added in v0.5.0
type TidesDBSyncMode int
TidesDBSyncMode represents the sync mode for durability.
const ( TDB_SYNC_NONE TidesDBSyncMode = C.TDB_SYNC_NONE TDB_SYNC_BACKGROUND TidesDBSyncMode = C.TDB_SYNC_BACKGROUND TDB_SYNC_FULL TidesDBSyncMode = C.TDB_SYNC_FULL )
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents a TidesDB transaction.
func (*Transaction) Delete ¶
func (txn *Transaction) Delete(columnFamily string, key []byte) error
Delete removes a key-value pair from the transaction.
func (*Transaction) Get ¶
func (txn *Transaction) Get(columnFamily string, key []byte) ([]byte, error)
Get retrieves a value from the transaction.
func (*Transaction) NewIterator ¶ added in v0.5.0
func (txn *Transaction) NewIterator(columnFamily string) (*Iterator, error)
NewIterator creates a new iterator for a column family within a transaction.
func (*Transaction) Put ¶
func (txn *Transaction) Put(columnFamily string, key, value []byte, ttl int64) error
Put adds a key-value pair to the transaction.
func (*Transaction) Rollback ¶
func (txn *Transaction) Rollback() error
Rollback rolls back the transaction.