boltdb

package
v0.0.0-...-01bad0f Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package boltdb implements storage based on the BoltDB database, backed by the filesystem.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToSetupDatabase = errors.New("failed to setup backing database")
	ErrFailedToTX            = errors.New("failed to complete database transaction")
	ErrDataCorrupt           = errors.New("data returned from the database corrupted")
)

Err* are sentinel errors

Functions

This section is empty.

Types

type BoltDB

type BoltDB struct {
	// contains filtered or unexported fields
}

BoltDB is an implementation of the link shortener that stores links in the boltdb storage engine by CoreOS (later, etcd-io):

* https://github.com/etcd-io/bbolt

Not something I've used a lot, so YMMV.

func New

func New(path string, opts ...Option) (*BoltDB, error)

New creates a new BoltDB backed storage implementation.

func (*BoltDB) Get

func (b *BoltDB) Get(_ context.Context, in *url.URL) (*url.URL, error)

Get returns a URL, given another input URL

func (*BoltDB) Put

func (b *BoltDB) Put(_ context.Context, f *url.URL, t *url.URL) error

Put saves a URL to the datastore

type Option

type Option func(db *bbolt.Options) error

Option modifies the bolt options, allowing the user to set some property of the database.

func WithFileLockWait

func WithFileLockWait(dur time.Duration) Option

WithFileLockWait modifies the timeout that Unix based operating systems will wait for the file lock to be freed.

Jump to

Keyboard shortcuts

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