Documentation
¶
Index ¶
- type Collection
- type DeleteIfaceInput
- type DiskCreateInput
- type DiskFile
- type DiskService
- type DiskType
- type EventEnvelope
- type EventService
- type HasTime
- type IDService
- type IfaceCreateInput
- type IfaceDetails
- type ImageMountSpec
- type ImageService
- type ImageSpec
- type MachineMetrics
- type MicroVMCommandUseCases
- type MicroVMGRPCService
- type MicroVMQueryUseCases
- type MicroVMRepository
- type MicroVMService
- type MicroVMState
- type NetworkService
- type ReconcileMicroVMsUseCase
- type RepositoryGetOptions
- type VirtioFSCreateInput
- type VirtioFSDeleteInput
- type VirtioFSService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
Repo MicroVMRepository
MicrovmProviders map[string]MicroVMService
EventService EventService
IdentifierService IDService
NetworkService NetworkService
ImageService ImageService
DiskService DiskService
FileSystem afero.Fs
Clock func() time.Time
VirtioFSService VirtioFSService
}
type DeleteIfaceInput ¶
type DeleteIfaceInput struct {
// DeviceName is the name of the network interface to delete from the host.
DeviceName string
}
type DiskCreateInput ¶
type DiskCreateInput struct {
// Path is the filesystem path of where to create the disk.
Path string
// Size is how big the disk should be. It uses human readable formats
// such as 8Mb, 10Kb.
Size string
// VolumeName is the name to give to the volume.
VolumeName string
// Type is the type of disk to create.
Type DiskType
// Files are the files to create in the new disk.
Files []DiskFile
// Overwrite specifies if the image file already exists whether
// we should overwrite it or return an error.
Overwrite bool
}
DiskCreateInput are the input options for creating a disk.
type DiskFile ¶
type DiskFile struct {
// Path is the path in the disk image for the file.
Path string
// ContentBase64 is the content of the file encoded as base64.
ContentBase64 string
}
DiskFile represents a file to create in a disk.
type DiskService ¶
type DiskService interface {
// Create will create a new disk.
Create(ctx context.Context, input DiskCreateInput) error
}
DiskService is a port for a service that creates disk images.
type EventEnvelope ¶
type EventService ¶
type EventService interface {
// Publish will publish an event to a specific topic.
Publish(ctx context.Context, topic string, eventToPublish interface{}) error
// SubscribeTopic will subscribe to events on a named topic..
SubscribeTopic(ctx context.Context, topic string) (ch <-chan *EventEnvelope, errs <-chan error)
// SubscribeTopics will subscribe to events on a set of named topics.
SubscribeTopics(ctx context.Context, topics []string) (ch <-chan *EventEnvelope, errs <-chan error)
// Subscribe will subscribe to events on all topics
Subscribe(ctx context.Context) (ch <-chan *EventEnvelope, errs <-chan error)
}
EventService is a port for a service that acts as a event bus.
type IDService ¶
type IDService interface {
// GenerateRandom will create a random identifier.
GenerateRandom() (string, error)
}
IDService is a port for a service for working with identifiers.
type IfaceCreateInput ¶
type IfaceCreateInput struct {
// DeviceName is the name of the network interface to create on the host.
DeviceName string
// Type is the type of network interface to create.
Type models.IfaceType
// MAC allows the specifying of a specific MAC address to use for the interface. If
// not supplied a autogenerated MAC address will be used.
MAC string
// Attach indicates if this device should be attached to the parent bridge. Only applicable to TAP devices.
Attach bool
// BridgeName is the name of the bridge to attach to. Only if this is a tap device and attach is true.
BridgeName string
}
type IfaceDetails ¶
type IfaceDetails struct {
// DeviceName is the name of the network interface created on the host.
DeviceName string
// Type is the type of network interface created.
Type models.IfaceType
// MAC is the MAC address of the created interface.
MAC string
// Index is the network interface index on the host.
Index int
}
type ImageMountSpec ¶
type ImageMountSpec struct {
// ImageName is the name of the image to get.
ImageName string
// Owner is the name of the owner of the image.
Owner string
// Use is an indicator of what the image will be used for.
Use models.ImageUse
// OwnerUsageID is an identifier from the owner.
OwnerUsageID string
}
ImageMountSpec is the declaration of an image that needs to be pulled and mounted.
type ImageService ¶
type ImageService interface {
// Pull will get (i.e. pull) the image for a specific owner.
Pull(ctx context.Context, input *ImageSpec) error
// PullAndMount will get (i.e. pull) the image for a specific owner and then
// make it available via a mount point.
PullAndMount(ctx context.Context, input *ImageMountSpec) ([]models.Mount, error)
// Exists checks if the image already exists on the machine.
Exists(ctx context.Context, input *ImageSpec) (bool, error)
// IsMounted checks if the image is pulled and mounted.
IsMounted(ctx context.Context, input *ImageMountSpec) (bool, error)
}
ImageService is a port for a service that interacts with OCI images.
type MachineMetrics ¶
type MachineMetrics interface {
ToPrometheus() []byte
}
MachineMetrics is a metrics interface for providers.
type MicroVMCommandUseCases ¶
type MicroVMCommandUseCases interface {
// CreateMicroVM is a use case for creating a microvm.
CreateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.MicroVM, error)
// DeleteMicroVM is a use case for deleting a microvm.
DeleteMicroVM(ctx context.Context, vmid string) error
}
MicroVMCommandUseCases is the interface for uses cases that are actions (a.k.a commands) against a microvm.
type MicroVMGRPCService ¶
type MicroVMGRPCService interface {
mvmv1.MicroVMServer
}
MicroVMGRPCService is a port for a microvm grpc service.
type MicroVMQueryUseCases ¶
type MicroVMQueryUseCases interface {
// GetMicroVM is a use case for getting details of a specific microvm.
GetMicroVM(ctx context.Context, vmid string) (*models.MicroVM, error)
// GetAllMicroVM is a use case for getting details of all microvms in a given namespace.
GetAllMicroVM(ctx context.Context, query models.ListMicroVMQuery) ([]*models.MicroVM, error)
}
MicroVMQueryUseCases is the interface for uses cases that are queries for microvms.
type MicroVMRepository ¶
type MicroVMRepository interface {
// Save will save the supplied microvm spec.
Save(ctx context.Context, microvm *models.MicroVM) (*models.MicroVM, error)
// Delete will delete the supplied microvm.
Delete(ctx context.Context, microvm *models.MicroVM) error
// Get will get the microvm spec with the given name/namespace.
Get(ctx context.Context, options RepositoryGetOptions) (*models.MicroVM, error)
// GetAll will get a list of microvm details. If namespace is an empty string all
// details of microvms will be returned.
GetAll(ctx context.Context, query models.ListMicroVMQuery) ([]*models.MicroVM, error)
// Exists checks to see if the microvm spec exists in the repo.
Exists(ctx context.Context, vmid models.VMID) (bool, error)
// ReleaseLease will release the supplied lease.
ReleaseLease(ctx context.Context, microvm *models.MicroVM) error
}
MicroVMRepository is the port definition for a microvm repository.
type MicroVMService ¶
type MicroVMService interface {
// Capabilities returns a list of the capabilities the provider supports.
Capabilities() models.Capabilities
// Create will create a new microvm.
Create(ctx context.Context, vm *models.MicroVM) error
// Delete will delete a VM and its runtime state.
Delete(ctx context.Context, id string) error
// Start will start a created microvm.
Start(ctx context.Context, vm *models.MicroVM) error
// State returns the state of a microvm.
State(ctx context.Context, id string) (MicroVMState, error)
// Metrics returns with the metrics of a microvm.
Metrics(ctx context.Context, id models.VMID) (MachineMetrics, error)
}
MicroVMService is the port definition for a microvm service.
type MicroVMState ¶
type MicroVMState string
This state represents the state of the Firecracker MVM process itself The state for the entire Flintlock MVM is represented in models.MicroVMState.
const ( MicroVMStateUnknown MicroVMState = "unknown" MicroVMStatePending MicroVMState = "pending" MicroVMStateConfigured MicroVMState = "configured" MicroVMStateRunning MicroVMState = "running" )
type NetworkService ¶
type NetworkService interface {
// IfaceCreate will create the network interface.
IfaceCreate(ctx context.Context, input IfaceCreateInput) (*IfaceDetails, error)
// IfaceDelete is used to delete a network interface
IfaceDelete(ctx context.Context, input DeleteIfaceInput) error
// IfaceExists will check if an interface with the given name exists
IfaceExists(ctx context.Context, name string) (bool, error)
// IfaceDetails will get the details of the supplied network interface.
IfaceDetails(ctx context.Context, name string) (*IfaceDetails, error)
}
NetworkService is a port for a service that interacts with the network stack on the host machine.
type ReconcileMicroVMsUseCase ¶
type ReconcileMicroVMsUseCase interface {
// ReconcileMicroVM is a use case for reconciling a specific microvm.
ReconcileMicroVM(ctx context.Context, vmid models.VMID) error
}
ReconcileMicroVMsUseCase is the interface for use cases that are related to reconciling microvms.
type RepositoryGetOptions ¶
type VirtioFSCreateInput ¶ added in v0.8.0
type VirtioFSCreateInput struct {
Path string
}
Create VirtioFSInput are the input options for creating a disk.
type VirtioFSDeleteInput ¶ added in v0.8.0
type VirtioFSDeleteInput struct {
Path string
}
type VirtioFSService ¶ added in v0.8.0
type VirtioFSService interface {
// Create will create a new virtiofs share.
Create(ctx context.Context, vmid *models.VMID, input VirtioFSCreateInput) (*models.Mount, error)
Delete(ctx context.Context, vmid *models.VMID) error
HasVirtioFSDProcess(ctx context.Context, vmid *models.VMID) (bool, error)
}
VirtiofsService is the port definition for a VirtioFS service.