options

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2023 License: BSD-3-Clause Imports: 2 Imported by: 3

Documentation

Index

Constants

View Source
const (
	NamespaceDefault = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v0.2.6

type Option func(cfg *Options) error

Defines the signature of functions accepted as parameters by Honu methods.

func WithForce added in v0.2.7

func WithForce() Option

WithForce prevents validation checks from returning an error during accesses.

func WithLevelDBRead added in v0.2.6

func WithLevelDBRead(opts *ldb.ReadOptions) Option

Closure returning a function that adds the leveldbRead parameter to an Options struct's LeveldbRead field.

func WithLevelDBWrite added in v0.2.6

func WithLevelDBWrite(opts *ldb.WriteOptions) Option

Closure returning a function that adds the leveldbWrite parameter to an Options struct's LeveldbWrite field.

func WithNamespace

func WithNamespace(namespace string) Option

WithNamespace returns a closure that sets a namespace other than the default.

func WithPebbleWrite

func WithPebbleWrite(opts *pebble.WriteOptions) Option

Closure returning a function that adds the pebbleWrite parameter to an Options struct's PebbleWrite field.

func WithRequireExists added in v0.4.0

func WithRequireExists() Option

WithRequireExists adds an invariants to writes that the key has to exist prior to the write operation otherwise the operation will fail with a NotFound error. This is a similar semantic to "Update" for Put and is a check to ensure that something was removed for Delete.

func WithRequireNotExists added in v0.4.0

func WithRequireNotExists() Option

WithRequireNotExists adds an invariant to writes that the key must not exist prior to the write operation otherwise the operation will fail with an AlreadyExists error. This is a similar semantic to "Create" for Put and while it has no real meaning for Delete, the invariant is still enforced.

func WithTombstones added in v0.2.8

func WithTombstones() Option

WithTombstones causes the iterator to include tombstones as its iterating.

type Options

type Options struct {
	LevelDBRead      *ldb.ReadOptions
	LevelDBWrite     *ldb.WriteOptions
	PebbleWrite      *pebble.WriteOptions
	Namespace        string
	Force            bool
	Tombstones       bool
	RequireExists    bool
	RequireNotExists bool
}

Contains all available read/write options for the supported engines. Fields are set by closures implementing the SetOptions signature.

func New

func New(options ...Option) (cfg *Options, err error)

New creates a per-call Options object based on the variadic SetOptions closures supplied by the user. New also sets sensible defaults for various options.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL