Documentation ¶
Index ¶
- Constants
- Variables
- type Info
- type LoopServer
- func (s *LoopServer) AttachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *LoopServer) CreateVolume(ctx context.Context, az string, volSizeGB int64) (volID string, err error)
- func (s *LoopServer) DeleteVolume(ctx context.Context, volID string) error
- func (s *LoopServer) DetachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *LoopServer) GetControlDBDeviceName() string
- func (s *LoopServer) GetFirstDeviceName() string
- func (s *LoopServer) GetNextDeviceName(lastDev string) (devName string, err error)
- func (s *LoopServer) GetVolumeInfo(ctx context.Context, volID string) (info VolumeInfo, err error)
- func (s *LoopServer) GetVolumeState(ctx context.Context, volID string) (state string, err error)
- func (s *LoopServer) WaitVolumeAttached(ctx context.Context, volID string) error
- func (s *LoopServer) WaitVolumeCreated(ctx context.Context, volID string) error
- func (s *LoopServer) WaitVolumeDetached(ctx context.Context, volID string) error
- type MemServer
- func (s *MemServer) AttachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *MemServer) CreateVolume(ctx context.Context, az string, volSizeGB int64) (volID string, err error)
- func (s *MemServer) DeleteVolume(ctx context.Context, volID string) error
- func (s *MemServer) DetachVolume(ctx context.Context, volID string, instanceID string, devName string) error
- func (s *MemServer) GetControlDBDeviceName() string
- func (s *MemServer) GetFirstDeviceName() string
- func (s *MemServer) GetNextDeviceName(lastDev string) (devName string, err error)
- func (s *MemServer) GetVolumeInfo(ctx context.Context, volID string) (info VolumeInfo, err error)
- func (s *MemServer) GetVolumeState(ctx context.Context, volID string) (state string, err error)
- func (s *MemServer) WaitVolumeAttached(ctx context.Context, volID string) error
- func (s *MemServer) WaitVolumeCreated(ctx context.Context, volID string) error
- func (s *MemServer) WaitVolumeDetached(ctx context.Context, volID string) error
- type MockServerInfo
- func (m *MockServerInfo) GetLocalAvailabilityZone() string
- func (m *MockServerInfo) GetLocalInstanceID() string
- func (m *MockServerInfo) GetLocalRegion() string
- func (m *MockServerInfo) GetLocalRegionAZs() []string
- func (m *MockServerInfo) GetLocalVpcID() string
- func (m *MockServerInfo) GetPrivateIP() string
- type Server
- type VolumeInfo
Constants ¶
View Source
const ( VolumeStateCreating = "creating" VolumeStateAvailable = "available" VolumeStateInUse = "in-use" VolumeStateDetaching = "detaching" VolumeStateAttaching = "attaching" VolumeStateDeleting = "deleting" VolumeStateDeleted = "deleted" VolumeStateError = "error" VolumeTypeHDD = "standard" VolumeTypeGPSSD = "gp2" VolumeTypeIOPSSSD = "io1" )
http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volumes.html EBS volume has 2 states, The status of the volume (creating | available | in-use | deleting | deleted | error). The attachment state (attaching | attached | detaching | detached). The attachment state would be returned when volume status is in-use. Q: when will the attachment state be detached? After detached, volume status should be available.
View Source
const LoopDevPrefix = "/dev/loop"
View Source
const LoopFileDir = "/tmp/"
Variables ¶
View Source
var ( ErrVolumeIncorrectState = errors.New("IncorrectState") ErrVolumeInUse = errors.New("VolumeInUse") )
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info interface { GetPrivateIP() string GetLocalAvailabilityZone() string GetLocalRegion() string GetLocalInstanceID() string GetLocalVpcID() string GetLocalRegionAZs() []string }
Info defines the operations for the local server related info
type LoopServer ¶
type LoopServer struct {
// contains filtered or unexported fields
}
func NewLoopServer ¶
func NewLoopServer() *LoopServer
func (*LoopServer) AttachVolume ¶
func (*LoopServer) CreateVolume ¶
func (*LoopServer) DeleteVolume ¶
func (s *LoopServer) DeleteVolume(ctx context.Context, volID string) error
func (*LoopServer) DetachVolume ¶
func (*LoopServer) GetControlDBDeviceName ¶
func (s *LoopServer) GetControlDBDeviceName() string
func (*LoopServer) GetFirstDeviceName ¶
func (s *LoopServer) GetFirstDeviceName() string
func (*LoopServer) GetNextDeviceName ¶
func (s *LoopServer) GetNextDeviceName(lastDev string) (devName string, err error)
func (*LoopServer) GetVolumeInfo ¶
func (s *LoopServer) GetVolumeInfo(ctx context.Context, volID string) (info VolumeInfo, err error)
func (*LoopServer) GetVolumeState ¶
func (*LoopServer) WaitVolumeAttached ¶
func (s *LoopServer) WaitVolumeAttached(ctx context.Context, volID string) error
func (*LoopServer) WaitVolumeCreated ¶
func (s *LoopServer) WaitVolumeCreated(ctx context.Context, volID string) error
func (*LoopServer) WaitVolumeDetached ¶
func (s *LoopServer) WaitVolumeDetached(ctx context.Context, volID string) error
type MemServer ¶
type MemServer struct {
// contains filtered or unexported fields
}
func NewMemServer ¶
func NewMemServer() *MemServer
func (*MemServer) AttachVolume ¶
func (*MemServer) CreateVolume ¶
func (*MemServer) DeleteVolume ¶
func (*MemServer) DetachVolume ¶
func (*MemServer) GetControlDBDeviceName ¶
func (*MemServer) GetFirstDeviceName ¶
func (*MemServer) GetNextDeviceName ¶
func (*MemServer) GetVolumeInfo ¶
func (*MemServer) GetVolumeState ¶
func (*MemServer) WaitVolumeAttached ¶
func (*MemServer) WaitVolumeCreated ¶
type MockServerInfo ¶
type MockServerInfo struct { }
func NewMockServerInfo ¶
func NewMockServerInfo() *MockServerInfo
func (*MockServerInfo) GetLocalAvailabilityZone ¶
func (m *MockServerInfo) GetLocalAvailabilityZone() string
func (*MockServerInfo) GetLocalInstanceID ¶
func (m *MockServerInfo) GetLocalInstanceID() string
func (*MockServerInfo) GetLocalRegion ¶
func (m *MockServerInfo) GetLocalRegion() string
func (*MockServerInfo) GetLocalRegionAZs ¶
func (m *MockServerInfo) GetLocalRegionAZs() []string
func (*MockServerInfo) GetLocalVpcID ¶
func (m *MockServerInfo) GetLocalVpcID() string
func (*MockServerInfo) GetPrivateIP ¶
func (m *MockServerInfo) GetPrivateIP() string
type Server ¶
type Server interface { AttachVolume(ctx context.Context, volID string, instanceID string, devName string) error WaitVolumeAttached(ctx context.Context, volID string) error GetVolumeState(ctx context.Context, volID string) (state string, err error) GetVolumeInfo(ctx context.Context, volID string) (info VolumeInfo, err error) DetachVolume(ctx context.Context, volID string, instanceID string, devName string) error WaitVolumeDetached(ctx context.Context, volID string) error CreateVolume(ctx context.Context, az string, volSizeGB int64) (volID string, err error) WaitVolumeCreated(ctx context.Context, volID string) error DeleteVolume(ctx context.Context, volID string) error GetControlDBDeviceName() string GetFirstDeviceName() string GetNextDeviceName(lastDev string) (devName string, err error) }
Server defines the volume and device related operations for one host such as EC2
Click to show internal directories.
Click to hide internal directories.