dal

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrObjectNotFound is returned when there is no object found.
	ErrObjectNotFound = Error{objNotFound, "Object not found"}

	// ErrBucketNotFound returns the error that no bucket found.
	ErrBucketNotFound = Error{bucketNotFound, "Bucket not found"}
)

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Put write key-value into store.
	Put(bucket string, key string, value []byte) error

	// Get read object from store.
	Get(bucket string, key string) ([]byte, error)

	// Remove all data of the key.
	Remove(bucket string, key string) error

	// Truncate all data of the bucket.
	Truncate(bucket string) error

	// List return all objects with specify bucket.
	List(bucket string) ([][]byte, error)

	// Keys return all keys.
	Keys(bucket string) ([]string, error)

	// Path returns the path with the specified key.
	Path(key string) string

	// Close releases all resources used by the store
	// It does not make any changes to store.
	Close() error
}

Backend is an interface which describes what a store should support. All methods are thread-safe port from https://github.com/alibaba/pouch/blob/master/pkg/meta/backend.go

func NewBoltDB

func NewBoltDB(config common.ToodledoConfigDatabase) (Backend, error)

NewBoltDB is used to make bolt metadata store instance.

func ProvideBackend

func ProvideBackend(config common.ToodledoConfigDatabase) (Backend, error)

type Error

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

Error is a type of error used for meta.

func (Error) Error

func (e Error) Error() string

Error returns the message in MetaError.

func (Error) IsNotfound

func (e Error) IsNotfound() bool

IsNotfound return true if code in MetaError is objNotfound.

Jump to

Keyboard shortcuts

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