boltfood

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 11 Imported by: 1

README

boltstorage

boltstorage

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BucketSeparator = byte(':')

	ErrDatabaseReadOnly = errors.New("readonly")
	ErrInvalidSeek      = errors.New("invalid seek")
	ErrCanceled         = errors.New("operation was canceled")
)
View Source
var BoltStoreClass = reflect.TypeOf((*implBoltStore)(nil))

Functions

func FromDB

func FromDB(name string, db *bolt.DB) *implBoltStore

func New

func New(name string, dataFile string, dataFilePerm os.FileMode, options ...Option) (*implBoltStore, error)

func ObjectType

func ObjectType() reflect.Type

func OpenDatabase

func OpenDatabase(dataFile string, dataFilePerm os.FileMode, options ...Option) (*bolt.DB, error)

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures bolt using the functional options paradigm popularized by Rob Pike and Dave Cheney. If you're unfamiliar with this style, see https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html and https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis.

func WithIndefinitelyTimeout

func WithIndefinitelyTimeout(value time.Duration) Option

func WithInitialMmapSize

func WithInitialMmapSize(value int) Option

InitialMmapSize is the initial mmap size of the database in bytes. Read transactions won't block write transaction if the InitialMmapSize is large enough to hold database mmap size. (See DB.Begin for more information)

If <=0, the initial map size is 0. If initialMmapSize is smaller than the previous database size, it takes no effect.

func WithMmapFlags

func WithMmapFlags(value int) Option

Sets the DB.MmapFlags flag before memory mapping the file.

func WithNoGrowSync

func WithNoGrowSync() Option

Sets the DB.NoGrowSync flag before memory mapping the file.

func WithNope

func WithNope() Option

option that do nothing

func WithReadOnly

func WithReadOnly() Option

Open database in read-only mode. Uses flock(..., LOCK_SH |LOCK_NB) to grab a shared lock (UNIX).

func WithTimeout

func WithTimeout(value time.Duration) Option

Timeout is the amount of time to wait to obtain a file lock. When set to zero it will wait indefinitely. This option is only available on Darwin and Linux.

Jump to

Keyboard shortcuts

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