Documentation ¶
Index ¶
- type CyclePDB
- func (c *CyclePDB) AsyncWrite(ctx context.Context, towrite []boltcycle.KvPair)
- func (c *CyclePDB) Close() error
- func (c *CyclePDB) CycleNodes() error
- func (c *CyclePDB) DB() *bolt.DB
- func (c *CyclePDB) Delete(keys [][]byte) ([]bool, error)
- func (c *CyclePDB) Read(toread [][]byte) ([][]byte, error)
- func (c *CyclePDB) Stats() boltcycle.Stats
- func (c *CyclePDB) VerifyBuckets() error
- func (c *CyclePDB) Write(towrite []boltcycle.KvPair) (err error)
- type DBConfiguration
- func AsyncErrors(asyncErrors chan<- error) DBConfiguration
- func BucketTimesIn(bucketName []byte) DBConfiguration
- func CycleLen(minNumOldBuckets int) DBConfiguration
- func DiskTimeOut(timeOut time.Duration) DBConfiguration
- func InitDB(b bool) DBConfiguration
- func MaxBatchSize(size int) DBConfiguration
- func MetaBucketName(bucketName []byte) DBConfiguration
- func ReadMovementBacklog(readMovementBacklog int) DBConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CyclePDB ¶
type CyclePDB struct {
// contains filtered or unexported fields
}
CyclePDB allows you to use a bolt.DB as a pseudo-LRU using a cycle of buckets
func New ¶
func New(dataDir string, optionalParameters ...DBConfiguration) (ret *CyclePDB, err error)
New creates a CyclePDB to use a bolt database that cycles minNumOldBuckets buckets
func (*CyclePDB) AsyncWrite ¶
AsyncWrite will enqueue a write into the same chan that moves reads to the last bucket. You must not *ever* change the []byte given to towrite since you can't know when that []byte is finished being used. Note that if the readMovements queue is backed up this operation will block until it has room.
func (*CyclePDB) CycleNodes ¶
CycleNodes deletes the first, oldest node in the primary bucket while there are >= minNumOldBuckets and creates a new, empty last node
func (*CyclePDB) Delete ¶
Delete all the keys from every bucket that could have the keys. Returns true/false for each key if it exists
func (*CyclePDB) Read ¶
Read bytes from the first available bucket. Do not modify the returned bytes because they are recopied to later cycle databases if needed.
func (*CyclePDB) Stats ¶
Stats returns introspection stats about the Database. The members are considered alpha and subject to change or rename.
func (*CyclePDB) VerifyBuckets ¶
VerifyBuckets ensures that the cycle of buckets have the correct names
type DBConfiguration ¶
DBConfiguration are callbacks used as optional vardic parameters in New() to configure DB usage
func AsyncErrors ¶
func AsyncErrors(asyncErrors chan<- error) DBConfiguration
AsyncErrors controls where we log async errors into. If nil, they are silently dropped
func BucketTimesIn ¶
func BucketTimesIn(bucketName []byte) DBConfiguration
BucketTimesIn is the sub bucket we put our cycled hashmap into
func CycleLen ¶
func CycleLen(minNumOldBuckets int) DBConfiguration
CycleLen sets the number of old buckets to keep around
func DiskTimeOut ¶
func DiskTimeOut(timeOut time.Duration) DBConfiguration
DiskTimeOut configures how logn we wait to get a lock within boltdb
func MaxBatchSize ¶
func MaxBatchSize(size int) DBConfiguration
MaxBatchSize configures how logn we wait to get a lock within boltdb
func MetaBucketName ¶
func MetaBucketName(bucketName []byte) DBConfiguration
MetaBucketName is the sub bucket we put our metadata
func ReadMovementBacklog ¶
func ReadMovementBacklog(readMovementBacklog int) DBConfiguration
ReadMovementBacklog sets the size of the channel of read operations to rewrite