Documentation
¶
Index ¶
- func ClientFilterAll(ci ClientInfo) bool
- func VolumeFilterAll(v Volume) bool
- type Backend
- type ClientFilterFunc
- type ClientInfo
- type ClientInterface
- type ClientStatus
- type LeaseInterface
- type Notification
- type NotificationType
- type ResourceManager
- type Server
- func (s *Server) Acknowledge(ctx context.Context, msg *svc.Acknowledgement) (*svc.Empty, error)
- func (s *Server) AddVolume(ctx context.Context, volume *svc.Volume) (*svc.Volume, error)
- func (s *Server) DeleteVolume(ctx context.Context, volumeID *svc.VolumeID) (*svc.Empty, error)
- func (s *Server) Deregister(ctx context.Context, req *svc.DeregisterMessage) (*svc.Empty, error)
- func (s *Server) GetVolume(ctx context.Context, volumeID *svc.VolumeID) (*svc.Volume, error)
- func (s *Server) Heartbeat(ctx context.Context, m *svc.HeartbeatMessage) (*svc.HeartbeatResponse, error)
- func (s *Server) Init()
- func (s *Server) ListClients(ctx context.Context, m *svc.Empty) (*svc.ClientList, error)
- func (s *Server) ListLeases(ctx context.Context, e *svc.Empty) (*svc.LeaseList, error)
- func (s *Server) ListVolumes(ctx context.Context, e *svc.Empty) (*svc.VolumeList, error)
- func (s *Server) Prune()
- func (s *Server) Register(ctx context.Context, req *svc.RegisterMessage) (*svc.Empty, error)
- func (s *Server) SubmitLeaseRequest(ctx context.Context, request *svc.LeaseRequest) (*svc.Empty, error)
- func (s *Server) UpdateVolume(ctx context.Context, volume *svc.Volume) (*svc.Volume, error)
- func (s *Server) WatchNotifications(msg *svc.NotificationWatchMessage, ...) error
- type Volume
- type VolumeFilterFunc
- type VolumeInterface
- type VolumeStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
type Backend interface { ClientInterface LeaseInterface VolumeInterface }
Backend defines functions implemented by the data store
type ClientFilterFunc ¶
type ClientFilterFunc func(ClientInfo) bool
ClientFilterFunc is a function to filter a list of clients based on a given condition
func ClientFilterByStatus ¶
func ClientFilterByStatus(status ClientStatus) ClientFilterFunc
ClientFilterByStatus returns clients that match a given status
type ClientInfo ¶
ClientInfo details information about a given client
type ClientInterface ¶
type ClientInterface interface { GetClient(string) (ClientInfo, error) AddClient(string) error UpdateClient(string, ClientStatus) error RemoveClient(string) error Clients(ClientFilterFunc) ([]ClientInfo, error) WriteNotification(string, Notification) error WatchNotifications(string, chan<- Notification) error AckNotification(string) error WatchNotification(string) (chan struct{}, error) }
ClientInterface defines functions for managing clients
type ClientStatus ¶
type ClientStatus int
ClientStatus describes client's current status
const ( // UnknownClientStatus indicates the client status is unknown UnknownClientStatus ClientStatus = iota // AliveClientStatus indicates the client is alive AliveClientStatus // DeadClientStatus indicate the client is dead/unresponsive DeadClientStatus // LeftClientStatus indicates the client intentionally left LeftClientStatus )
type LeaseInterface ¶
type LeaseInterface interface { ListLeaseRequests(lease.LeaseRequestFilterFunc) ([]*lease.LeaseRequest, error) AddLeaseRequest(*lease.LeaseRequest) error UpdateLeaseRequest(*lease.LeaseRequest) error DeleteLeaseRequest(string) error AddLease(*lease.Lease) error ListLeases(lease.LeaseFilterFunc) ([]*lease.Lease, error) UpdateLease(*lease.Lease) error DeleteLease(string) error }
LeaseInterface defines functions for managing volume leases
type Notification ¶
type Notification struct { ID string Type NotificationType Message string }
Notification is a message to be passed to the client
func NewNotification ¶
func NewNotification(t NotificationType, message string) Notification
NewNotification returns a new Notification with a given type and message
type NotificationType ¶
type NotificationType int
NotificationType defines the type of notification sent to the client during streaming
const ( // UnknownNotificationType is a base value UnknownNotificationType NotificationType = iota // LeaseRequestAckNotificationType is an acknowledgement of receipt of a LeaseRequest submission LeaseRequestAckNotificationType // LeaseRequestExpiredNotificationType is an announcement that a lease request has expired // and needs to be renwed LeaseRequestExpiredNotificationType // LeaseAvailableNotificationType is an announcement that a lease is available for a given volume LeaseAvailableNotificationType // LeaseNotificationType is an announcement that a lease has been allocated to a client LeaseNotificationType )
type ResourceManager ¶
ResourceManager is responsible for managing the underlying resource represented by a Volume, with a given client
type Server ¶
type Server struct { svc.UnimplementedVolchestratorServer svc.UnimplementedVolchestratorAdminServer // contains filtered or unexported fields }
Server interacts with clients to manage volume leases
func NewServer ¶
func NewServer(b Backend, r ResourceManager) *Server
NewServer creates a new Server with a given Backend
func (*Server) Acknowledge ¶
Acknowledge handles an acknowledgement from the client of a Notification
func (*Server) DeleteVolume ¶
DeleteVolume deletes a volume from the backend
func (*Server) Deregister ¶
Deregister removes a clients and all its elements
func (*Server) GetVolume ¶
GetVolume returns a Volume for a given ID, or nil if the volume ID is not found in the backend
func (*Server) Heartbeat ¶
func (s *Server) Heartbeat(ctx context.Context, m *svc.HeartbeatMessage) (*svc.HeartbeatResponse, error)
Heartbeat handles client HeartbeatMessages
func (*Server) ListClients ¶
ListClients returns the ClientMap info
func (*Server) ListLeases ¶
ListLeases returns all Leases in the backend
func (*Server) ListVolumes ¶
ListVolumes returns all volumes currently in the backend
func (*Server) SubmitLeaseRequest ¶
func (s *Server) SubmitLeaseRequest(ctx context.Context, request *svc.LeaseRequest) (*svc.Empty, error)
SubmitLeaseRequest adds a LeaseRequest to the backend
func (*Server) UpdateVolume ¶
UpdateVolume performs an in-place update of an existing volume in the backend
func (*Server) WatchNotifications ¶
func (s *Server) WatchNotifications(msg *svc.NotificationWatchMessage, stream svc.Volchestrator_WatchNotificationsServer) error
WatchNotifications is called for a client to watch notifications
type Volume ¶
type Volume struct { ID string Tags []string AvailabilityZone string Status VolumeStatus }
Volume represents a definition of an EBS volume in the data store
type VolumeFilterFunc ¶
VolumeFilterFunc is a function to filter a list of Volumes based on a given condition
func VolumeFilterByStatus ¶
func VolumeFilterByStatus(status VolumeStatus) VolumeFilterFunc
VolumeFilterByStatus returns volumes with a status of AvailableVolumeStatus
type VolumeInterface ¶
type VolumeInterface interface { GetVolume(string) (*Volume, error) ListVolumes(VolumeFilterFunc) ([]*Volume, error) AddVolume(*Volume) error UpdateVolume(*Volume) error DeleteVolume(string) error }
VolumeInterface defines functions for managing volumes
type VolumeStatus ¶
type VolumeStatus int
VolumeStatus describes a volume's current status
const ( // UnknownVolumeStatus indicates the volume status is unknown UnknownVolumeStatus VolumeStatus = iota // AvailableVolumeStatus indicates the volume is available for leasing AvailableVolumeStatus // LeasePendingVolumeStatus indicates the volume is pending a lease acquisition from a client LeasePendingVolumeStatus // LeasedVolumeStatus indicates the volume is currently leased by a client LeasedVolumeStatus )