facade

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package facade provide interfaces for FDB APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNilDirectory

func NewNilDirectory() directory.Directory

NewNilDirectory returns a nil implementation of directory.Directory where every operation is a no-op.

func NewNilDirectorySubspace

func NewNilDirectorySubspace() directory.DirectorySubspace

NewNilDirectorySubspace returns a nil implementation of directory.DirectorySubspace where every operation is a no-op.

func NewNilExactRange

func NewNilExactRange() fdb.ExactRange

NewNilExactRange returns a nil implementation of fdb.ExactRange where every operation is a no-op.

func NewNilFuture

func NewNilFuture() fdb.Future

NewNilFuture returns a nil implementation of fdb.Future where every operation is a no-op.

func NewNilFutureByteSlice

func NewNilFutureByteSlice() fdb.FutureByteSlice

NewNilFutureByteSlice returns a nil implementation of fdb.FutureByteSlice where every operation is a no-op.

func NewNilKeyConvertible

func NewNilKeyConvertible() fdb.KeyConvertible

NewNilKeyConvertible returns a nil implementation of fdb.KeyConvertible where every operation is a no-op.

func NewNilRange

func NewNilRange() fdb.Range

NewNilRange returns a nil implementation of fdb.Range where every operation is a no-op.

func NewNilSelectable

func NewNilSelectable() fdb.Selectable

NewNilSelectable returns a nil implementation of fdb.Selectable where every operation is a no-op.

func NewNilSubspace

func NewNilSubspace() subspace.Subspace

NewNilSubspace returns a nil implementation of subspace.Subspace where every operation is a no-op.

Types

type ReadTransaction

type ReadTransaction interface {
	ReadTransactor

	// Get requests the values bytes for the given key.
	Get(key fdb.KeyConvertible) fdb.FutureByteSlice

	// GetRange performs a range-read over the given range.
	GetRange(r fdb.Range, options fdb.RangeOptions) fdb.RangeResult
}

ReadTransaction provides methods for reading key-values from an open transaction.

func NewNilReadTransaction

func NewNilReadTransaction() ReadTransaction

NewNilReadTransaction returns a nil implementation of ReadTransaction where every operation is a no-op.

func NewReadTransaction

func NewReadTransaction(tr fdb.ReadTransaction, root directory.Directory) ReadTransaction

NewReadTransaction creates a new instance of a ReadTransaction backed by a fdb.ReadTransaction. Any directory operations performed by the returned ReadTransaction will use the given directory.Directory as the root.

type ReadTransactor

type ReadTransactor interface {
	// ReadTransact opens a new transaction. If this ReadTransactor is backed by a
	// transaction then that transaction is reused.
	ReadTransact(func(ReadTransaction) (interface{}, error)) (interface{}, error)

	// DirOpen opens a directory under the root directory specified by the
	// implementation.
	DirOpen(path []string) (directory.DirectorySubspace, error)

	// DirList lists the directories under the root directory specified by
	// the implementation.
	DirList(path []string) ([]string, error)
}

ReadTransactor provides methods for performing read transactions and for opening & listing directories.

func NewNilReadTransactor

func NewNilReadTransactor() ReadTransactor

NewNilReadTransactor returns a nil implementation of ReadTransactor where every operation is a no-op.

func NewReadTransactor

func NewReadTransactor(tr fdb.ReadTransactor, root directory.Directory) ReadTransactor

NewReadTransactor creates a new instance of a ReadTransactor backed by a fdb.ReadTransactor. Any directory operations performed by the returned ReadTransactor will use the given directory.Directory as the root.

type Transaction

type Transaction interface {
	ReadTransaction
	Transactor

	// Set writes a key-value.
	Set(fdb.KeyConvertible, []byte)

	// Clear deletes a key-value.
	Clear(fdb.KeyConvertible)
}

Transaction provides methods for reading or writing key-values from an open transaction.

func NewNilTransaction

func NewNilTransaction() Transaction

NewNilTransaction returns a nil implementation of Transaction where every operation is a no-op.

func NewTransaction

func NewTransaction(tr fdb.Transaction, root directory.Directory) Transaction

NewTransaction creates a new instance of a Transaction backed by a fdb.Transaction. Any directory operations performed by the returned Transaction will use the given directory.Directory as the root.

type Transactor

type Transactor interface {
	ReadTransactor

	// Transact opens a new transaction. If this Transactor is backed by a
	// transaction then that transaction is reused.
	Transact(func(Transaction) (interface{}, error)) (interface{}, error)

	// DirCreateOrOpen opens a directory (or creates it if it doesn't exist)
	// under the root directory specified by the implementation.
	DirCreateOrOpen(path []string) (directory.DirectorySubspace, error)
}

Transactor provides methods for performing read or write transactions and for creating, opening, & listing directories.

func NewNilTransactor

func NewNilTransactor() Transactor

NewNilTransactor returns a nil implementation of Transactor where every operation is a no-op.

func NewTransactor

func NewTransactor(tr fdb.Transactor, root directory.Directory) Transactor

NewTransactor creates a new instance of a Transactor backed by a fdb.Transactor. Any directory operations performed by the returned Transactor will use the given directory.Directory as the root.

Jump to

Keyboard shortcuts

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