Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseIO ¶
type DatabaseIO interface { DatabaseRegistrar DatabaseOpener }
DatabaseIO captures all the input/output (IO) of the database in one logical interface.
type DatabaseOpener ¶
type DatabaseOpener interface { // Open opens a database specified by its database driver name and a // driver-specific data source name, usually consisting of at least a // database name and connection information. Open(driverName, dataSourceName string) (database.DB, error) }
DatabaseOpener represents a way to open a database source
type DatabaseRegistrar ¶
type DatabaseRegistrar interface { // Register makes a database driver available by the provided name. // If Register is called twice with the same name or if driver is nil, // it panics. Register(name string, driver driver.Driver) // Drivers returns a sorted list of the names of the registered drivers. Drivers() []string }
DatabaseRegistrar represents a way to register and un-register drivers with associated name.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a local node in a cluster
func New ¶
func New(fileSystem fsys.FileSystem) *Node
New creates a cluster ensuring that sane defaults are employed.
func (*Node) EnsureSchema ¶
EnsureSchema applies all relevant schema updates to the node-local database.
Return the initial schema version found before starting the update, along with any error occurred.
type Schema ¶
type Schema interface { // File extra queries from a file. If the file is exists, all SQL queries in it // will be executed transactionally at the very start of Ensure(), before // anything else is done. File(string) // Hook instructs the schema to invoke the given function whenever a update is // about to be applied. The function gets passed the update version number and // the running transaction, and if it returns an error it will cause the schema // transaction to be rolled back. Any previously installed hook will be // replaced. Hook(schema.Hook) // Ensure makes sure that the actual schema in the given database matches the // one defined by our updates. // // All updates are applied transactionally. In case any error occurs the // transaction will be rolled back and the database will remain unchanged. Ensure(database.DB) (int, error) }
Schema captures the schema of a database in terms of a series of ordered updates.
type SchemaProvider ¶
type SchemaProvider interface { // Schema creates a new Schema that captures the schema of a database in // terms of a series of ordered updates. Schema() Schema // Updates returns the schema updates that is required for the updating of // the database. Updates() []schema.Update }
SchemaProvider defines a factory for creating schemas