Documentation
¶
Index ¶
- Constants
- Variables
- func All(bucket []byte) [][]byte
- func Close()
- func Delete(bucket []byte, key interface{}) error
- func Get(bucket []byte, key interface{}) ([]byte, error)
- func Open(dbFile string) error
- func Put(bucket []byte, key, val interface{}) error
- func Update(fn func(tx *bolt.Tx) error) error
- func View(fn func(tx *bolt.Tx) error) error
Constants ¶
View Source
const ( // AutoIncrement sets the object's key as an auto incrementing ID AutoIncrement = iota + 1 // GetFirstKey gets the first object in a bucket GetFirstKey // GetLastKey gets the last object in a bucket GetLastKey )
Variables ¶
View Source
var ( // BucketQueued key, holds Torrent hash keys by auto ID that are queued for activity BucketQueued = []byte("Queued") // BucketTorrents key, holds Torrents by hash key, contains static info and magnet URLs BucketTorrents = []byte("Torrents") // BucketLabels key, holds user created Labels by unique short id BucketLabels = []byte("Labels") // ErrKeyNotValid if it's not metainfo.Hash, byte slice, string, struct pointer, GetFirstKey or GetLastKey ErrKeyNotValid = errors.New("key does not satisfy interface requirements") // ErrValueNotValid if it's not metainfo.Hash, byte slice, string, struct pointer, or AutoIncrement ErrValueNotValid = errors.New("value does not satisfy interface requirements") // ErrNoSuchKey if an object doesn't exist with the specified key ErrNoSuchKey = errors.New("no such key exists") )
Functions ¶
func All ¶
All returns all stored objects as a slice within the provided bucket. If there are no objects then nil is returned.
func Delete ¶
Delete returns the object held by key within the provided bucket. Key must be a type of metainfo.Hash, byte slice, string, GetFirstKey, or GetLastKey.
func Get ¶
Get retrieves a value by the provided key interface. Key must be a type of metainfo.Hash, byte slice, string, GetFirstKey, or GetLastKey.
func Put ¶
Put stores the value by its provided key and bucket. Key must be a type of metainfo.Hash, byte slice, string, or AutoIncrement. Val must be a type of metainfo.Hash, byte slice, string, or a struct that can be marshaled into JSON format.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.