github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/storage/storage.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package storage
     5  
     6  import "gopkg.in/juju/names.v2"
     7  
     8  // StorageKind defines the type of the datastore: whether it
     9  // is a raw block device, or a filesystem.
    10  type StorageKind int
    11  
    12  const (
    13  	StorageKindUnknown StorageKind = iota
    14  	StorageKindBlock
    15  	StorageKindFilesystem
    16  )
    17  
    18  func (k StorageKind) String() string {
    19  	switch k {
    20  	case StorageKindBlock:
    21  		return "block"
    22  	case StorageKindFilesystem:
    23  		return "filesystem"
    24  	default:
    25  		return "unknown"
    26  	}
    27  }
    28  
    29  // StorageInstance describes a storage instance, assigned to a service or
    30  // unit.
    31  type StorageInstance struct {
    32  	// Tag is a unique tag assigned by Juju to the storage instance.
    33  	Tag names.StorageTag
    34  
    35  	// Kind is the kind of the datastore (block device, filesystem).
    36  	Kind StorageKind
    37  }
    38  
    39  // StorageAttachmentInfo provides unit-specific information about a storage
    40  // instance. StorageAttachmentInfo is based on either a volume attachment
    41  // or a filesystem attachment, depending on its kind.
    42  type StorageAttachmentInfo struct {
    43  	// Kind is the kind of the storage attachment.
    44  	Kind StorageKind
    45  
    46  	// Location is the storage attachment's location: the mount point
    47  	// for a filesystem-kind storage attachment, and the device path
    48  	// for a block-kind.
    49  	Location string
    50  }