localdb

package
v0.0.0-...-e5d9080 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTxClosed = errors.New("transaction closed")
)

Functions

This section is empty.

Types

type Storage

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

Storage is an implementation of a nameql.Backend interface that performs management of zones and resource records. The Storage utilize file-based storage to keep the data persisted on disk.

func NewStorage

func NewStorage(path string) (*Storage, error)

NewStorage creates a new instance of storage for the given path.

Method returns an error when file system is unavailable for more than 1 second.

func (*Storage) Close

func (s *Storage) Close(ctx context.Context) error

Close closes the storage.

func (*Storage) CreateRecord

func (s *Storage) CreateRecord(ctx context.Context, input ns.RecordInput) (
	record *ns.Record, err error,
)

CreateRecord creates a new record within a specified zone, puts resource record information into the separate bucket.

The method works in append-only format, does not support replacement operation.

func (*Storage) CreateZone

func (s *Storage) CreateZone(ctx context.Context, input ns.ZoneInput) (
	zone *ns.Zone, err error,
)

CreateZone creates a new bucket with the specified zone name and puts zone information into the $ORIGIN key.

func (*Storage) OpenReadTransaction

func (s *Storage) OpenReadTransaction(
	ctx context.Context, fn func(ctx context.Context) error,
) error

func (*Storage) OpenWriteTransaction

func (s *Storage) OpenWriteTransaction(
	ctx context.Context, fn func(ctx context.Context) error,
) error

func (*Storage) QueryRecord

func (s *Storage) QueryRecord(ctx context.Context, input struct {
	ZoneName string
	ID       uint64
}) (record *ns.Record, err error)

QueryRecord attempts to find a record in a specified Zone with the ID.

func (*Storage) QueryRecords

func (s *Storage) QueryRecords(ctx context.Context, input struct {
	ZoneName string
}) ([]ns.Record, error)

func (*Storage) QueryZone

func (s *Storage) QueryZone(ctx context.Context, input struct{ Name string }) (*ns.Zone, error)

QueryZone attempts to find a zone by it's name.

func (*Storage) QueryZones

func (s *Storage) QueryZones(ctx context.Context) (zones []ns.Zone, err error)

Jump to

Keyboard shortcuts

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