Documentation
¶
Index ¶
- type Builder
- type Event
- type EventReporter
- type EventType
- type ExitResult
- type Handle
- type Instance
- type InstanceConfig
- type InstanceEventPayload
- type InstanceGuestConfig
- type InstanceMetadata
- type InstanceNetwork
- type InstanceOptions
- type InstancePreparationFailedEventPayload
- type InstancePrepareEventPayload
- type InstanceStatus
- type InstanceStore
- type NetworkingConfig
- type NetworkingService
- type Origin
- type State
- type VM
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { PrepareInstance(ctx context.Context, instance *Instance, image client.Image) error BuildInstanceVM(ctx context.Context, instance *Instance) (VM, error) RecoverInstanceVM(ctx context.Context, instance *Instance) (VM, Handle, error) CleanupInstanceVM(ctx context.Context, instance *Instance) error CleanupInstance(ctx context.Context, instance *Instance) error }
type Event ¶
type Event struct { Event EventType `json:"event"` Payload InstanceEventPayload `json:"payload"` InstanceId string `json:"instance_id"` InstanceMetadata InstanceMetadata `json:"metadata"` Timestamp time.Time `json:"timestamp"` }
type EventReporter ¶
type EventReporter interface {
ReportInstanceEvent(event Event)
}
func NewNoopEventReporter ¶
func NewNoopEventReporter() EventReporter
type ExitResult ¶
type Instance ¶
type Instance struct { Id string `json:"id"` Metadata InstanceMetadata `json:"metadata"` Config InstanceConfig `json:"config"` ImageRef string `json:"image_ref"` Network NetworkingConfig `json:"network"` State State `json:"state"` CreatedAt time.Time `json:"created_at"` }
type InstanceConfig ¶
type InstanceConfig struct { Image string `json:"image"` Guest InstanceGuestConfig `json:"guest"` Init api.InitConfig `json:"init"` Stop *api.StopConfig `json:"stop,omitempty"` Env []string `json:"env"` }
type InstanceEventPayload ¶
type InstanceEventPayload struct {
Exited *ExitResult `json:"exited,omitempty"`
}
type InstanceGuestConfig ¶
type InstanceMetadata ¶
type InstanceNetwork ¶
type InstanceNetwork struct { Network networking.Network `json:"network"` InstanceIP net.IP `json:"instance_ip"` HostIP net.IP `json:"host_ip"` Gateway net.IP `json:"gateway"` Broadcast net.IP `json:"broadcast"` }
func GetLocalNetwork ¶
func GetLocalNetwork(netw networking.Network) InstanceNetwork
func (*InstanceNetwork) HostIPNet ¶
func (i *InstanceNetwork) HostIPNet() *net.IPNet
func (*InstanceNetwork) InstanceIPNet ¶
func (i *InstanceNetwork) InstanceIPNet() *net.IPNet
func (*InstanceNetwork) MarshalJSON ¶
func (i *InstanceNetwork) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*InstanceNetwork) UnmarshalJSON ¶
func (i *InstanceNetwork) UnmarshalJSON(bytes []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InstanceOptions ¶
type InstanceOptions struct { Id string `json:"id"` Metadata InstanceMetadata `json:"metadata"` Config InstanceConfig `json:"config"` }
type InstancePreparationFailedEventPayload ¶
type InstancePreparationFailedEventPayload struct {
Error string
}
type InstancePrepareEventPayload ¶
type InstancePrepareEventPayload struct {
Retries int `json:"retries"`
}
type InstanceStatus ¶
type InstanceStatus = string
const ( InstanceStatusCreated InstanceStatus = "created" InstanceStatusStopped InstanceStatus = "stopped" InstanceStatusStarting InstanceStatus = "starting" InstanceStatusRunning InstanceStatus = "running" InstanceStatusDestroying InstanceStatus = "destroying" InstanceStatusDestroyed InstanceStatus = "destroyed" )
type InstanceStore ¶
type NetworkingConfig ¶
type NetworkingConfig struct { TapDevice string `json:"tap_device"` Local InstanceNetwork `json:"local"` DefaultGateway net.IP `json:"default_gateway"` }
func (*NetworkingConfig) MarshalJSON ¶
func (n *NetworkingConfig) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*NetworkingConfig) UnmarshalJSON ¶
func (n *NetworkingConfig) UnmarshalJSON(bytes []byte) error
UnmarshalJSON implements json.Unmarshaler.
type NetworkingService ¶
type NetworkingService interface { EnsureInstanceNetwork(id string, config NetworkingConfig) error CleanupInstanceNetwork(id string, config NetworkingConfig) error }
type State ¶
type State struct { Status InstanceStatus `json:"status"` Stopping bool `json:"stopping"` ExitResult *ExitResult `json:"exit_result,omitempty"` }
type VM ¶
type VM interface { Start(ctx context.Context) (Handle, error) Exec(ctx context.Context, cmd []string, timeout time.Duration) (*api.ExecResult, error) Run() ExitResult WaitExit(ctx context.Context) bool Signal(ctx context.Context, signal string) error Stop(ctx context.Context, signal string) error Shutdown(ctx context.Context) error }
Click to show internal directories.
Click to hide internal directories.