db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDBFileMode = 0600

DefaultDBFileMode is the default file mode a bolt database file should be created with if nothing else is specified.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bolt

type Bolt struct {
	FilePath string
	FileMode os.FileMode
	// contains filtered or unexported fields
}

Bolt represents the bbolt database used by acmeproxy to store its data.

Bolt manages the data file used by bbolt and provides factory methods for the various repositories used throughout acmeproxy.

See https://github.com/etcd-io/bbolt for more information about bbolt.

func (*Bolt) Close

func (b *Bolt) Close() error

Close closes the bolt database.

func (*Bolt) DomainRepository

func (b *Bolt) DomainRepository() acme.DomainRepository

DomainRepository returns an instance of a domain repository.

func (*Bolt) Open

func (b *Bolt) Open() error

Open opens the bolt database.

func (*Bolt) UserRepository

func (b *Bolt) UserRepository() acme.UserRepository

UserRepository returns an instance of a user repository.

type TestFixture

type TestFixture struct {
	DB *Bolt
	// contains filtered or unexported fields
}

TestFixture wraps a database suitable for testing.

After the test is done the fixture needs to be discarded by calling its Close method.

Use NewTestFixture to create an instance of this type.

func NewTestFixture

func NewTestFixture(t *testing.T) *TestFixture

NewTestFixture creates a new database test fixture.

func (*TestFixture) Close

func (fx *TestFixture) Close() error

Close discards the database test fixture and gets rid of all files and directories created for the test database.

func (*TestFixture) CreateBucket

func (fx *TestFixture) CreateBucket(name string)

CreateBucket adds an empty bucket with the passed name to the database. It fails the test if an error occurs.

func (*TestFixture) CreateBucketWithKey

func (fx *TestFixture) CreateBucketWithKey(name string, key encoding.BinaryMarshaler, value encoding.BinaryMarshaler)

CreateBucketWithKey add a bucket with the given name to the database. The bucket contains the passed key with the passed value.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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