Documentation ¶
Index ¶
- Variables
- type InMemoryVolumeDatabase
- func (i InMemoryVolumeDatabase) Connect() error
- func (i InMemoryVolumeDatabase) Create(volumeName string, options map[string]string) error
- func (i InMemoryVolumeDatabase) Disconnect() error
- func (i InMemoryVolumeDatabase) Get(volumeName string) (*volume.Volume, error)
- func (i InMemoryVolumeDatabase) List() ([]*volume.Volume, error)
- func (i InMemoryVolumeDatabase) Mount(volumeName string, id string, mountpoint string) error
- func (i InMemoryVolumeDatabase) Path(volumeName string) (string, error)
- func (i InMemoryVolumeDatabase) Remove(volumeName string) error
- func (i InMemoryVolumeDatabase) Unmount(volumeName string, id string) error
- type SQLVolumeDatabase
- func (s SQLVolumeDatabase) Connect() error
- func (s SQLVolumeDatabase) Create(volumeName string, options map[string]string) error
- func (s SQLVolumeDatabase) Disconnect() error
- func (s SQLVolumeDatabase) Get(volumeName string) (*volume.Volume, error)
- func (s SQLVolumeDatabase) List() ([]*volume.Volume, error)
- func (s SQLVolumeDatabase) Mount(volumeName string, id string, mointpoint string) error
- func (s SQLVolumeDatabase) Path(volumeName string) (string, error)
- func (s SQLVolumeDatabase) Remove(volumeName string) error
- func (s SQLVolumeDatabase) Unmount(volumeName string, id string) error
- func (s SQLVolumeDatabase) VerifyOrCrash() error
- type VolumeDatabase
- type VolumeDatabaseQueries
Constants ¶
This section is empty.
Variables ¶
var DefaultSQLQueries = VolumeDatabaseQueries{ // contains filtered or unexported fields }
DefaultSQLQueries stores the default SQL functions for sqldbs to use.
var SQLiteSQLOverrides = VolumeDatabaseQueries{ // contains filtered or unexported fields }
SQLiteSQLOverrides defines a list of qurries that need to differ from the defaults in order for sqlite to function correctly.
Functions ¶
This section is empty.
Types ¶
type InMemoryVolumeDatabase ¶
type InMemoryVolumeDatabase struct {
// contains filtered or unexported fields
}
InMemoryVolumeDatabase defines a volume database that is completely in memory (and ephimeral)
func NewInMemoryVolumeDatabase ¶
func NewInMemoryVolumeDatabase() InMemoryVolumeDatabase
NewInMemoryVolumeDatabase creates a new InMemoryVolumeDatabase, inilizing all of its properties.
func (InMemoryVolumeDatabase) Connect ¶
func (i InMemoryVolumeDatabase) Connect() error
Connect is a NOP, though required by VolumeDatabase interface
func (InMemoryVolumeDatabase) Create ¶
func (i InMemoryVolumeDatabase) Create(volumeName string, options map[string]string) error
Create a new volume in the database, returning an error if one occured.
func (InMemoryVolumeDatabase) Disconnect ¶
func (i InMemoryVolumeDatabase) Disconnect() error
Disconnect is a NOP, though required by VolumeDatabase interface
func (InMemoryVolumeDatabase) Get ¶
func (i InMemoryVolumeDatabase) Get(volumeName string) (*volume.Volume, error)
Get the volume definiton from the database by name, returning an error if one occured.
func (InMemoryVolumeDatabase) List ¶
func (i InMemoryVolumeDatabase) List() ([]*volume.Volume, error)
List all of the volumes in the database, returning an error if one occured.
func (InMemoryVolumeDatabase) Mount ¶
func (i InMemoryVolumeDatabase) Mount(volumeName string, id string, mountpoint string) error
Mount the specified volume to the host and increment the id to prevent premature removal, returning an error if one occured.
func (InMemoryVolumeDatabase) Path ¶
func (i InMemoryVolumeDatabase) Path(volumeName string) (string, error)
Path of the specified volume, returning an error if one occured.
func (InMemoryVolumeDatabase) Remove ¶
func (i InMemoryVolumeDatabase) Remove(volumeName string) error
Remove (delete) the specified volume, returning an error if one occured.
type SQLVolumeDatabase ¶
type SQLVolumeDatabase struct { DBType string DBDataSource string DBQueries VolumeDatabaseQueries }
SQLVolumeDatabase defines a volume database that uses a sqlite database.
func NewMySQLVolumeDatabase ¶
func NewMySQLVolumeDatabase(host string, username string, password string, schema string) (SQLVolumeDatabase, error)
NewMySQLVolumeDatabase creates a new SQLVolumeDatabase, connectiong to a mysql host.
func NewSQLVolumeDatabase ¶
func NewSQLVolumeDatabase(dbType string, dbDataSource string, dbQueries VolumeDatabaseQueries) SQLVolumeDatabase
NewSQLVolumeDatabase creates a new SQLVolumeDatabase, saving the database at dbPath. Overide default sql queries by passing a VolumeDatabaseQueries object. Non-nil fields will be be used instead of the defaults.
func NewSQLiteVolumeDatabase ¶
func NewSQLiteVolumeDatabase(dbPath string) SQLVolumeDatabase
NewSQLiteVolumeDatabase creates a new SQLVolumeDatabase, saving the database at dbPath.
func (SQLVolumeDatabase) Create ¶
func (s SQLVolumeDatabase) Create(volumeName string, options map[string]string) error
Create volume
func (SQLVolumeDatabase) Disconnect ¶
func (s SQLVolumeDatabase) Disconnect() error
Disconnect from database
func (SQLVolumeDatabase) Get ¶
func (s SQLVolumeDatabase) Get(volumeName string) (*volume.Volume, error)
Get information about a particular volue
func (SQLVolumeDatabase) List ¶
func (s SQLVolumeDatabase) List() ([]*volume.Volume, error)
List all volumes
func (SQLVolumeDatabase) Mount ¶
func (s SQLVolumeDatabase) Mount(volumeName string, id string, mointpoint string) error
Mount the volume with name and id
func (SQLVolumeDatabase) Path ¶
func (s SQLVolumeDatabase) Path(volumeName string) (string, error)
Path returns the mountpath of a particular volume
func (SQLVolumeDatabase) Remove ¶
func (s SQLVolumeDatabase) Remove(volumeName string) error
Remove (Delete) a volume from the database.
func (SQLVolumeDatabase) Unmount ¶
func (s SQLVolumeDatabase) Unmount(volumeName string, id string) error
Unmount volume with name and id
func (SQLVolumeDatabase) VerifyOrCrash ¶
func (s SQLVolumeDatabase) VerifyOrCrash() error
VerifyOrCrash if the database connection is not properly configured
type VolumeDatabase ¶
type VolumeDatabase interface { // Connect to the database, and create anything needed to process requests. // note: this function is run on the main thread, not a goroutine. Connect() error // Disconnect from the database, close any connections etc. Disconnect() error // Create volume by name and options. Create(volumeName string, options map[string]string) error // List all of the volumes that we know about. List() ([]*volume.Volume, error) // Get info about a particular volume. Get(volumeName string) (*volume.Volume, error) // Get the path of a particular volume. Path(volumeName string) (string, error) // Remove a particular volume. Remove(volumeName string) error // Mount a particular volume. Mount(volumeName string, id string, mountpoint string) error // Unmount a particular volume. Unmount(volumeName string, id string) error }
VolumeDatabase interface describes a connection to a database that is capable of keeping track of volumes and mounts
type VolumeDatabaseQueries ¶
type VolumeDatabaseQueries struct {
// contains filtered or unexported fields
}
VolumeDatabaseQueries is a struct that can contain queries for the volume database