Documentation ¶
Index ¶
- Variables
- func NewProvider(pspec *volume.ProviderSpec) (provider volume.Provider, err error)
- type Manager
- func (m *Manager) AddProvider(id string, p volume.Provider) error
- func (m *Manager) CloseDB() error
- func (m *Manager) CreateSnapshot(id string) (volume.Volume, error)
- func (m *Manager) DestroyVolume(id string) error
- func (m *Manager) ForkVolume(id string) (volume.Volume, error)
- func (m *Manager) GetVolume(id string) volume.Volume
- func (m *Manager) ImportFilesystem(providerID string, fs *volume.Filesystem) (volume.Volume, error)
- func (m *Manager) ListHaves(id string) ([]json.RawMessage, error)
- func (m *Manager) LockDB() error
- func (m *Manager) NewVolume(info *volume.Info) (volume.Volume, error)
- func (m *Manager) NewVolumeFromProvider(providerID string, info *volume.Info) (volume.Volume, error)
- func (m *Manager) OpenDB() error
- func (m *Manager) ReceiveSnapshot(id string, stream io.Reader) (volume.Volume, error)
- func (m *Manager) SendSnapshot(id string, haves []json.RawMessage, stream io.Writer) error
- func (m *Manager) Subscribe() chan *volume.Event
- func (m *Manager) UnlockDB()
- func (m *Manager) Unsubscribe(ch chan *volume.Event)
- func (m *Manager) Volumes() map[string]volume.Volume
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoSuchProvider = errors.New("no such provider") ErrProviderExists = errors.New("provider exists") ErrVolumeExists = errors.New("volume exists") )
var ErrDBClosed = errors.New("volume persistence db is closed")
Functions ¶
func NewProvider ¶
func NewProvider(pspec *volume.ProviderSpec) (provider volume.Provider, err error)
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
volume.Manager providers interfaces for both provisioning volume backends, and then creating volumes using them.
There is one volume.Manager per host daemon process.
func (*Manager) CloseDB ¶
CloseDB closes the persistence DB.
The DB mutex is locked to protect m.db, but also prevents closing the DB when it could still be needed to service API requests (see LockDB).
func (*Manager) DestroyVolume ¶
func (*Manager) ImportFilesystem ¶
func (*Manager) LockDB ¶
LockDB acquires a read lock on the DB mutex so that it cannot be closed until the caller has finished performing actions which will lead to changes being persisted to the DB.
For example, creating a volume first delegates to the provider to create the volume and then persists to the DB, but if the DB is closed in that time then the volume state will be lost.
ErrDBClosed is returned if the DB is already closed so API requests will fail before any actions are performed.
func (*Manager) NewVolume ¶
volume.Manager implements the volume.Provider interface by delegating NewVolume requests to the default Provider.
func (*Manager) NewVolumeFromProvider ¶
func (m *Manager) NewVolumeFromProvider(providerID string, info *volume.Info) (volume.Volume, error)
volume.Manager implements the volume.Provider interface by delegating NewVolume requests to the named Provider.
func (*Manager) ReceiveSnapshot ¶
func (*Manager) SendSnapshot ¶
func (*Manager) UnlockDB ¶
func (m *Manager) UnlockDB()
UnlockDB releases a read lock on the DB mutex, previously acquired by a call to LockDB.