Documentation ¶
Overview ¶
Package storage contains the storage subsystem for the uniter, responding to changes in storage attachments (lifecycle, volume/filesystem details) by queuing hooks and managing the storage attachments' lifecycle.
Index ¶
- type Attachments
- func (a *Attachments) CommitHook(hi hook.Info) error
- func (a *Attachments) Empty() bool
- func (a *Attachments) Hooks() <-chan hook.Info
- func (a *Attachments) Pending() int
- func (a *Attachments) Refresh() error
- func (a *Attachments) SetDying() error
- func (a *Attachments) Stop() error
- func (a *Attachments) Storage(tag names.StorageTag) (jujuc.ContextStorageAttachment, bool)
- func (a *Attachments) UpdateStorage(tags []names.StorageTag) error
- func (a *Attachments) ValidateHook(hi hook.Info) error
- type StorageAccessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachments ¶
type Attachments struct {
// contains filtered or unexported fields
}
Attachments generates storage hooks in response to changes to storage attachments, and provides access to information about storage attachments to hooks.
func NewAttachments ¶
func NewAttachments( st StorageAccessor, tag names.UnitTag, storageStateDir string, abort <-chan struct{}, ) (*Attachments, error)
NewAttachments returns a new Attachments.
func (*Attachments) CommitHook ¶
func (a *Attachments) CommitHook(hi hook.Info) error
CommitHook persists the state change encoded in the supplied storage hook, or returns an error if the hook is invalid given current state.
func (*Attachments) Empty ¶
func (a *Attachments) Empty() bool
Empty reports whether or not there are any active storage attachments.
func (*Attachments) Hooks ¶
func (a *Attachments) Hooks() <-chan hook.Info
Hooks returns the channel on which storage hook execution requests are sent.
func (*Attachments) Pending ¶
func (a *Attachments) Pending() int
Pending reports the number of storage attachments whose hooks have yet to be run and committed.
func (*Attachments) Refresh ¶
func (a *Attachments) Refresh() error
Refresh fetches all of the unit's storage attachments and processes each one as in UpdateStorage.
func (*Attachments) SetDying ¶
func (a *Attachments) SetDying() error
SetDying ensures that any unprovisioned storage attachments are removed from state, and Pending is updated. After SetDying returns successfully, and once Pending returns zero and Empty returns true, there will be no remaining storage attachments.
func (*Attachments) Storage ¶
func (a *Attachments) Storage(tag names.StorageTag) (jujuc.ContextStorageAttachment, bool)
Storage returns the ContextStorage with the supplied tag if it was found, and whether it was found.
func (*Attachments) UpdateStorage ¶
func (a *Attachments) UpdateStorage(tags []names.StorageTag) error
UpdateStorage responds to changes in the lifecycle states of the storage attachments corresponding to the supplied storage tags, sending storage hooks on the channel returned by Hooks().
func (*Attachments) ValidateHook ¶
func (a *Attachments) ValidateHook(hi hook.Info) error
ValidateHook validates the hook against the current state.
type StorageAccessor ¶
type StorageAccessor interface { // WatchStorageAttachment starts a watcher for changes to the // storage attachment with the specified unit and storage tags. WatchStorageAttachment(names.StorageTag, names.UnitTag) (watcher.NotifyWatcher, error) // StorageAttachment returns details of the storage attachment // with the specified unit and storage tags. StorageAttachment(names.StorageTag, names.UnitTag) (params.StorageAttachment, error) // StorageAttachmentLife returns the lifecycle state of the specified // storage attachments. StorageAttachmentLife([]params.StorageAttachmentId) ([]params.LifeResult, error) // UnitStorageAttachments returns details of all of the storage // attachments for the unit with the specified tag. UnitStorageAttachments(names.UnitTag) ([]params.StorageAttachmentId, error) // DestroyUnitStorageAttachments ensures that all storage // attachments for the specified unit will be removed at // some point in the future. DestroyUnitStorageAttachments(names.UnitTag) error // RemoveStorageAttachment removes that the storage attachment // with the specified unit and storage tags. This method is only // expected to succeed if the storage attachment is Dead. RemoveStorageAttachment(names.StorageTag, names.UnitTag) error }
StorageAccessor is an interface for accessing information about storage attachments.