Documentation ¶
Index ¶
- Constants
- Variables
- type DB
- func (db *DB) Close() error
- func (db *DB) Compact() error
- func (db *DB) Delete(key []byte) error
- func (db *DB) Get(key []byte) ([]byte, error)
- func (d *DB) GetLevelDB() *leveldb.DB
- func (s *DB) GetStorageEngine() interface{}
- func (db *DB) NewIterator() driver.IIterator
- func (db *DB) NewSnapshot() (driver.ISnapshot, error)
- func (db *DB) NewWriteBatch() driver.IWriteBatch
- func (db *DB) Put(key, value []byte) error
- func (db *DB) SyncDelete(key []byte) error
- func (db *DB) SyncPut(key []byte, value []byte) error
- type Iterator
- type Snapshot
- type Store
- type WriteBatch
Constants ¶
const (
// StorageName is the name of the storage driver
StorageName = "ipfs-log"
)
Variables ¶
var Dbname = "ifdb-event-kv-ipfs-log"
Dbname is the default name for the database
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents the database instance
func (*DB) GetLevelDB ¶
GetLevelDB returns the underlying leveldb instance
func (*DB) GetStorageEngine ¶
func (s *DB) GetStorageEngine() interface{}
GetStorageEngine returns the storage engine instance
func (*DB) NewIterator ¶
NewIterator creates a new iterator for iterating over the database
func (*DB) NewSnapshot ¶
NewSnapshot creates a new snapshot of the database
func (*DB) NewWriteBatch ¶
func (db *DB) NewWriteBatch() driver.IWriteBatch
NewWriteBatch creates a new write batch for batch operations
func (*DB) SyncDelete ¶
SyncDelete is a synchronous version of Delete
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator wraps the leveldb iterator to provide a higher-level interface.
func (*Iterator) Seek ¶
Seek moves the iterator to the first key that is greater than or equal to the given key.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot represents a read-only snapshot of the database at a particular point in time.
func (*Snapshot) Close ¶
func (s *Snapshot) Close()
Close releases the snapshot, making it unusable.
func (*Snapshot) Get ¶
Get retrieves the value for a key from the snapshot. It returns the value and any error encountered.
func (*Snapshot) NewIterator ¶
NewIterator creates a new iterator for the snapshot. It returns an IIterator interface which can be used to iterate over the snapshot's data.
type Store ¶
type Store struct{}
Store is the implementation of the storage driver
type WriteBatch ¶
type WriteBatch struct {
// contains filtered or unexported fields
}
WriteBatch represents a batch of write operations to be committed to the database.
func (*WriteBatch) Close ¶
func (w *WriteBatch) Close()
Close releases any resources held by the write batch.
func (*WriteBatch) Commit ¶
func (w *WriteBatch) Commit() error
Commit writes the batch's operations to the database. It returns an error if the commit fails.
func (*WriteBatch) Data ¶
func (w *WriteBatch) Data() []byte
Data returns the raw data of the write batch. This is useful for debugging or replication purposes.
func (*WriteBatch) Delete ¶
func (w *WriteBatch) Delete(key []byte)
Delete removes a key-value pair from the write batch. This operation does not immediately delete from the database.
func (*WriteBatch) Put ¶
func (w *WriteBatch) Put(key, value []byte)
Put adds a key-value pair to the write batch. This operation does not immediately write to the database.
func (*WriteBatch) Rollback ¶
func (w *WriteBatch) Rollback() error
Rollback discards all operations in the write batch. It returns an error if the rollback fails.
func (*WriteBatch) SyncCommit ¶
func (w *WriteBatch) SyncCommit() error
SyncCommit writes the batch's operations to the database and ensures they are written to stable storage. It returns an error if the commit fails.