Documentation
¶
Index ¶
- Variables
- func BuildOptions(bp Blueprint) *pebble.Options
- func EndPrefixRange(prefix []byte) []byte
- func NewCacheWithShards(size int64, shards int) *pebble.Cache
- func Reset(batch *pebble.Batch, min, max int) bool
- func Rewind(batch *pebble.Batch, length int)
- type Action
- type Blueprint
- type Pipeline
- type ReadWriter
Constants ¶
This section is empty.
Variables ¶
var ErrPipelineClosed = errors.New("pipeline closed")
ErrPipelineClosed is returned if the pipeline has already been closed.
Functions ¶
func BuildOptions ¶
BuildOptions supports building pebble options based on a blueprint. The default values applied to the blueprint represents the chosen settings in CockroachDB the primary users of pebble. https://github.com/cockroachdb/cockroach/blob/master/pkg/storage/pebble.go#L570 https://github.com/cockroachdb/pebble/blob/master/cmd/pebble/db.go#L53
func EndPrefixRange ¶
EndPrefixRange will return the end of a prefix range. It will modify the supplied byte slice. The function may return nil if the specified prefix cannot be terminated.
func NewCacheWithShards ¶
NewCacheWithShards allows the creation of a cache with an explicit number of shards.
Types ¶
type Action ¶ added in v0.1.4
type Action int
Action defines the action take by the pipeline after executing a work function.
type Blueprint ¶
type Blueprint struct { // The file system implementation. FS vfs.FS // The block cache instance. Cache *pebble.Cache // Whether to not use bloom filters on all except the last level. NoFilters bool // The number of levels to use. // // Default: 7 Levels int // The mem table size. // // Default: 64 MiB MemTableSize int // The maximum number of active mem tables. // // Default: 4 MaxMemTables int // The maximum size of the base level. // // Pebble uses an algorithm to dynamically calculate the level sizes similar // to the one found in RocksDB. This options forces a cap on the level L0 // is compacted into to ensure new levels are created when needed. // https://github.com/cockroachdb/pebble/blob/master/options.go#L538 // https://github.com/cockroachdb/pebble/commit/22071b0f2df784875d3be05132f71396463b0dc4 // https://github.com/cockroachdb/pebble/commit/f5d25937abe21677033114db971e3acf863bc1a3 // http://rocksdb.org/blog/2015/07/23/dynamic-level.html // // Default: 64 MiB MaxBaseLevelSize int // The start file size for the first level and the file size multiplier for // the following levels. // // Default: 2 MiB, 2x StartFileSize int FileSizeMultiplier int // The data and index block size. // // Default: 32 KiB, 256 KiB DataBlockSize int IndexBlockSize int }
Blueprint describes the values used to build options for pebble.
type Pipeline ¶ added in v0.1.4
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline provides a mechanism to coalesce multiple mini-transactions into a single batch to reduce overhead and improve performance. It is most useful in scenarios where many goroutines perform transactions that only modify a small set of keys.
func NewPipeline ¶ added in v0.1.4
NewPipeline will create and return a new pipeline. The queue size specifies the number parallel operations that may be coalesced.
func (*Pipeline) Close ¶ added in v0.1.4
func (b *Pipeline) Close()
Close will stop and close the pipeline.
func (*Pipeline) Queue ¶ added in v0.1.4
Queue will submit the provided work function to the queue. The function will be called with a new or used batch for operation. If it returns an error, the performed changes are rolled back. On success the final indicated action is taken after executing all current operations. If a result function is provided it will be called with the result of the batch application. Only if the action is Sync and both calls return no error, the changes can be considered to be durable.