Documentation
¶
Index ¶
- Constants
- Variables
- type AsyncTerminationCommand
- type CancelAgreementCommand
- type CleanupExecutionCommand
- type CleanupStatusCommand
- type ContainerStatus
- type DeviceStatus
- type GovernanceWorker
- func (w *GovernanceWorker) CleanupMicroservice(spec_ref string, version string, inst_key string, ms_reason_code uint) error
- func (w *GovernanceWorker) CommandHandler(command worker.Command) bool
- func (w *GovernanceWorker) FindEstablishedAgreementsWithIds(agreementIds []string) ([]persistence.EstablishedAgreement, error)
- func (w *GovernanceWorker) GetWorkloadPreference(url string) (map[string]string, error)
- func (w *GovernanceWorker) Initialize() bool
- func (w *GovernanceWorker) Messages() chan events.Message
- func (w *GovernanceWorker) NewCleanupExecutionCommand(protocol string, agreementId string, reason uint, ...) *CleanupExecutionCommand
- func (w *GovernanceWorker) NewCleanupStatusCommand(protocol string, agreementId string, status uint) *CleanupStatusCommand
- func (w *GovernanceWorker) NewEvent(incoming events.Message)
- func (w *GovernanceWorker) NewNodeHeartbeatRestoredCommand() *NodeHeartbeatRestoredCommand
- func (w *GovernanceWorker) NewNodeShutdownCommand(msg *events.NodeShutdownMessage) *NodeShutdownCommand
- func (w *GovernanceWorker) NewReportDeviceStatusCommand() *ReportDeviceStatusCommand
- func (w *GovernanceWorker) NewStartAgreementLessServicesCommand() *StartAgreementLessServicesCommand
- func (w *GovernanceWorker) NewStartGovernExecutionCommand(deployment persistence.DeploymentConfig, protocol string, agreementId string) *StartGovernExecutionCommand
- func (w *GovernanceWorker) NewUpdateMicroserviceCommand(key string, started bool, failure_code uint, failure_desc string) *UpdateMicroserviceCommand
- func (w *GovernanceWorker) NewUpgradeMicroserviceCommand(msdef_id string) *UpgradeMicroserviceCommand
- func (w *GovernanceWorker) NoWorkHandler()
- func (w *GovernanceWorker) RecordReply(proposal abstractprotocol.Proposal, protocol string) error
- func (w *GovernanceWorker) ReportDeviceStatus()
- func (w *GovernanceWorker) RollbackMicroservice(msdef *persistence.MicroserviceDefinition) error
- func (w *GovernanceWorker) StartMicroservice(ms_key string, agreementId string, ...) (*persistence.MicroserviceInstance, error)
- func (w *GovernanceWorker) UpgradeMicroservice(msdef *persistence.MicroserviceDefinition, ...) error
- type NodeHeartbeatRestoredCommand
- type NodeShutdownCommand
- type ReportDeviceStatusCommand
- type StartAgreementLessServicesCommand
- type StartGovernExecutionCommand
- type UpdateMicroserviceCommand
- type UpgradeMicroserviceCommand
- type WorkloadStatus
Constants ¶
const BC_GOVERNOR = "BlockchainGovernor"
const CONTAINER_GOVERNOR = "ContainerGovernor"
for identifying the subworkers used by this worker
const MAX_AGREEMENT_ACCEPTANCE_WAIT_TIME_M = 20
enforced only after the workloads are running
const MAX_CONTRACT_PRELAUNCH_TIME_M = 10
const MAX_CONTRACT_UNCONFIGURED_TIME_M = 20
TODO: make this module more aware of long-running setup operations like image downloading and dockerfile loading the max time we'll let a contract remain unconfigured by the provider
const MAX_MICROPAYMENT_UNPAID_RUN_DURATION_M = 60
const MICROSERVICE_GOVERNOR = "MicroserviceGovernor"
const STATUS_AG_PROTOCOL_TERMINATED = 501
const STATUS_WORKLOAD_DESTROYED = 500
related to agreement cleanup status
Variables ¶
var HORIZON_SERVERS = [...]string{"firmware.bluehorizon.network", "images.bluehorizon.network"}
Functions ¶
This section is empty.
Types ¶
type AsyncTerminationCommand ¶
==============================================================================================================
func NewAsyncTerminationCommand ¶
func NewAsyncTerminationCommand(agreementId string, agreementProtocol string, reason uint) *AsyncTerminationCommand
func (AsyncTerminationCommand) ShortString ¶
func (c AsyncTerminationCommand) ShortString() string
type CancelAgreementCommand ¶
type CancelAgreementCommand struct {
AgreementId string
AgreementProtocol string
Reason uint
ReasonDescription string
}
==============================================================================================================
func NewCancelAgreementCommand ¶
func NewCancelAgreementCommand(agreementId string, agreementProtocol string, reason uint, desc string) *CancelAgreementCommand
func (CancelAgreementCommand) ShortString ¶
func (c CancelAgreementCommand) ShortString() string
type CleanupExecutionCommand ¶
type CleanupExecutionCommand struct {
AgreementProtocol string
AgreementId string
Reason uint
Deployment persistence.DeploymentConfig
}
==============================================================================================================
func (CleanupExecutionCommand) ShortString ¶
func (c CleanupExecutionCommand) ShortString() string
type CleanupStatusCommand ¶
==============================================================================================================
func (CleanupStatusCommand) ShortString ¶
func (c CleanupStatusCommand) ShortString() string
type ContainerStatus ¶
type ContainerStatus struct {
Name string `json:"name"`
Image string `json:"image"`
Created int64 `json:"created"`
State string `json:"state"`
}
func GetContainerStatus ¶
func GetContainerStatus(deployment string, key string, infrastructure bool, containers []docker.APIContainers) ([]ContainerStatus, error)
find container status
func (ContainerStatus) String ¶
func (w ContainerStatus) String() string
type DeviceStatus ¶
type DeviceStatus struct {
Connectivity map[string]bool `json:"connectivity"` // hosts and whether this device can reach them or not
Services []WorkloadStatus `json:"services"`
LastUpdated string `json:"lastUpdated"`
}
func NewDeviceStatus ¶
func NewDeviceStatus() *DeviceStatus
func (DeviceStatus) String ¶
func (w DeviceStatus) String() string
type GovernanceWorker ¶
type GovernanceWorker struct {
worker.BaseWorker // embedded field
ShuttingDownCmd *NodeShutdownCommand
// contains filtered or unexported fields
}
func NewGovernanceWorker ¶
func NewGovernanceWorker(name string, cfg *config.HorizonConfig, db *bolt.DB, pm *policy.PolicyManager) *GovernanceWorker
func (*GovernanceWorker) CleanupMicroservice ¶
func (w *GovernanceWorker) CleanupMicroservice(spec_ref string, version string, inst_key string, ms_reason_code uint) error
It cleans the microservice instance and its associated agreements
func (*GovernanceWorker) CommandHandler ¶
func (w *GovernanceWorker) CommandHandler(command worker.Command) bool
func (*GovernanceWorker) FindEstablishedAgreementsWithIds ¶
func (w *GovernanceWorker) FindEstablishedAgreementsWithIds(agreementIds []string) ([]persistence.EstablishedAgreement, error)
go through all the protocols and find the agreements with given agreement ids from the db
func (*GovernanceWorker) GetWorkloadPreference ¶
func (w *GovernanceWorker) GetWorkloadPreference(url string) (map[string]string, error)
Get the environmental variables for a service (this is about launching).
func (*GovernanceWorker) Initialize ¶
func (w *GovernanceWorker) Initialize() bool
func (*GovernanceWorker) Messages ¶
func (w *GovernanceWorker) Messages() chan events.Message
func (*GovernanceWorker) NewCleanupExecutionCommand ¶
func (w *GovernanceWorker) NewCleanupExecutionCommand(protocol string, agreementId string, reason uint, deployment persistence.DeploymentConfig) *CleanupExecutionCommand
func (*GovernanceWorker) NewCleanupStatusCommand ¶
func (w *GovernanceWorker) NewCleanupStatusCommand(protocol string, agreementId string, status uint) *CleanupStatusCommand
func (*GovernanceWorker) NewEvent ¶
func (w *GovernanceWorker) NewEvent(incoming events.Message)
func (*GovernanceWorker) NewNodeHeartbeatRestoredCommand ¶
func (w *GovernanceWorker) NewNodeHeartbeatRestoredCommand() *NodeHeartbeatRestoredCommand
func (*GovernanceWorker) NewNodeShutdownCommand ¶
func (w *GovernanceWorker) NewNodeShutdownCommand(msg *events.NodeShutdownMessage) *NodeShutdownCommand
func (*GovernanceWorker) NewReportDeviceStatusCommand ¶
func (w *GovernanceWorker) NewReportDeviceStatusCommand() *ReportDeviceStatusCommand
func (*GovernanceWorker) NewStartAgreementLessServicesCommand ¶
func (w *GovernanceWorker) NewStartAgreementLessServicesCommand() *StartAgreementLessServicesCommand
func (*GovernanceWorker) NewStartGovernExecutionCommand ¶
func (w *GovernanceWorker) NewStartGovernExecutionCommand(deployment persistence.DeploymentConfig, protocol string, agreementId string) *StartGovernExecutionCommand
func (*GovernanceWorker) NewUpdateMicroserviceCommand ¶
func (w *GovernanceWorker) NewUpdateMicroserviceCommand(key string, started bool, failure_code uint, failure_desc string) *UpdateMicroserviceCommand
func (*GovernanceWorker) NewUpgradeMicroserviceCommand ¶
func (w *GovernanceWorker) NewUpgradeMicroserviceCommand(msdef_id string) *UpgradeMicroserviceCommand
func (*GovernanceWorker) NoWorkHandler ¶
func (w *GovernanceWorker) NoWorkHandler()
func (*GovernanceWorker) RecordReply ¶
func (w *GovernanceWorker) RecordReply(proposal abstractprotocol.Proposal, protocol string) error
func (*GovernanceWorker) ReportDeviceStatus ¶
func (w *GovernanceWorker) ReportDeviceStatus()
Report the containers status and connectivity status to the exchange.
func (*GovernanceWorker) RollbackMicroservice ¶
func (w *GovernanceWorker) RollbackMicroservice(msdef *persistence.MicroserviceDefinition) error
Get the next highest microservice version and rollback to it. Tryer even lower version if it fails
func (*GovernanceWorker) StartMicroservice ¶
func (w *GovernanceWorker) StartMicroservice(ms_key string, agreementId string, dependencyPath []persistence.ServiceInstancePathElement) (*persistence.MicroserviceInstance, error)
It creates microservice instance and loads the containers for the given microservice def
func (*GovernanceWorker) UpgradeMicroservice ¶
func (w *GovernanceWorker) UpgradeMicroservice(msdef *persistence.MicroserviceDefinition, new_msdef *persistence.MicroserviceDefinition, upgrade bool) error
It changes the current running microservice from the old to new, assuming the given microservice is ready for a change. One can check it by calling microservice.MicroserviceReadyForUpgrade to find out.
type NodeHeartbeatRestoredCommand ¶
type NodeHeartbeatRestoredCommand struct {
}
============================================================================================================== Node heartbeat restored
func (NodeHeartbeatRestoredCommand) ShortString ¶
func (c NodeHeartbeatRestoredCommand) ShortString() string
type NodeShutdownCommand ¶
type NodeShutdownCommand struct {
Msg *events.NodeShutdownMessage
}
==============================================================================================================
func (NodeShutdownCommand) ShortString ¶
func (n NodeShutdownCommand) ShortString() string
type ReportDeviceStatusCommand ¶
type ReportDeviceStatusCommand struct {
}
==============================================================================================================
func (ReportDeviceStatusCommand) ShortString ¶
func (c ReportDeviceStatusCommand) ShortString() string
type StartAgreementLessServicesCommand ¶
type StartAgreementLessServicesCommand struct {
}
============================================================================================================== Start agreement-less services
func (StartAgreementLessServicesCommand) ShortString ¶
func (c StartAgreementLessServicesCommand) ShortString() string
type StartGovernExecutionCommand ¶
type StartGovernExecutionCommand struct {
AgreementId string
AgreementProtocol string
Deployment persistence.DeploymentConfig
}
func (StartGovernExecutionCommand) ShortString ¶
func (g StartGovernExecutionCommand) ShortString() string
type UpdateMicroserviceCommand ¶
type UpdateMicroserviceCommand struct {
MsInstKey string // the name that was passed into the ContainerLaunchContext, it is the key to the MicroserviceInstance table.
ExecutionStarted bool
ExecutionFailureCode uint
ExecutionFailureDesc string
}
==============================================================================================================
func (UpdateMicroserviceCommand) ShortString ¶
func (c UpdateMicroserviceCommand) ShortString() string
type UpgradeMicroserviceCommand ¶
type UpgradeMicroserviceCommand struct {
MsDefId string
}
============================================================================================================== Upgrade the given microservice if needed
func (UpgradeMicroserviceCommand) ShortString ¶
func (c UpgradeMicroserviceCommand) ShortString() string
type WorkloadStatus ¶
type WorkloadStatus struct {
AgreementId string `json:"agreementId"`
ServiceURL string `json:"serviceUrl,omitempty"`
Org string `json:"orgid,omitempty"`
Version string `json:"version,omitempty"`
Arch string `json:"arch,omitempty"`
Containers []ContainerStatus `json:"containerStatus"`
}
func (WorkloadStatus) String ¶
func (w WorkloadStatus) String() string