fs

package
v0.0.0-...-ba1c585 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2017 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Implements a map-based store substitute that implements the legacy store API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRecursiveCreateTransaction = verror.Register(pkgPath+".ErrNoRecursiveCreateTransaction", verror.NoRetry, "{1:}{2:} recursive CreateTransaction() not permitted{:_}")
	ErrDoubleCommit                 = verror.Register(pkgPath+".ErrDoubleCommit", verror.NoRetry, "{1:}{2:} illegal attempt to commit previously committed or abandonned transaction{:_}")
	ErrAbortWithoutTransaction      = verror.Register(pkgPath+".ErrAbortWithoutTransaction", verror.NoRetry, "{1:}{2:} illegal attempt to abort non-existent transaction{:_}")
	ErrWithoutTransaction           = verror.Register(pkgPath+".ErrRemoveWithoutTransaction", verror.NoRetry, "{1:}{2:} call without a transaction{:_}")
	ErrNotInMemStore                = verror.Register(pkgPath+".ErrNotInMemStore", verror.NoRetry, "{1:}{2:} not in Memstore{:_}")
	ErrUnsupportedType              = verror.Register(pkgPath+".ErrUnsupportedType", verror.NoRetry, "{1:}{2:} attempted Put to Memstore of unsupported type{:_}")
	ErrChildrenWithoutLock          = verror.Register(pkgPath+".ErrChildrenWithoutLock", verror.NoRetry, "{1:}{2:} Children() without a lock{:_}")
)

Errors

Functions

This section is empty.

Types

type Memstore

type Memstore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Memstore contains the state of the memstore. It supports a single transaction at a time. The current state of a Memstore under a transactional name binding is the contents of puts then the contents of (data - removes). puts and removes will be empty at the beginning of a transaction and after an Unlock operation.

func NewMemstore

func NewMemstore(configuredPersistentFile string) (*Memstore, error)

NewMemstore persists the Memstore to os.TempDir() if no file is configured.

func (*Memstore) Abort

func (ms *Memstore) Abort(_ interface{}) error

func (*Memstore) BindObject

func (ms *Memstore) BindObject(path string) *boundObject

BindObject sets the path string for subsequent operations.

func (*Memstore) BindTransaction

func (ms *Memstore) BindTransaction(_ string) Transaction

BindTransaction on a Memstore can only use the single Memstore transaction.

func (*Memstore) BindTransactionRoot

func (ms *Memstore) BindTransactionRoot(_ string) Transaction

BindTransactionRoot on a Memstore always operates over the entire Memstore. As a result, the root parameter is ignored.

func (*Memstore) Commit

func (ms *Memstore) Commit(_ interface{}) error

Commit updates the store and persists the result.

func (*Memstore) CreateTransaction

func (ms *Memstore) CreateTransaction(_ interface{}) (string, error)

CreateTransaction requires the caller to acquire a lock on the Memstore.

func (*Memstore) Lock

func (ms *Memstore) Lock()

Lock acquires a lock and caches the state of the lock.

func (*Memstore) Unlock

func (ms *Memstore) Unlock()

Unlock abandons an in-progress transaction before releasing the lock.

type MemstoreObject

type MemstoreObject interface {
	Remove(_ interface{}) error
	Exists(_ interface{}) (bool, error)
}

type Transaction

type Transaction interface {
	CreateTransaction(_ interface{}) (string, error)
	Commit(_ interface{}) error
}

Jump to

Keyboard shortcuts

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