github.com/sxwebdev/chaindb
Package chaindb provides a high-performance, thread-safe key-value database abstraction built on top of Pebble DB (CockroachDB's LSM-based storage engine). It is specifically optimized for blockchain applications and other use cases requiring atomic batch operations, efficient state management, and safe concurrent access. ChainDB wraps Pebble DB to provide: Basic usage: Tables provide logical separation of data using key prefixes. All keys in a table are automatically prefixed, and the prefix is transparently stripped when reading: Batches accumulate multiple operations and apply them atomically. All batch types are fully thread-safe - multiple goroutines can safely call Put/Delete concurrently without external locking: For atomic updates across multiple tables, use a shared batch: Iterators allow sequential access to key-value pairs. For tables, key prefixes are automatically stripped: Range iteration with bounds: Note: Iterators are NOT thread-safe individually, but multiple iterators can exist and operate concurrently on the same database. The database can be configured with various options: Available options: Compaction flattens the LSM tree, reducing space and improving read performance: Force WAL flush to disk: Get database statistics: Access underlying Pebble instance (for advanced use cases): ChainDB provides the following thread-safety guarantees: The package defines the following errors: Advantages: Considerations: The package provides helpful constants: Example usage:
proxy.golang.org
0
Links
| Registry | proxy.golang.org |
| Source | Repository |
| Docs | Documentation |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
| PURL |
pkg:golang/github.com/sxwebdev/chaindb
spec |
| License | MIT |
| Namespace | github.com/sxwebdev |
| Last Synced | 5 days ago |
Repository
| Stars | 0 on GitHub |
| Forks | 0 on GitHub |