Documentation ¶
Overview ¶
Package database collects database related types, interfaces and implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { CreateDatabase(database string, model ovsdb.DatabaseSchema) error Exists(database string) bool NewTransaction(database string) Transaction Commit(database string, id uuid.UUID, update Update) error CheckIndexes(database string, table string, m model.Model) error List(database, table string, conditions ...ovsdb.Condition) (map[string]model.Model, error) Get(database, table string, uuid string) (model.Model, error) GetReferences(database, table, row string) (References, error) }
Database abstracts a database that a server can use to store and transact data
type Reference ¶
Reference maps the UUIDs of rows to which the reference is made to the rows it is made from
type ReferenceSpec ¶
type ReferenceSpec struct { // ToTable is the table of the row to which the reference is made ToTable string // FromTable is the table of the row from which the reference is made FromTable string // FromColumn is the column of the row from which the reference is made FromColumn string // FromValue flags if the reference is made on a map key or map value when // the column is a map FromValue bool }
ReferenceSpec specifies details about where in the schema a reference occurs.
type References ¶
type References map[ReferenceSpec]Reference
References tracks the references to rows from other rows at specific locations in the schema.
func (References) GetReferences ¶
func (rs References) GetReferences(table, uuid string) References
GetReferences gets references to a row
func (References) UpdateReferences ¶
func (rs References) UpdateReferences(other References)
UpdateReferences updates the references with the provided ones. Dangling references, that is, the references of rows that are no longer referenced from anywhere, are cleaned up.
type Transaction ¶
type Transaction interface {
Transact(operations ...ovsdb.Operation) ([]*ovsdb.OperationResult, Update)
}
Transaction abstracts a database transaction that can generate database updates
type Update ¶
type Update interface { GetUpdatedTables() []string ForEachModelUpdate(table string, do func(uuid string, old, new model.Model) error) error ForEachRowUpdate(table string, do func(uuid string, row ovsdb.RowUpdate2) error) error ForReferenceUpdates(do func(references References) error) error }
Update abstracts an update that can be committed to a database
Directories ¶
Path | Synopsis |
---|---|
Package inmemory provides a in-memory database implementation
|
Package inmemory provides a in-memory database implementation |
Package transaction provides a transaction implementation
|
Package transaction provides a transaction implementation |