Documentation ¶
Index ¶
Constants ¶
const ( // DriverStatusHealthy represents the healthy status DriverStatusHealthy = "Healthy" // DriverStatusUnHealthy represents the unhealthy status DriverStatusUnHealthy = "Unhealthy" )
const ( // DriverDragonfly represents the driver for dragonfly DriverDragonfly = "dragonfly" // DriverKraken represents the driver for kraken DriverKraken = "kraken" )
const (
// SupportedType indicates the supported preheating type 'image'.
SupportedType = "image"
)
Variables ¶
This section is empty.
Functions ¶
func MockDragonflyProvider ¶
MockDragonflyProvider mocks a Dragonfly server.
func MockKrakenProvider ¶
MockKrakenProvider mocks a Kraken server.
Types ¶
type DragonflyDriver ¶
type DragonflyDriver struct {
// contains filtered or unexported fields
}
DragonflyDriver implements the provider driver interface for Alibaba dragonfly. More details, please refer to https://github.com/alibaba/Dragonfly
func (*DragonflyDriver) CheckProgress ¶
func (dd *DragonflyDriver) CheckProgress(taskID string) (*PreheatingStatus, error)
CheckProgress implements @Driver.CheckProgress.
func (*DragonflyDriver) GetHealth ¶
func (dd *DragonflyDriver) GetHealth() (*DriverStatus, error)
GetHealth implements @Driver.GetHealth.
func (*DragonflyDriver) Preheat ¶
func (dd *DragonflyDriver) Preheat(preheatingImage *PreheatImage) (*PreheatingStatus, error)
Preheat implements @Driver.Preheat.
func (*DragonflyDriver) Self ¶
func (dd *DragonflyDriver) Self() *Metadata
Self implements @Driver.Self.
type Driver ¶
type Driver interface { // Self returns the metadata of the driver. // The metadata includes: name, icon(optional), maintainers(optional), version and source repo. Self() *Metadata // Try to get the health status of the driver. // If succeed, a non nil status object will be returned; // otherwise, a non nil error will be set. GetHealth() (*DriverStatus, error) // Preheat the specified image // If succeed, a non nil result object with preheating task id will be returned; // otherwise, a non nil error will be set. Preheat(preheatingImage *PreheatImage) (*PreheatingStatus, error) // Check the progress of the preheating process. // If succeed, a non nil status object with preheating status will be returned; // otherwise, a non nil error will be set. CheckProgress(taskID string) (*PreheatingStatus, error) }
Driver defines the capabilities one distribution provider should have. Includes:
Self descriptor Health checking Preheat related : Preheat means transfer the preheating image to the network of distribution provider in advance.
func DragonflyFactory ¶
DragonflyFactory creates dragonfly driver
type DriverStatus ¶
type DriverStatus struct {
Status string `json:"status"`
}
DriverStatus keeps the health status of driver.
type Factory ¶
Factory is responsible to create a new driver based on the metadata.
func GetProvider ¶
GetProvider returns the driver factory identified by the ID.
If exists, bool flag will be set to be true and a non-nil reference will be returned.
type KrakenDriver ¶
type KrakenDriver struct {
// contains filtered or unexported fields
}
KrakenDriver implements the provider driver interface for Uber kraken. More details, please refer to https://github.com/uber/kraken
func (*KrakenDriver) CheckProgress ¶
func (kd *KrakenDriver) CheckProgress(taskID string) (*PreheatingStatus, error)
CheckProgress implements @Driver.CheckProgress. TODO: This should be improved later
func (*KrakenDriver) GetHealth ¶
func (kd *KrakenDriver) GetHealth() (*DriverStatus, error)
GetHealth implements @Driver.GetHealth.
func (*KrakenDriver) Preheat ¶
func (kd *KrakenDriver) Preheat(preheatingImage *PreheatImage) (*PreheatingStatus, error)
Preheat implements @Driver.Preheat.
type Metadata ¶
type Metadata struct { ID string `json:"id"` Name string `json:"name"` Icon string `json:"icon,omitempty"` Maintainers []string `json:"maintainers,omitempty"` Version string `json:"version"` Source string `json:"source,omitempty"` }
Metadata contains the basic information of the provider.
func ListProviders ¶
ListProviders returns all the registered drivers.
type PreheatImage ¶
type PreheatImage struct { // The image content type, only support 'image' now Type string `json:"type"` // The access URL of the preheating image URL string `json:"url"` // The headers which will be sent to the above URL of preheating image Headers map[string]interface{} `json:"headers"` // The image name ImageName string `json:"image,omitempty"` // The tag Tag string `json:"tag,omitempty"` // Digest of the preheating image Digest string `json:"digest"` // Scope indicates the preheat scope. Scope string `json:"scope,omitempty"` }
PreheatImage contains related information which can help providers to get/pull the images.
func (*PreheatImage) FromJSON ¶
func (img *PreheatImage) FromJSON(data string) error
FromJSON build preheating image from the given data.
func (*PreheatImage) ToJSON ¶
func (img *PreheatImage) ToJSON() (string, error)
ToJSON encodes the preheating image to JSON data.
type PreheatingStatus ¶
type PreheatingStatus struct { TaskID string `json:"task_id"` Status string `json:"status"` Message string `json:"message,omitempty"` Error string `json:"error,omitempty"` StartTime string `json:"start_time"` FinishTime string `json:"finish_time"` }
PreheatingStatus contains the related results/status of the preheating operation from the provider.
func (*PreheatingStatus) String ¶
func (ps *PreheatingStatus) String() string
String format of PreheatingStatus