engine

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 16 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB represents a FlyDB database instance, a high-performance storage engine built on the bitcask model. FlyDB utilizes a log-structured storage approach, which optimizes data operations by efficiently managing writes, reads, and deletes.

FlyDB shines in its ability to swiftly handle data operations, offering exceptional performance. With just a single disk IO, FlyDB completes each operation efficiently, resulting in lightning-fast response times.

One of the standout features of FlyDB is its efficient memory utilization. It employs an in-memory index that stores key-value mappings, facilitating rapid data access. This indexing mechanism enables FlyDB bto quickly locate data within the storage structure. However, it's important to note that the total size of data that can be stored is limited by the available memory capacity.

When your system's memory can accommodate a significant portion of the key-value pairs, FlyDB emerges as an excellent choice of storage engine. It not only delivers outstanding speed and responsiveness but also minimizes disk IO overhead, allowing for seamless data operations.

FlyDB's design philosophy revolves around balancing performance and memory usage. By optimizing disk IO and leveraging in-memory indexing, FlyDB provides a powerful and efficient storage solution for applications that prioritize speed and responsiveness.

func NewDB

func NewDB(options config.Options) (*DB, error)

NewDB open a new db instance

func (*DB) Clean added in v1.0.6

func (db *DB) Clean()

Clean the DB data directory after the test is complete

func (*DB) Close

func (db *DB) Close() error

Close the db instance

func (*DB) Delete

func (db *DB) Delete(key []byte) error

Delete data according to the key

func (*DB) Fold

func (db *DB) Fold(f func(key []byte, value []byte) bool) error

Fold get all the data and perform the operation specified by the user. The function returns false to exit

func (*DB) Get

func (db *DB) Get(key []byte) ([]byte, error)

Get Read data according to the key

func (*DB) GetListKeys

func (db *DB) GetListKeys() [][]byte

GetListKeys Gets all the keys in the database

func (*DB) Merge

func (db *DB) Merge() error

Merge Clear the invalid data and generate the hint index file

func (*DB) NewIterator

func (db *DB) NewIterator(opt config.IteratorOptions) *Iterator

NewIterator Initializes the iterator

func (*DB) NewWriteBatch

func (db *DB) NewWriteBatch(opt config.WriteBatchOptions) *WriteBatch

NewWriteBatch Init WriteBatch

func (*DB) Put

func (db *DB) Put(key []byte, value []byte) error

Put write a key-value pair to db, and the key must be not empty

func (*DB) Sync

func (db *DB) Sync() error

Sync the db instance

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

Iterator iterator

func (*Iterator) Close

func (it *Iterator) Close()

func (*Iterator) Key

func (it *Iterator) Key() []byte

func (*Iterator) Next

func (it *Iterator) Next()

func (*Iterator) Rewind

func (it *Iterator) Rewind()

func (*Iterator) Seek

func (it *Iterator) Seek(key []byte)

func (*Iterator) Valid

func (it *Iterator) Valid() bool

func (*Iterator) Value

func (it *Iterator) Value() ([]byte, error)

type WriteBatch

type WriteBatch struct {
	// contains filtered or unexported fields
}

WriteBatch Writes data in atomic batches to ensure atomicity

func (*WriteBatch) Commit

func (wb *WriteBatch) Commit() error

Commit The transaction commits, writes the transient data to the data file, and updates the in-memory index

func (*WriteBatch) Delete

func (wb *WriteBatch) Delete(key []byte) error

Delete Batch deletion of data

func (*WriteBatch) Put

func (wb *WriteBatch) Put(key []byte, value []byte) error

Put Data batch write

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL