Documentation ¶
Overview ¶
Package bobstore - a blobstore for small/medium blobs.
It is meant to store a couple of TB of 10k-50k json blobs, to take pressure of a non-distributed database.
It uses a directory with max. 64k data files each 1GB long. There is one lock file which is locked exclusively by the single writing process.
It is safe to use the same opened db handle from multiple goroutines. If this is the writing process, writing from multiple goroutines is supported.
Blobs are only appended. They are never modified, and individual blobs can not be deleted (whole files can be deleted, just don't reference their data after deletion).
Index ¶
Constants ¶
const MaxFileLength = 1024 * 1024 * 1024
MaxFileLength hard max for length of single file: 1GB this means a single blob may not be larger than 1GB - headerSize
const MaxNumberFiles = 0xFFFF
MaxNumberFiles is 64k
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec for compression/decompression
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor keeps track of the current position and record for iteration.
func (*Cursor) Compressed ¶
Compressed returns the compressed length of the current blob.
func (*Cursor) Next ¶
Next advances to the next blob.
It returns true if there is a current blob in which case the methods returning information on the current blob can be called. It returns false after the last blob has been visited, or after an error occurred.
Before Next() is called the first time, all other method results are undefined. After Next() returned false, only Error() has a defined result.
type DB ¶
type DB struct { MaxFileLength uint32 // contains filtered or unexported fields }
DB is an opaque handle to an opened blob storage
func (*DB) Cursor ¶
Cursor iterates over the db. next is the initial ref, null value means beginning of DB.
func (*DB) WritePosition ¶
WritePosition gives the current write position (where the next write would be) only implemented if opened read-write