Documentation
¶
Index ¶
Constants ¶
View Source
const (
StartAt = 123456
)
Variables ¶
View Source
var ( ErrBucketNotFound = bolt.ErrBucketNotFound ErrKeyAlreadyExist = errors.New("the key already exist") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Path is the file path to the storage file.
Path string
// BatchInterval is the maximum time before flushing the BatchTx.
// 提交两次批量事务的最大时间差,默认 100ms
BatchInterval time.Duration
// BatchLimit is the maximum puts before flushing the BatchTx.
// 指定每个批量读写事务能包含的最多操作个数,当超过这个阈值后,当前批量读写事务会自动提交
BatchLimit int
MmapSize int
}
func DefaultConfig ¶
func DefaultConfig() *Config
type Storage ¶
type Storage interface {
// Methods to manage key/value pairs
// Read-Only transactions
View(bucket, key []byte) ([]byte, error)
// Create or update a key
// If the key already exist it will return
Create(bucket, key, value []byte) error
// Create or update a key
// If the key not exist it will Create the key
Update(bucket, key, value []byte) error
// Delete a key from bucket
Delete(bucket, key []byte) error
// Generate a index for the url and store it
Index(value []byte) (uint64, error)
// Methods to manage a Bucket
CreateBucket(bucket []byte) error
DeleteBucket(bucket []byte) error
}
Click to show internal directories.
Click to hide internal directories.