Documentation
¶
Overview ¶
Package driver defines the interface for Protavo drivers. This package is primarily used by driver implementors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Delete ¶
Delete is a request to delete a document.
func (*Delete) ExecuteInWriteTx ¶
ExecuteInWriteTx executes this operation within the context of tx.
func (*Delete) MarkExecuted ¶
func (o *Delete) MarkExecuted(err error)
type DeleteNamespace ¶
type DeleteNamespace struct { Documents []*document.Document // contains filtered or unexported fields }
DeleteNamespace is a request to delete an entire namespace.
func (*DeleteNamespace) ExecuteInWriteTx ¶
func (o *DeleteNamespace) ExecuteInWriteTx(ctx context.Context, tx WriteTx)
ExecuteInWriteTx executes this operation within the context of tx.
func (*DeleteNamespace) MarkExecuted ¶
func (o *DeleteNamespace) MarkExecuted(err error)
type DeleteWhere ¶
type DeleteWhere struct { Each DeleteWhereFunc Filter *filter.Filter // contains filtered or unexported fields }
DeleteWhere is a request to delete one or more documents, without checking the current document revisions.
func (*DeleteWhere) ExecuteInWriteTx ¶
func (o *DeleteWhere) ExecuteInWriteTx(ctx context.Context, tx WriteTx)
ExecuteInWriteTx executes this operation within the context of tx.
func (*DeleteWhere) MarkExecuted ¶
func (o *DeleteWhere) MarkExecuted(err error)
type DeleteWhereFunc ¶
DeleteWhereFunc is a function that is invoked for each document deleted in a delete-where operation.
The delete operation is aborted if it returns a non-nil error.
type Driver ¶
type Driver interface { // BeginRead starts a new read-only transaction. BeginRead(ctx context.Context, ns string) (ReadTx, error) // BeginWrite starts a new read/write transaction. BeginWrite(ctx context.Context, ns string) (WriteTx, error) // Close closes the driver, freeing any resources and preventing further // operations. Close() error }
Driver is an interface for performing operations on a data store.
type Fetch ¶
type Fetch struct { Each FetchFunc Filter *filter.Filter // contains filtered or unexported fields }
Fetch is a request to retrieve documents from the store.
func (*Fetch) ExecuteInReadTx ¶
ExecuteInReadTx executes this operation within the context of tx.
func (*Fetch) ExecuteInWriteTx ¶
ExecuteInWriteTx executes this operation within the context of tx.
func (*Fetch) MarkExecuted ¶
func (o *Fetch) MarkExecuted(err error)
type FetchFunc ¶
FetchFunc is a function that is invoked for each document found in a fetch operation.
The fetch operation is ended if it returns false or a non-nil error.
type NoOpCloser ¶
type NoOpCloser struct {
Driver
}
NoOpCloser is a Driver decoarator that prevents calls to Close() from reaching the underlying driver.
type Operation ¶
type Operation interface { // Err returns the error that occurred when the operation was executed, if any. // It panics if the operation has not yet been executed. Err() error // MarkExecuted is called by driver implementors to indicate the result of the // operation. MarkExecuted(err error) // ExecuteInWriteTx executes the operation within the context of a write // transaction. ExecuteInWriteTx(ctx context.Context, tx WriteTx) }
Operation is a database operation that can be performed within a transaction.
type ReadOnlyOperation ¶
type ReadOnlyOperation interface { Operation // ExecuteInReadTx executes the operation within the context of a read // transaction. ExecuteInReadTx(ctx context.Context, tx ReadTx) }
ReadOnlyOperation is an operation that can be performed inside transactions that support reading.
type Save ¶
type Save struct { Document *document.Document Force bool // contains filtered or unexported fields }
Save is a request to save a document.
func (*Save) ExecuteInWriteTx ¶
ExecuteInWriteTx executes this operation within the context of tx.
func (*Save) MarkExecuted ¶
func (o *Save) MarkExecuted(err error)
type WriteTx ¶
type WriteTx interface { ReadTx Save(ctx context.Context, op *Save) Delete(ctx context.Context, op *Delete) DeleteWhere(ctx context.Context, op *DeleteWhere) DeleteNamespace(ctx context.Context, op *DeleteNamespace) Commit() error }
WriteTx is a transaction that can read and modify the database.
Directories
¶
Path | Synopsis |
---|---|
Package drivertest provides a reusable functional test suite for driver implementors.
|
Package drivertest provides a reusable functional test suite for driver implementors. |