blob: d1007e4b040b53d8b12148a7aded0c3f15c17262 [file] [log] [blame]
Abhay Kumar40252eb2025-10-13 13:25:53 +00001/*
2package bbolt implements a low-level key/value store in pure Go. It supports
3fully serializable transactions, ACID semantics, and lock-free MVCC with
4multiple readers and a single writer. Bolt can be used for projects that
5want a simple data store without the need to add large dependencies such as
6Postgres or MySQL.
7
8Bolt is a single-level, zero-copy, B+tree data store. This means that Bolt is
9optimized for fast read access and does not require recovery in the event of a
10system crash. Transactions which have not finished committing will simply be
11rolled back in the event of a crash.
12
13The design of Bolt is based on Howard Chu's LMDB database project.
14
15Bolt currently works on Windows, Mac OS X, and Linux.
16
17# Basics
18
19There are only a few types in Bolt: DB, Bucket, Tx, and Cursor. The DB is
20a collection of buckets and is represented by a single file on disk. A bucket is
21a collection of unique keys that are associated with values.
22
23Transactions provide either read-only or read-write access to the database.
24Read-only transactions can retrieve key/value pairs and can use Cursors to
25iterate over the dataset sequentially. Read-write transactions can create and
26delete buckets and can insert and remove keys. Only one read-write transaction
27is allowed at a time.
28
29# Caveats
30
31The database uses a read-only, memory-mapped data file to ensure that
32applications cannot corrupt the database, however, this means that keys and
33values returned from Bolt cannot be changed. Writing to a read-only byte slice
34will cause Go to panic.
35
36Keys and values retrieved from the database are only valid for the life of
37the transaction. When used outside the transaction, these byte slices can
38point to different data or can point to invalid memory which will cause a panic.
39*/
40package bbolt