Documentation
¶
Index ¶
- Constants
- func AttributesToEnvvarMap(attributes []Attribute, envvars map[string]string, prefix string, ...) (map[string]string, error)
- func ConvertToSelectors(selections map[string][]string) (map[string][]Selector, error)
- func ConvertWorkloadPersistentNativeToEnv(allAttrs []Attribute, envvars map[string]string, prefix string, ...) (map[string]string, error)
- func DeleteAsscAgmtsFromMSInstances(db *bolt.DB, agreement_id string) error
- func DeleteEstablishedAgreement(db *bolt.DB, agreementId string, protocol string) error
- func DeleteExchangeDevice(db *bolt.DB) error
- func GetFormatedPatternString(pattern string, device_org string) (string, string, string)
- func GetLastUnregistrationTime(db *bolt.DB) (uint64, error)
- func GroupSelectors(selectors map[string][]Selector) (map[string][]Selector, map[string][]Selector)
- func IsHelm(dep map[string]interface{}) bool
- func MatchAttributeValue(attr interface{}, selectors []Selector) (bool, bool, error)
- func MigrateExchangeDevice(db *bolt.DB) (bool, error)
- func SaveEventLog(db *bolt.DB, event_log *EventLog) error
- func SaveLastUnregistrationTime(db *bolt.DB, last_unreg_time uint64) error
- func SaveOrUpdateMicroserviceDef(db *bolt.DB, msdef *MicroserviceDefinition) error
- func ServiceConfigNames(serviceConfigs *map[string]ServiceConfig) []string
- type AgreementEventSource
- type AgreementProtocolAttributes
- type ArchitectureAttributes
- type Attribute
- func DeleteAttribute(db *bolt.DB, id string) (*Attribute, error)
- func FindApplicableAttributes(db *bolt.DB, serviceUrl string) ([]Attribute, error)
- func FindAttributeByKey(db *bolt.DB, id string) (*Attribute, error)
- func FindConflictingAttributes(db *bolt.DB, attribute *Attribute) (*Attribute, error)
- func HydrateConcreteAttribute(v []byte) (Attribute, error)
- func SaveOrUpdateAttribute(db *bolt.DB, attr Attribute, id string, permitPartialOverwrite bool) (*Attribute, error)
- type AttributeMeta
- type Auth
- type ComputeAttributes
- type Configstate
- type ConflictingAttributeFound
- type CounterPartyPropertyAttributes
- type DatabaseEventSource
- type DeploymentConfig
- type DockerRegistryAuthAttributes
- func (a DockerRegistryAuthAttributes) AddAuth(auth_new Auth)
- func (a DockerRegistryAuthAttributes) DeleteAuth(auth_in Auth)
- func (a DockerRegistryAuthAttributes) GetGenericMappings() map[string]interface{}
- func (a DockerRegistryAuthAttributes) GetMeta() *AttributeMeta
- func (a DockerRegistryAuthAttributes) String() string
- func (a DockerRegistryAuthAttributes) Update(other Attribute) error
- type EAFilter
- type EstablishedAgreement
- func AgreementDeploymentStarted(db *bolt.DB, dbAgreementId string, protocol string, ...) (*EstablishedAgreement, error)
- func AgreementStateAccepted(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
- func AgreementStateAgreementProtocolTerminated(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
- func AgreementStateBCDataReceived(db *bolt.DB, dbAgreementId string, protocol string, address string) (*EstablishedAgreement, error)
- func AgreementStateBCUpdateAcked(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
- func AgreementStateDataReceived(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
- func AgreementStateExecutionStarted(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
- func AgreementStateFinalized(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
- func AgreementStateForceTerminated(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
- func AgreementStateProposalSigned(db *bolt.DB, dbAgreementId string, protocol string, sig string) (*EstablishedAgreement, error)
- func AgreementStateTerminated(db *bolt.DB, dbAgreementId string, reason uint64, reasonString string, ...) (*EstablishedAgreement, error)
- func AgreementStateWorkloadTerminated(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
- func ArchiveEstablishedAgreement(db *bolt.DB, agreementId string, protocol string) (*EstablishedAgreement, error)
- func FindEstablishedAgreements(db *bolt.DB, protocol string, filters []EAFilter) ([]EstablishedAgreement, error)
- func FindEstablishedAgreementsAllProtocols(db *bolt.DB, protocols []string, filters []EAFilter) ([]EstablishedAgreement, error)
- func MeteringNotificationReceived(db *bolt.DB, dbAgreementId string, mn MeteringNotification, protocol string) (*EstablishedAgreement, error)
- func NewEstablishedAgreement(db *bolt.DB, name string, agreementId string, consumerId string, ...) (*EstablishedAgreement, error)
- type EventLog
- func FindAllEventLogs(db *bolt.DB) ([]EventLog, error)
- func FindEventLogWithKey(db *bolt.DB, key string) (*EventLog, error)
- func FindEventLogs(db *bolt.DB, filters []EventLogFilter) ([]EventLog, error)
- func FindEventLogsWithSelectors(db *bolt.DB, all_logs bool, selectors map[string][]Selector) ([]EventLog, error)
- func NewEventLog(severity string, message string, event_code string, source_type string, ...) *EventLog
- func (w EventLog) IsSourceType(source_type string) bool
- func (w EventLog) Matches(selectors map[string][]Selector) bool
- func (w EventLog) Matches2(base_selectors map[string][]Selector, source_selectors map[string][]Selector) bool
- func (w EventLog) ShortString() string
- func (w EventLog) String() string
- type EventLogBase
- type EventLogFilter
- type EventLogRaw
- type EventSourceInterface
- type ExchangeDevice
- func (e ExchangeDevice) GetId() string
- func (e *ExchangeDevice) InvalidateExchangeToken(db *bolt.DB) (*ExchangeDevice, error)
- func (e *ExchangeDevice) IsState(state string) bool
- func (e *ExchangeDevice) SetConfigstate(db *bolt.DB, deviceId string, state string) (*ExchangeDevice, error)
- func (e *ExchangeDevice) SetExchangeDeviceToken(db *bolt.DB, deviceId string, token string) (*ExchangeDevice, error)
- func (e ExchangeDevice) String() string
- type ExchangeEventSource
- type HAAttributes
- type HTTPSBasicAuthAttributes
- type HardwareMatch
- type HelmDeploymentConfig
- func (h *HelmDeploymentConfig) FromPersistentForm(pf map[string]interface{}) error
- func (h *HelmDeploymentConfig) IsNative() bool
- func (h HelmDeploymentConfig) String() string
- func (h *HelmDeploymentConfig) ToPersistentForm() (map[string]interface{}, error)
- func (h *HelmDeploymentConfig) ToString() string
- type ImplementationPackage
- type LocationAttributes
- type MIFilter
- type MSFilter
- type MetaAttributesOnly
- type MeteringAttributes
- type MeteringNotification
- type MicroserviceDefinition
- func FindMicroserviceDefWithKey(db *bolt.DB, key string) (*MicroserviceDefinition, error)
- func FindMicroserviceDefs(db *bolt.DB, filters []MSFilter) ([]MicroserviceDefinition, error)
- func FindUnarchivedMicroserviceDefs(db *bolt.DB, url string) ([]MicroserviceDefinition, error)
- func MSDefNewUpgradeVersionRange(db *bolt.DB, key string, version_range string) (*MicroserviceDefinition, error)
- func MSDefUpgradeExecutionStarted(db *bolt.DB, key string) (*MicroserviceDefinition, error)
- func MSDefUpgradeFailed(db *bolt.DB, key string, reason uint64, reasonString string) (*MicroserviceDefinition, error)
- func MSDefUpgradeMsReregistered(db *bolt.DB, key string) (*MicroserviceDefinition, error)
- func MSDefUpgradeMsUnregistered(db *bolt.DB, key string) (*MicroserviceDefinition, error)
- func MSDefUpgradeNewMsId(db *bolt.DB, key string, new_id string) (*MicroserviceDefinition, error)
- func MSDefUpgradeStarted(db *bolt.DB, key string) (*MicroserviceDefinition, error)
- func MsDefArchived(db *bolt.DB, key string) (*MicroserviceDefinition, error)
- func MsDefUnarchived(db *bolt.DB, key string) (*MicroserviceDefinition, error)
- func MsDefUpgradeAgreementsCleared(db *bolt.DB, key string) (*MicroserviceDefinition, error)
- func (m *MicroserviceDefinition) GetDeployment() (string, string, string)
- func (m *MicroserviceDefinition) GetImageStore() ImplementationPackage
- func (w *MicroserviceDefinition) GetUserInputName(name string) *UserInput
- func (m *MicroserviceDefinition) HasDeployment() bool
- func (m *MicroserviceDefinition) HasRequiredServices() bool
- func (m *MicroserviceDefinition) NeedsUserInput() string
- func (w MicroserviceDefinition) ShortString() string
- func (w MicroserviceDefinition) String() string
- type MicroserviceInstance
- func ArchiveMicroserviceInstance(db *bolt.DB, key string) (*MicroserviceInstance, error)
- func DeleteMicroserviceInstance(db *bolt.DB, key string) (*MicroserviceInstance, error)
- func FindMicroserviceInstance(db *bolt.DB, url string, version string, instance_id string) (*MicroserviceInstance, error)
- func FindMicroserviceInstanceWithKey(db *bolt.DB, key string) (*MicroserviceInstance, error)
- func FindMicroserviceInstances(db *bolt.DB, filters []MIFilter) ([]MicroserviceInstance, error)
- func MicroserviceInstanceCleanupStarted(db *bolt.DB, key string) (*MicroserviceInstance, error)
- func NewMicroserviceInstance(db *bolt.DB, ref_url string, version string, msdef_id string, ...) (*MicroserviceInstance, error)
- func UpdateMSInstanceAddDependencyPath(db *bolt.DB, key string, dp *[]ServiceInstancePathElement) (*MicroserviceInstance, error)
- func UpdateMSInstanceAgreementLess(db *bolt.DB, key string) (*MicroserviceInstance, error)
- func UpdateMSInstanceAssociatedAgreements(db *bolt.DB, key string, add bool, agreement_id string) (*MicroserviceInstance, error)
- func UpdateMSInstanceExecutionState(db *bolt.DB, key string, started bool, failure_code uint, failure_desc string) (*MicroserviceInstance, error)
- type NativeDeploymentConfig
- type NodeEventSource
- type OverwriteCandidateNotFound
- type PropertyAttributes
- type Selector
- type ServiceConfig
- type ServiceDependency
- type ServiceEventSource
- func NewServiceEventSource(instance_id string, service_url string, org string, version string, ...) *ServiceEventSource
- func NewServiceEventSourceFromServiceDef(msdef MicroserviceDefinition) *ServiceEventSource
- func NewServiceEventSourceFromServiceInstance(msi MicroserviceInstance) *ServiceEventSource
- type ServiceInstancePathElement
- type Torrent
- type UserInput
- type UserInputAttributes
- type WorkloadDeployment
- type WorkloadInfo
Constants ¶
const ( SEVERITY_INFO = "info" SEVERITY_WARN = "warning" SEVERITY_ERROR = "error" )
serverity for eventlog
const ( SRC_TYPE_AG = "agreement" SRC_TYPE_SVC = "service" SRC_TYPE_NODE = "node" SRC_TYPE_DB = "database" SRC_TYPE_EXCH = "exchange" )
source type for eventlog
const ( // general errors EC_DATABASE_ERROR = "database_error" EC_API_USER_INPUT_ERROR = "api_user_input_error" EC_EXCHANGE_ERROR = "exchange_error" // node configuration/registration EC_START_NODE_CONFIG_REG = "start_node_configuration_registration" EC_NODE_CONFIG_REG_COMPLETE = "node_configuration_registration_complete" EC_ERROR_NODE_CONFIG_REG = "error_node_configuration_registration" // node update EC_START_NODE_UPDATE = "start_node_update" EC_NODE_UPDATE_COMPLETE = "node_update_complete" EC_ERROR_NODE_UPDATE = "error_node_update" // node unreggistratin EC_START_NODE_UNREG = "start_node_unregistration" EC_NODE_UNREG_COMPLETE = "node_unregistration_complete" EC_ERROR_NODE_UNREG = "error_node_unregistration" // node heartbeat EC_NODE_HEARTBEAT_FAILED = "node_heartbeat_failed" EC_NODE_HEARTBEAT_RESTORED = "node_heartbeat_restored" // service configuration EC_START_SERVICE_CONFIG = "start_service_configuration" EC_SERVICE_CONFIG_COMPLETE = "service_configuration_complete" EC_ERROR_SERVICE_CONFIG = "error_service_configuration" // agreement related event code EC_RECEIVED_PROPOSAL = "received_proposal" EC_IGNORE_PROPOSAL = "ignore_proposal" EC_REJECT_PROPOSAL = "reject_proposal" EC_ERROR_IN_PROPOSAL = "error_in_proposal" EC_ERROR_PROCESSING_PROPOSAL = "error_processing_proposal" EC_RECEIVED_REPLYACK_MESSAGE = "received_replyack_message" EC_IGNORE_REPLYACK_MESSAGE = "ignore_replyack_message" EC_ERROR_PROCESSING_REPLYACT_MESSAGE = "error_ptocessing_replyack_message" EC_ERROR_PROCESSING_DATARECEIVED_MESSAGE = "error_processing_datareceived_message" EC_ERROR_PROCESSING_METERING_NOTIFY_MESSAGE = "error_processing_metering_notify_message" EC_RECEIVED_CANCEL_AGREEMENT_MESSAGE = "received_cancel_agreement_message" EC_ERROR_PROCESSING_CANCEL_AGREEMENT_MESSAGE = "error_processing_cancel_agreement_message" EC_START_POLICY_ADVERTISING = "start_policy_advertising" EC_COMPLETE_POLICY_ADVERTISING = "complete_policy_advertising" EC_ERROR_POLICY_ADVERTISING = "error_policy_advertising" EC_AGREEMENT_REACHED = "agreement_reached" EC_CANCEL_AGREEMENT = "cancel_agreement" EC_AGREEMENT_CANCELED = "agreement_canceled" EC_CANCEL_AGREEMENT_EXECUTION_TIMEOUT = "cancel_agreement_execution_timeout" EC_CANCEL_AGREEMENT_NO_REPLYACK = "cancel_agreement_no_replyack" EC_CANCEL_AGREEMENT_PER_AGBOT = "cancel_agreement_per_agbot_request" EC_CONTAINER_RUNNING = "container_running" EC_CONTAINER_STOPPED = "container_stopped" EC_ERROR_IN_DEPLOYMENT_CONFIG = "error_in_deployment_configuration" EC_ERROR_START_CONTAINER = "error_start_container" EC_IMAGE_LOADED = "image_loaded" EC_ERROR_IMAGE_LOADE = "error_image_load" EC_ERROR_AGREEMENT_VERIFICATION = "error_in_agreement_verification" EC_ERROR_DELETE_AGREEMENT_IN_EXCHANGE = "error_delete_agreement_in_exchange" // event code for services EC_START_SERVICE = "start_service" EC_ERROR_START_SERVICE = "error_start_service" EC_COMPLETE_SERVICE_STARTUP = "complete_service_startup" EC_START_DEPENDENT_SERVICE = "start_dependent_service" EC_ERROR_START_DEPENDENT_SERVICE = "error_start_dependent_service" EC_COMPLETE_DEPENDENT_SERVICE = "complete_dependent_service" EC_START_AGREEMENTLESS_SERVICE = "start_agreementless_service" EC_ERROR_START_AGREEMENTLESS_SERVICE = "error_start_agreementless_service" EC_COMPLETE_AGREEMENTLESS_SERVICE_STARTUP = "complete_agreementless_service_startup" EC_START_DOWNGRADE_SERVICE = "start_downgrade_service" EC_COMPLETE_DOWNGRADE_SERVICE = "complete_downgrade_service" EC_ERROR_DOWNGRADE_SERVICE = "error_downgrade_service" EC_NO_VERSION_TO_DOWNGRADE = "no_version_to_downgrade" EC_START_UPGRADE_SERVICE = "start_rollback_service" EC_COMPLETE_UPGRADE_SERVICE = "complete_rollback_service" EC_ERROR_UPGRADE_SERVICE = "error_rollback_service" EC_START_CLEANUP_SERVICE = "start_cleanup_service" EC_COMPLETE_CLEANUP_SERVICE = "complete_cleanup_service" EC_ERROR_CLEANUP_SERVICE = "error_cleanup_service" )
event code for eventlog
const ATTRIBUTES = "attributes"
a "service is a v2.1.0 transitional concept: it stores patterned service-related information from v1 PoCs
const BASE_SELECTORS = "source_type,severity,message,event_code,record_id,timestamp" // only support these 2 for now
const CONFIGSTATE_CONFIGURED = "configured"
const CONFIGSTATE_CONFIGURING = "configuring"
const CONFIGSTATE_UNCONFIGURED = "unconfigured"
const CONFIGSTATE_UNCONFIGURING = "unconfiguring"
const DEVICES = "devices"
const DEVMODE = "devmode"
const EVENT_LOGS = "event_logs"
event log table name
const E_AGREEMENTS = "established_agreements" // may or may not be in agreements
ephemeral as of v2.1.0
const IMPL_PACKAGE_CONTAINER = "dockerRegistry"
const IMPL_PACKAGE_DISCRIMINATOR = "storeType"
This type is used to describe the package that implements the service. This type is identical to the same type found in the exchange package. It is part of a ServiceDefinition. See that module for an explanation.
const IMPL_PACKAGE_IMAGESERVER = "imageServer"
const IMPL_PACKAGE_IMAGESERVER_SIG = "signature"
const IMPL_PACKAGE_IMAGESERVER_URL = "url"
const LAST_UNREG = "last_unreg"
table stores the timestamp of last unregistration
const MICROSERVICE_DEFINITIONS = "microdevice_definitions"
const MICROSERVICE_INSTANCES = "microdevice_instances"
microdevice definition table name
Variables ¶
This section is empty.
Functions ¶
func AttributesToEnvvarMap ¶
func AttributesToEnvvarMap(attributes []Attribute, envvars map[string]string, prefix string, defaultRAM int64) (map[string]string, error)
This function is used to convert the persistent attributes for a service/microservice to an env var map. This will include *all* values for which HostOnly is false, include those marked to not publish.
func ConvertToSelectors ¶
convert the given http.Request.Form into map of Selectors
func ConvertWorkloadPersistentNativeToEnv ¶
func ConvertWorkloadPersistentNativeToEnv(allAttrs []Attribute, envvars map[string]string, prefix string, defaultRam int64) (map[string]string, error)
Workloads dont see the same system level env vars that microservices see. This function picks out just the attributes that are applicable to workloads.
func DeleteAsscAgmtsFromMSInstances ¶
delete associated agreement id from all the microservice instances
func DeleteExchangeDevice ¶
func GetFormatedPatternString ¶
This function returns the pattern org, pattern name and formatted pattern string 'pattern org/pattern name'. If the input pattern does not contain the org name, the device org name will be used as the pattern org name. The input is a pattern string 'pattern org/pattern name' or just 'pattern name' for backward compatibility. The device org is the org name for the device.
func GetLastUnregistrationTime ¶
Find the event log from the db
func GroupSelectors ¶
This function separates base selectors and source selectors. It returns (base_selectors, source_selectors)
func MatchAttributeValue ¶
Given the selector, check if the given attribute match or not. Example:
MatchTypes("this is a test", [{ "~", "test"}, {"~", "aaa"}])
--- check the string to see if it contains "test" and "aaa".
MatchTypes(12345, [{">", 100}])
--- check the integer to see if it is greater than 100.
This function returns (match_or_not, handled_or_not, error)
func MigrateExchangeDevice ¶
Migrate a device object if it is restarted ona newer level of code.
func SaveEventLog ¶
save the event log record into db.
func SaveLastUnregistrationTime ¶
save the timestamp for the last unregistration into db.
func SaveOrUpdateMicroserviceDef ¶
func SaveOrUpdateMicroserviceDef(db *bolt.DB, msdef *MicroserviceDefinition) error
save the microservice record. update if it already exists in the db
func ServiceConfigNames ¶
func ServiceConfigNames(serviceConfigs *map[string]ServiceConfig) []string
Types ¶
type AgreementEventSource ¶
type AgreementEventSource struct {
AgreementId string `json:"agreement_id"`
RunningWorkload WorkloadInfo `json:"workload_to_run"`
ServiceUrl []string `json:"service_url"`
ConsumerId string `json:"consumer_id"`
AgreementProtocol string `json:"agreement_protocol"`
}
func NewAgreementEventSource ¶
func NewAgreementEventSource(agreement_id string, workload WorkloadInfo, service_url []string, consumer_id string, protocol string) *AgreementEventSource
func NewAgreementEventSourceFromAg ¶
func NewAgreementEventSourceFromAg(ag EstablishedAgreement) *AgreementEventSource
func (AgreementEventSource) Matches ¶
func (w AgreementEventSource) Matches(selectors map[string][]Selector) bool
func (AgreementEventSource) ShortString ¶
func (w AgreementEventSource) ShortString() string
func (AgreementEventSource) String ¶
func (w AgreementEventSource) String() string
type AgreementProtocolAttributes ¶
type AgreementProtocolAttributes struct {
Meta *AttributeMeta `json:"meta"`
Protocols interface{} `json:"protocols"`
}
func (AgreementProtocolAttributes) GetGenericMappings ¶
func (a AgreementProtocolAttributes) GetGenericMappings() map[string]interface{}
func (AgreementProtocolAttributes) GetMeta ¶
func (a AgreementProtocolAttributes) GetMeta() *AttributeMeta
func (AgreementProtocolAttributes) String ¶
func (a AgreementProtocolAttributes) String() string
func (AgreementProtocolAttributes) Update ¶
func (a AgreementProtocolAttributes) Update(other Attribute) error
TODO: duplicate this for the others too
type ArchitectureAttributes ¶
type ArchitectureAttributes struct {
Meta *AttributeMeta `json:"meta"`
Architecture string `json:"architecture"`
}
func (ArchitectureAttributes) GetGenericMappings ¶
func (a ArchitectureAttributes) GetGenericMappings() map[string]interface{}
func (ArchitectureAttributes) GetMeta ¶
func (a ArchitectureAttributes) GetMeta() *AttributeMeta
func (ArchitectureAttributes) String ¶
func (a ArchitectureAttributes) String() string
func (ArchitectureAttributes) Update ¶
func (a ArchitectureAttributes) Update(other Attribute) error
type Attribute ¶
type Attribute interface {
GetMeta() *AttributeMeta
GetGenericMappings() map[string]interface{}
Update(other Attribute) error
String() string
}
func FindAttributeByKey ¶
FindAttributeByKey is used to fetch a single attribute by its primary key
type AttributeMeta ¶
type AttributeMeta struct {
Id string `json:"id"` // should correspond to something meangingful to the caller
Type string `json:"type"`
SensorUrls []string `json:"sensor_urls"` // empty if applicable to all services
Label string `json:"label"` // for humans only, never computable
HostOnly *bool `json:"host_only"` // determines whether or not the attribute will be published inside workload containers or exists only for Host use
Publishable *bool `json:"publishable"` // means sent to exchange or otherwise published; whether or not an attr ends up in a workload depends on the value of HostOnly
}
func (*AttributeMeta) AppendSensorUrl ¶
func (m *AttributeMeta) AppendSensorUrl(url string) *AttributeMeta
important to use this for additions to prevent duplicates and keep slice ordered
func (AttributeMeta) String ¶
func (a AttributeMeta) String() string
func (*AttributeMeta) Update ¶
func (m *AttributeMeta) Update(meta AttributeMeta)
Update *selectively* updates the content of this AttributeMeta (m) with non-empty values in the given meta.
type ComputeAttributes ¶
type ComputeAttributes struct {
Meta *AttributeMeta `json:"meta"`
CPUs int64 `json:"cpus"`
RAM int64 `json:"ram"`
}
func (ComputeAttributes) GetGenericMappings ¶
func (a ComputeAttributes) GetGenericMappings() map[string]interface{}
func (ComputeAttributes) GetMeta ¶
func (a ComputeAttributes) GetMeta() *AttributeMeta
func (ComputeAttributes) String ¶
func (a ComputeAttributes) String() string
func (ComputeAttributes) Update ¶
func (a ComputeAttributes) Update(other Attribute) error
TODO: duplicate this for the others too
type Configstate ¶
type Configstate struct {
State string `json:"state"`
LastUpdateTime uint64 `json:"last_update_time"`
}
func (Configstate) String ¶
func (c Configstate) String() string
type ConflictingAttributeFound ¶
type ConflictingAttributeFound struct {
// contains filtered or unexported fields
}
func (ConflictingAttributeFound) Error ¶
func (e ConflictingAttributeFound) Error() string
type CounterPartyPropertyAttributes ¶
type CounterPartyPropertyAttributes struct {
Meta *AttributeMeta `json:"meta"`
Expression map[string]interface{} `json:"expression"`
}
func (CounterPartyPropertyAttributes) GetGenericMappings ¶
func (a CounterPartyPropertyAttributes) GetGenericMappings() map[string]interface{}
func (CounterPartyPropertyAttributes) GetMeta ¶
func (a CounterPartyPropertyAttributes) GetMeta() *AttributeMeta
func (CounterPartyPropertyAttributes) String ¶
func (a CounterPartyPropertyAttributes) String() string
func (CounterPartyPropertyAttributes) Update ¶
func (a CounterPartyPropertyAttributes) Update(other Attribute) error
TODO: duplicate this for the others too
type DatabaseEventSource ¶
type DatabaseEventSource struct {
}
func NewDatabaseEventSource ¶
func NewDatabaseEventSource() *DatabaseEventSource
func (DatabaseEventSource) Matches ¶
func (w DatabaseEventSource) Matches(selectors map[string][]Selector) bool
func (DatabaseEventSource) ShortString ¶
func (w DatabaseEventSource) ShortString() string
func (DatabaseEventSource) String ¶
func (w DatabaseEventSource) String() string
type DeploymentConfig ¶
type DockerRegistryAuthAttributes ¶
type DockerRegistryAuthAttributes struct {
Meta *AttributeMeta `json:"meta"`
Auths []Auth `json:"auths"`
}
func (DockerRegistryAuthAttributes) AddAuth ¶
func (a DockerRegistryAuthAttributes) AddAuth(auth_new Auth)
add a new auth token to this registery
func (DockerRegistryAuthAttributes) DeleteAuth ¶
func (a DockerRegistryAuthAttributes) DeleteAuth(auth_in Auth)
delete the given auth from this registery
func (DockerRegistryAuthAttributes) GetGenericMappings ¶
func (a DockerRegistryAuthAttributes) GetGenericMappings() map[string]interface{}
func (DockerRegistryAuthAttributes) GetMeta ¶
func (a DockerRegistryAuthAttributes) GetMeta() *AttributeMeta
func (DockerRegistryAuthAttributes) String ¶
func (a DockerRegistryAuthAttributes) String() string
func (DockerRegistryAuthAttributes) Update ¶
func (a DockerRegistryAuthAttributes) Update(other Attribute) error
type EAFilter ¶
type EAFilter func(EstablishedAgreement) bool
filter on EstablishedAgreements
func IdEAFilter ¶
func UnarchivedEAFilter ¶
func UnarchivedEAFilter() EAFilter
type EstablishedAgreement ¶
type EstablishedAgreement struct {
Name string `json:"name"`
SensorUrl []string `json:"sensor_url"`
Archived bool `json:"archived"`
CurrentAgreementId string `json:"current_agreement_id"`
ConsumerId string `json:"consumer_id"`
CounterPartyAddress string `json:"counterparty_address"`
AgreementCreationTime uint64 `json:"agreement_creation_time"`
AgreementAcceptedTime uint64 `json:"agreement_accepted_time"`
AgreementBCUpdateAckTime uint64 `json:"agreement_bc_update_ack_time"` // V2 protocol - time when consumer acks our blockchain update
AgreementFinalizedTime uint64 `json:"agreement_finalized_time"`
AgreementTerminatedTime uint64 `json:"agreement_terminated_time"`
AgreementForceTerminatedTime uint64 `json:"agreement_force_terminated_time"`
AgreementExecutionStartTime uint64 `json:"agreement_execution_start_time"`
AgreementDataReceivedTime uint64 `json:"agreement_data_received_time"`
// One of the following 2 fields are set when the worker that owns deployment for this agreement, starts deploying the services in the agreement.
CurrentDeployment map[string]ServiceConfig `json:"current_deployment"` // Native Horizon deployment config goes here, mutually exclusive with the extended deployment field. This field is set before the torrent worker starts the workload.
ExtendedDeployment map[string]interface{} `json:"extended_deployment"` // All non-native deployment configs go here. This field is set before the helm worker installs the release.
Proposal string `json:"proposal"`
ProposalSig string `json:"proposal_sig"` // the proposal currently in effect
AgreementProtocol string `json:"agreement_protocol"` // the agreement protocol being used. It is also in the proposal.
ProtocolVersion int `json:"protocol_version"` // the agreement protocol version being used.
TerminatedReason uint64 `json:"terminated_reason"` // the reason that the agreement was terminated
TerminatedDescription string `json:"terminated_description"` // a string form of the reason that the agreement was terminated
AgreementProtocolTerminatedTime uint64 `json:"agreement_protocol_terminated_time"`
WorkloadTerminatedTime uint64 `json:"workload_terminated_time"`
MeteringNotificationMsg MeteringNotification `json:"metering_notification,omitempty"` // the most recent metering notification received
BlockchainType string `json:"blockchain_type,omitempty"` // the name of the type of the blockchain
BlockchainName string `json:"blockchain_name,omitempty"` // the name of the blockchain instance
BlockchainOrg string `json:"blockchain_org,omitempty"` // the org of the blockchain instance
RunningWorkload WorkloadInfo `json:"workload_to_run,omitempty"` // For display purposes, a copy of the workload info that this agreement is managing. It should be the same info that is buried inside the proposal.
}
N.B. Important!! Ensure new values are handled in Update function below This struct is for persisting agreements
func AgreementDeploymentStarted ¶
func AgreementDeploymentStarted(db *bolt.DB, dbAgreementId string, protocol string, deployment DeploymentConfig) (*EstablishedAgreement, error)
set deployment config because execution is about to begin
func AgreementStateAccepted ¶
func AgreementStateAccepted(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
set agreement state to accepted, a positive reply is being sent
func AgreementStateAgreementProtocolTerminated ¶
func AgreementStateAgreementProtocolTerminated(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
set agreement state to agreement protocol terminated
func AgreementStateBCDataReceived ¶
func AgreementStateBCDataReceived(db *bolt.DB, dbAgreementId string, protocol string, address string) (*EstablishedAgreement, error)
set the eth counterparty address when it is received from the consumer
func AgreementStateBCUpdateAcked ¶
func AgreementStateBCUpdateAcked(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
set the time when out agreement blockchain update message was Ack'd.
func AgreementStateDataReceived ¶
func AgreementStateDataReceived(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
set agreement state to data received
func AgreementStateExecutionStarted ¶
func AgreementStateExecutionStarted(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
set agreement state to execution started
func AgreementStateFinalized ¶
func AgreementStateFinalized(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
set agreement state to finalized
func AgreementStateForceTerminated ¶
func AgreementStateForceTerminated(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
reset agreement state to not-terminated so that we can retry the termination
func AgreementStateProposalSigned ¶
func AgreementStateProposalSigned(db *bolt.DB, dbAgreementId string, protocol string, sig string) (*EstablishedAgreement, error)
set the eth signature of the proposal
func AgreementStateTerminated ¶
func AgreementStateTerminated(db *bolt.DB, dbAgreementId string, reason uint64, reasonString string, protocol string) (*EstablishedAgreement, error)
set agreement state to terminated
func AgreementStateWorkloadTerminated ¶
func AgreementStateWorkloadTerminated(db *bolt.DB, dbAgreementId string, protocol string) (*EstablishedAgreement, error)
set agreement state to workload terminated
func MeteringNotificationReceived ¶
func MeteringNotificationReceived(db *bolt.DB, dbAgreementId string, mn MeteringNotification, protocol string) (*EstablishedAgreement, error)
set agreement state to workload terminated
func NewEstablishedAgreement ¶
func (*EstablishedAgreement) GetDeploymentConfig ¶
func (a *EstablishedAgreement) GetDeploymentConfig() DeploymentConfig
Return either the CurrentDeployment or the ExtendedDeployment, depending on which is set, in a form that implements the DeploymentConfig interface.
func (EstablishedAgreement) String ¶
func (c EstablishedAgreement) String() string
type EventLog ¶
type EventLog struct {
EventLogBase
Source EventSourceInterface `json:"event_source"` // source involved for this event.
}
func FindAllEventLogs ¶
find all event logs from the db
func FindEventLogWithKey ¶
Find the event log from the db
func FindEventLogs ¶
func FindEventLogs(db *bolt.DB, filters []EventLogFilter) ([]EventLog, error)
find event logs from the db for the given filters
func FindEventLogsWithSelectors ¶
func FindEventLogsWithSelectors(db *bolt.DB, all_logs bool, selectors map[string][]Selector) ([]EventLog, error)
find event logs from the db for the given given selectors. If all_logs is false, only the event logs for the current registration is returned.
func NewEventLog ¶
func (EventLog) IsSourceType ¶
Checks the source type of the event log. An eventlog can belong to different source types at the same time.
func (EventLog) Matches ¶
Checks if the event log matches the selectors For example:
selectors = [string][]Selector{
"a": [{"~": "test"}, {"~", "agreement"}],
"b": [{"=", "this is a test"}],
"c":[{">", 100}]
}
It means checking if this event log matches the following logic:
the attribute "a" contains the word "test" and "agreement", and attribute "b" equals "this is a test" and attribute "c" is greater than 100.
func (EventLog) Matches2 ¶
func (w EventLog) Matches2(base_selectors map[string][]Selector, source_selectors map[string][]Selector) bool
Checks if the event log matches the base selectors and source selectors
func (EventLog) ShortString ¶
type EventLogBase ¶
type EventLogBase struct {
Id string `json:"record_id"` // unique primary key for records
Timestamp uint64 `json:"timestamp"`
Severity string `json:"severity"` // info, warning or error
Message string `json:"message"`
EventCode string `json:"event_code"`
SourceType string `json:"source_type"` // the type of the source. It can be agreement, service, image, workload etc.
}
type EventLogFilter ¶
filter on MicroserviceDefinition
func SelectorFilter ¶
func SelectorFilter(selectors map[string][]Selector) EventLogFilter
filter on the source type and value
func SourceTypeELFilter ¶
func SourceTypeELFilter(source_type string) EventLogFilter
filter on source type
type EventLogRaw ¶
type EventLogRaw struct {
EventLogBase
Source *json.RawMessage `json:"event_source"` // source involved for this event.
}
type EventSourceInterface ¶
type EventSourceInterface interface {
//Used for searching. The input is a map of selector array.
// The input is a map of selector array.
// For example:
// selectors = [string][]Selector{
// "a": [{"~": "test"}, {"~", "agreement"}],
// "b": [{"=", "this is a test"}],
// "c":[{">", 100}]
// }
// It means checking if this event source matches the following logic:
// the attribute "a" contains the word "test" and "agreement",
// attribute "b" equals "this is a test" and attribute "c" is greater than 100.
Matches(map[string][]Selector) bool
}
Each event source implements this interface.
type ExchangeDevice ¶
type ExchangeDevice struct {
Id string `json:"id"`
Org string `json:"organization"`
Pattern string `json:"pattern"`
Name string `json:"name"`
Token string `json:"token"`
TokenLastValidTime uint64 `json:"token_last_valid_time"`
TokenValid bool `json:"token_valid"`
HA bool `json:"ha"`
Config Configstate `json:"configstate"`
}
func FindExchangeDevice ¶
func FindExchangeDevice(db *bolt.DB) (*ExchangeDevice, error)
func SaveNewExchangeDevice ¶
func SaveNewExchangeDevice(db *bolt.DB, id string, token string, name string, ha bool, organization string, pattern string, configstate string) (*ExchangeDevice, error)
always assumed the given token is valid at the time of call
func (ExchangeDevice) GetId ¶
func (e ExchangeDevice) GetId() string
func (*ExchangeDevice) InvalidateExchangeToken ¶
func (e *ExchangeDevice) InvalidateExchangeToken(db *bolt.DB) (*ExchangeDevice, error)
a convenience function b/c we know there is really only one device
func (*ExchangeDevice) IsState ¶
func (e *ExchangeDevice) IsState(state string) bool
func (*ExchangeDevice) SetConfigstate ¶
func (e *ExchangeDevice) SetConfigstate(db *bolt.DB, deviceId string, state string) (*ExchangeDevice, error)
func (*ExchangeDevice) SetExchangeDeviceToken ¶
func (e *ExchangeDevice) SetExchangeDeviceToken(db *bolt.DB, deviceId string, token string) (*ExchangeDevice, error)
func (ExchangeDevice) String ¶
func (e ExchangeDevice) String() string
type ExchangeEventSource ¶
type ExchangeEventSource struct {
ExchangeUrl string `json:"exchange_url"`
}
func NewExchangeEventSource ¶
func NewExchangeEventSource(exchange_url string) *ExchangeEventSource
func (ExchangeEventSource) Matches ¶
func (w ExchangeEventSource) Matches(selectors map[string][]Selector) bool
func (ExchangeEventSource) ShortString ¶
func (w ExchangeEventSource) ShortString() string
func (ExchangeEventSource) String ¶
func (w ExchangeEventSource) String() string
type HAAttributes ¶
type HAAttributes struct {
Meta *AttributeMeta `json:"meta"`
Partners []string `json:"partners"`
}
func (HAAttributes) GetGenericMappings ¶
func (a HAAttributes) GetGenericMappings() map[string]interface{}
func (HAAttributes) GetMeta ¶
func (a HAAttributes) GetMeta() *AttributeMeta
func (HAAttributes) PartnersContains ¶
func (a HAAttributes) PartnersContains(id string) bool
func (HAAttributes) String ¶
func (a HAAttributes) String() string
func (HAAttributes) Update ¶
func (a HAAttributes) Update(other Attribute) error
TODO: duplicate this for the others too
type HTTPSBasicAuthAttributes ¶
type HTTPSBasicAuthAttributes struct {
Meta *AttributeMeta `json:"meta"`
Username string `json:"username"`
Password string `json:"password"`
}
func (HTTPSBasicAuthAttributes) GetGenericMappings ¶
func (a HTTPSBasicAuthAttributes) GetGenericMappings() map[string]interface{}
func (HTTPSBasicAuthAttributes) GetMeta ¶
func (a HTTPSBasicAuthAttributes) GetMeta() *AttributeMeta
func (HTTPSBasicAuthAttributes) String ¶
func (a HTTPSBasicAuthAttributes) String() string
func (HTTPSBasicAuthAttributes) Update ¶
func (a HTTPSBasicAuthAttributes) Update(other Attribute) error
type HardwareMatch ¶
type HardwareMatch map[string]interface{}
type HelmDeploymentConfig ¶
type HelmDeploymentConfig struct {
ChartArchive string `json:"chart_archive"` // base64 encoded binary of helm package tar file
ReleaseName string `json:"release_name"`
}
func GetHelmDeployment ¶
func GetHelmDeployment(depStr string) (*HelmDeploymentConfig, error)
Given a deployment string, unmarshal it as a HelmDeployment object. It might not be a HelmDeployment, so we have to verify what was just unmarshalled.
func NewHelmDeployment ¶
func NewHelmDeployment(chartArchive string, releaseName string) *HelmDeploymentConfig
func (*HelmDeploymentConfig) FromPersistentForm ¶
func (h *HelmDeploymentConfig) FromPersistentForm(pf map[string]interface{}) error
func (*HelmDeploymentConfig) IsNative ¶
func (h *HelmDeploymentConfig) IsNative() bool
func (HelmDeploymentConfig) String ¶
func (h HelmDeploymentConfig) String() string
func (*HelmDeploymentConfig) ToPersistentForm ¶
func (h *HelmDeploymentConfig) ToPersistentForm() (map[string]interface{}, error)
func (*HelmDeploymentConfig) ToString ¶
func (h *HelmDeploymentConfig) ToString() string
type ImplementationPackage ¶
type ImplementationPackage map[string]interface{}
func (ImplementationPackage) ConvertToTorrent ¶
func (i ImplementationPackage) ConvertToTorrent() Torrent
The ImplementationPackage object can be converted to a Torrent type field when the implementation package is using the image server packaging model. The ImplementationPackage object must specify the storeType of the image server and it must include the image server fields; url and signature. If this function is unable to convert to a Torrent object then an empty Torrent object is returned.
func (ImplementationPackage) String ¶
func (i ImplementationPackage) String() string
type LocationAttributes ¶
type LocationAttributes struct {
Meta *AttributeMeta `json:"meta"`
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
LocationAccuracyKM float64 `json:"location_accuracy_km"` // a fudge factor so as not to reveal exact lat lon location
UseGps bool `json:"use_gps"` // a statement of preference; does not indicate that there is a GPS device
}
particular service preferences
func (LocationAttributes) GetGenericMappings ¶
func (a LocationAttributes) GetGenericMappings() map[string]interface{}
func (LocationAttributes) GetMeta ¶
func (a LocationAttributes) GetMeta() *AttributeMeta
func (LocationAttributes) String ¶
func (a LocationAttributes) String() string
func (LocationAttributes) Update ¶
func (a LocationAttributes) Update(other Attribute) error
type MIFilter ¶
type MIFilter func(MicroserviceInstance) bool
filter on MicroserviceInstance
func AllInstancesMIFilter ¶
filter for all the microservice instances for the given url and version
func NotCleanedUpMIFilter ¶
func NotCleanedUpMIFilter() MIFilter
func UnarchivedMIFilter ¶
func UnarchivedMIFilter() MIFilter
type MSFilter ¶
type MSFilter func(MicroserviceDefinition) bool
filter on MicroserviceDefinition
func UrlMSFilter ¶
filter for all the microservice defs for the given url
func UrlOrgVersionMSFilter ¶
filter on the url + version + org
func UrlVersionMSFilter ¶
filter on the url + version
type MetaAttributesOnly ¶
type MetaAttributesOnly struct {
Meta *AttributeMeta `json:"meta"`
}
func (MetaAttributesOnly) GetGenericMappings ¶
func (a MetaAttributesOnly) GetGenericMappings() map[string]interface{}
func (MetaAttributesOnly) GetMeta ¶
func (a MetaAttributesOnly) GetMeta() *AttributeMeta
type MeteringAttributes ¶
type MeteringAttributes struct {
Meta *AttributeMeta `json:"meta"`
Tokens uint64 `json:"tokens"`
PerTimeUnit string `json:"per_time_unit"`
NotificationIntervalS int `json:"notification_interval"`
}
func (MeteringAttributes) GetGenericMappings ¶
func (a MeteringAttributes) GetGenericMappings() map[string]interface{}
func (MeteringAttributes) GetMeta ¶
func (a MeteringAttributes) GetMeta() *AttributeMeta
func (MeteringAttributes) String ¶
func (a MeteringAttributes) String() string
func (MeteringAttributes) Update ¶
func (a MeteringAttributes) Update(other Attribute) error
TODO: duplicate this for the others too
type MeteringNotification ¶
type MeteringNotification struct {
Amount uint64 `json:"amount"` // The number of tokens granted by this notification, rounded to the nearest minute
StartTime uint64 `json:"start_time"` // The time when the agreement started, in seconds since 1970.
CurrentTime uint64 `json:"current_time"` // The time when the notification was sent, in seconds since 1970.
MissedTime uint64 `json:"missed_time"` // The amount of time in seconds that the consumer detected missing data
ConsumerMeterSignature string `json:"consumer_meter_signature"` // The consumer's signature of the meter (amount, current time, agreement Id)
AgreementHash string `json:"agreement_hash"` // The 32 byte SHA3 FIPS 202 hash of the proposal for the agreement.
ConsumerSignature string `json:"consumer_agreement_signature"` // The consumer's signature of the agreement hash.
ConsumerAddress string `json:"consumer_address"` // The consumer's blockchain account/address.
ProducerSignature string `json:"producer_agreement_signature"` // The producer's signature of the agreement
BlockchainType string `json:"blockchain_type"` // The type of the blockchain that this notification is intended to work with
}
func (MeteringNotification) String ¶
func (m MeteringNotification) String() string
type MicroserviceDefinition ¶
type MicroserviceDefinition struct {
Id string `json:"record_id"` // unique primary key for records
Owner string `json:"owner"`
Label string `json:"label"`
Description string `json:"description"`
SpecRef string `json:"specRef"`
Org string `json:"organization"`
Version string `json:"version"`
Arch string `json:"arch"`
Sharable string `json:"sharable"`
DownloadURL string `json:"downloadUrl"`
MatchHardware HardwareMatch `json:"matchHardware"`
UserInputs []UserInput `json:"userInput"`
Workloads []WorkloadDeployment `json:"workloads"` // Only used by old microservice definitions
Public bool `json:"public"` // Used by only services, indicates if the definition is public or not.
RequiredServices []ServiceDependency `json:"requiredServices"` // Used only by services, the list of services that this service depends on.
Deployment string `json:"deployment"` // Used only by services, the deployment configuration of the implementation packages.
DeploymentSignature string `json:"deployment_signature"` // Used only by services, the signature of the deployment configuration.
ImageStore ImplementationPackage `json:"imageStore"` // Used by services, the metadata that describes how to get the service implementation package(s).
LastUpdated string `json:"lastUpdated"`
Archived bool `json:"archived"`
Name string `json:"name"` //the sensor_name passed in from the POST /service call
RequestedArch string `json:"requested_arch"` //the arch from user input or from the ms referenced by a workload, it can be a synonym of the node arch.
UpgradeVersionRange string `json:"upgrade_version_range"` //the sensor_version passed in from the POST service call
AutoUpgrade bool `json:"auto_upgrade"` // passed in from the POST service call
ActiveUpgrade bool `json:"active_upgrade"` // passed in from the POST service call
UpgradeStartTime uint64 `json:"upgrade_start_time"`
UpgradeMsUnregisteredTime uint64 `json:"upgrade_ms_unregistered_time"`
UpgradeAgreementsClearedTime uint64 `json:"upgrade_agreements_cleared_time"`
UpgradeExecutionStartTime uint64 `json:"upgrade_execution_start_time"`
UpgradeMsReregisteredTime uint64 `json:"upgrade_ms_reregistered_time"`
UpgradeFailedTime uint64 `json:"upgrade_failed_time"`
UngradeFailureReason uint64 `json:"upgrade_failure_reason"`
UngradeFailureDescription string `json:"upgrade_failure_description"`
UpgradeNewMsId string `json:"upgrade_new_ms_id"`
MetadataHash []byte `json:"metadata_hash"` // the hash of the whole exchange.MicroserviceDefinition
}
func FindMicroserviceDefWithKey ¶
func FindMicroserviceDefWithKey(db *bolt.DB, key string) (*MicroserviceDefinition, error)
find the microservice definition from the db
func FindMicroserviceDefs ¶
func FindMicroserviceDefs(db *bolt.DB, filters []MSFilter) ([]MicroserviceDefinition, error)
find the microservice instance from the db
func FindUnarchivedMicroserviceDefs ¶
func FindUnarchivedMicroserviceDefs(db *bolt.DB, url string) ([]MicroserviceDefinition, error)
find the unarchived microservice definitions for the given url
func MSDefUpgradeExecutionStarted ¶
func MSDefUpgradeExecutionStarted(db *bolt.DB, key string) (*MicroserviceDefinition, error)
func MSDefUpgradeFailed ¶
func MSDefUpgradeMsReregistered ¶
func MSDefUpgradeMsReregistered(db *bolt.DB, key string) (*MicroserviceDefinition, error)
func MSDefUpgradeMsUnregistered ¶
func MSDefUpgradeMsUnregistered(db *bolt.DB, key string) (*MicroserviceDefinition, error)
func MSDefUpgradeNewMsId ¶
func MSDefUpgradeStarted ¶
func MSDefUpgradeStarted(db *bolt.DB, key string) (*MicroserviceDefinition, error)
func MsDefArchived ¶
func MsDefArchived(db *bolt.DB, key string) (*MicroserviceDefinition, error)
set the msdef to archived
func MsDefUnarchived ¶
func MsDefUnarchived(db *bolt.DB, key string) (*MicroserviceDefinition, error)
set the msdef to un-archived
func MsDefUpgradeAgreementsCleared ¶
func MsDefUpgradeAgreementsCleared(db *bolt.DB, key string) (*MicroserviceDefinition, error)
func (*MicroserviceDefinition) GetDeployment ¶
func (m *MicroserviceDefinition) GetDeployment() (string, string, string)
Returns the deployment string and signature of a ms def.
func (*MicroserviceDefinition) GetImageStore ¶
func (m *MicroserviceDefinition) GetImageStore() ImplementationPackage
func (*MicroserviceDefinition) GetUserInputName ¶
func (w *MicroserviceDefinition) GetUserInputName(name string) *UserInput
func (*MicroserviceDefinition) HasDeployment ¶
func (m *MicroserviceDefinition) HasDeployment() bool
func (*MicroserviceDefinition) HasRequiredServices ¶
func (m *MicroserviceDefinition) HasRequiredServices() bool
func (*MicroserviceDefinition) NeedsUserInput ¶
func (m *MicroserviceDefinition) NeedsUserInput() string
func (MicroserviceDefinition) ShortString ¶
func (w MicroserviceDefinition) ShortString() string
func (MicroserviceDefinition) String ¶
func (w MicroserviceDefinition) String() string
type MicroserviceInstance ¶
type MicroserviceInstance struct {
SpecRef string `json:"ref_url"`
Version string `json:"version"`
Arch string `json:"arch"`
InstanceId string `json:"instance_id"`
Archived bool `json:"archived"`
InstanceCreationTime uint64 `json:"instance_creation_time"`
ExecutionStartTime uint64 `json:"execution_start_time"`
ExecutionFailureCode uint `json:"execution_failure_code"`
ExecutionFailureDesc string `json:"execution_failure_desc"`
CleanupStartTime uint64 `json:"cleanup_start_time"`
AssociatedAgreements []string `json:"associated_agreements"`
MicroserviceDefId string `json:"microservicedef_id"`
ParentPath [][]ServiceInstancePathElement `json:"service_instance_path"` // Set when instance is created
AgreementLess bool `json:"agreement_less"` // Set when the service instance was started because it is an agreement-less service (as defined in the pattern)
}
func ArchiveMicroserviceInstance ¶
func ArchiveMicroserviceInstance(db *bolt.DB, key string) (*MicroserviceInstance, error)
func DeleteMicroserviceInstance ¶
func DeleteMicroserviceInstance(db *bolt.DB, key string) (*MicroserviceInstance, error)
delete a microservice instance from db. It will NOT return error if it does not exist in the db
func FindMicroserviceInstance ¶
func FindMicroserviceInstance(db *bolt.DB, url string, version string, instance_id string) (*MicroserviceInstance, error)
find the microservice instance from the db
func FindMicroserviceInstanceWithKey ¶
func FindMicroserviceInstanceWithKey(db *bolt.DB, key string) (*MicroserviceInstance, error)
find the microservice instance from the db
func FindMicroserviceInstances ¶
func FindMicroserviceInstances(db *bolt.DB, filters []MIFilter) ([]MicroserviceInstance, error)
find the microservice instance from the db
func MicroserviceInstanceCleanupStarted ¶
func MicroserviceInstanceCleanupStarted(db *bolt.DB, key string) (*MicroserviceInstance, error)
func NewMicroserviceInstance ¶
func NewMicroserviceInstance(db *bolt.DB, ref_url string, version string, msdef_id string, dependencyPath []ServiceInstancePathElement) (*MicroserviceInstance, error)
create a new microservice instance and save it to db.
func UpdateMSInstanceAddDependencyPath ¶
func UpdateMSInstanceAddDependencyPath(db *bolt.DB, key string, dp *[]ServiceInstancePathElement) (*MicroserviceInstance, error)
func UpdateMSInstanceAgreementLess ¶
func UpdateMSInstanceAgreementLess(db *bolt.DB, key string) (*MicroserviceInstance, error)
func UpdateMSInstanceAssociatedAgreements ¶
func UpdateMSInstanceAssociatedAgreements(db *bolt.DB, key string, add bool, agreement_id string) (*MicroserviceInstance, error)
add or delete an associated agreement id to/from the microservice instance in the db
func UpdateMSInstanceExecutionState ¶
func UpdateMSInstanceExecutionState(db *bolt.DB, key string, started bool, failure_code uint, failure_desc string) (*MicroserviceInstance, error)
set microservice instance state to execution started or failed
func (MicroserviceInstance) GetKey ¶
func (m MicroserviceInstance) GetKey() string
create a unique name for a microservice def If SpecRef is https://bluehorizon.network/microservices/network, version is 2.3.1 and the instance id is "abcd1234" the output string will be "bluehorizon.network-microservices-network_2.3.1_abcd1234"
func (*MicroserviceInstance) HasDirectParent ¶
func (m *MicroserviceInstance) HasDirectParent(parent *ServiceInstancePathElement) bool
Check if this microservice instance has a direct parent.
func (MicroserviceInstance) HasWorkload ¶
func (m MicroserviceInstance) HasWorkload(db *bolt.DB) (bool, error)
Check if this microservice instance has a container dpeloyment. If it does not, then there is no nothing to execute.
func (MicroserviceInstance) String ¶
func (w MicroserviceInstance) String() string
type NativeDeploymentConfig ¶
type NativeDeploymentConfig struct {
Services map[string]ServiceConfig
}
func (*NativeDeploymentConfig) FromPersistentForm ¶
func (n *NativeDeploymentConfig) FromPersistentForm(pf map[string]interface{}) error
func (*NativeDeploymentConfig) IsNative ¶
func (n *NativeDeploymentConfig) IsNative() bool
func (*NativeDeploymentConfig) ToPersistentForm ¶
func (n *NativeDeploymentConfig) ToPersistentForm() (map[string]interface{}, error)
func (*NativeDeploymentConfig) ToString ¶
func (n *NativeDeploymentConfig) ToString() string
type NodeEventSource ¶
type NodeEventSource struct {
Id string `json:"node_id"`
Org string `json:"node_org"`
Pattern string `json:"pattern"` // fprmat: pattern_org/pattern
ConfigState string `json:"config_state"`
}
func NewNodeEventSource ¶
func NewNodeEventSource(id string, org string, pattern string, state string) *NodeEventSource
func (NodeEventSource) Matches ¶
func (w NodeEventSource) Matches(selectors map[string][]Selector) bool
func (NodeEventSource) ShortString ¶
func (w NodeEventSource) ShortString() string
func (NodeEventSource) String ¶
func (w NodeEventSource) String() string
type OverwriteCandidateNotFound ¶
type OverwriteCandidateNotFound struct {
// contains filtered or unexported fields
}
func (OverwriteCandidateNotFound) Error ¶
func (e OverwriteCandidateNotFound) Error() string
type PropertyAttributes ¶
type PropertyAttributes struct {
Meta *AttributeMeta `json:"meta"`
Mappings map[string]interface{} `json:"mappings"`
}
func (PropertyAttributes) GetGenericMappings ¶
func (a PropertyAttributes) GetGenericMappings() map[string]interface{}
func (PropertyAttributes) GetMeta ¶
func (a PropertyAttributes) GetMeta() *AttributeMeta
func (PropertyAttributes) String ¶
func (a PropertyAttributes) String() string
func (PropertyAttributes) Update ¶
func (a PropertyAttributes) Update(other Attribute) error
TODO: duplicate this for the others too
type Selector ¶
type Selector struct {
Op string
MatchValue interface{}
}
func ConvertToSelectorType ¶
convert the given string to a selecor
type ServiceConfig ¶
type ServiceConfig struct {
Config docker.Config `json:"config"`
HostConfig docker.HostConfig `json:"host_config"`
}
the internal representation of this lib; *this is the one persisted using the persistence lib*
func (ServiceConfig) String ¶
func (c ServiceConfig) String() string
type ServiceDependency ¶
type ServiceDependency struct {
URL string `json:"url"`
Org string `json:"org"`
Version string `json:"version"`
Arch string `json:"arch"`
}
func NewServiceDependency ¶
func NewServiceDependency(url string, org string, version string, arch string) *ServiceDependency
type ServiceEventSource ¶
type ServiceEventSource struct {
InstanceId string `json:"instance_id"`
ServiceUrl string `json:"service_url"`
Org string `json:"organization"`
Version string `json:"version"`
Arch string `json:"arch"`
AssociatedAgreements []string `json:"agreement_id"`
}
purposly made some of the attribute names the same as the AgreementEventSource for easy search.
func NewServiceEventSource ¶
func NewServiceEventSourceFromServiceDef ¶
func NewServiceEventSourceFromServiceDef(msdef MicroserviceDefinition) *ServiceEventSource
func NewServiceEventSourceFromServiceInstance ¶
func NewServiceEventSourceFromServiceInstance(msi MicroserviceInstance) *ServiceEventSource
func (ServiceEventSource) Matches ¶
func (w ServiceEventSource) Matches(selectors map[string][]Selector) bool
Check if this event log matches the input selection.
func (ServiceEventSource) ShortString ¶
func (w ServiceEventSource) ShortString() string
func (ServiceEventSource) String ¶
func (w ServiceEventSource) String() string
type ServiceInstancePathElement ¶
func NewServiceInstancePathElement ¶
func NewServiceInstancePathElement(url string, version string) *ServiceInstancePathElement
func (*ServiceInstancePathElement) IsSame ¶
func (s *ServiceInstancePathElement) IsSame(other *ServiceInstancePathElement) bool
type Torrent ¶
type UserInput ¶
type UserInputAttributes ¶
type UserInputAttributes struct {
Meta *AttributeMeta `json:"meta"`
Mappings map[string]interface{} `json:"mappings"`
}
func (UserInputAttributes) GetGenericMappings ¶
func (a UserInputAttributes) GetGenericMappings() map[string]interface{}
func (UserInputAttributes) GetMeta ¶
func (a UserInputAttributes) GetMeta() *AttributeMeta
func (UserInputAttributes) String ¶
func (a UserInputAttributes) String() string
func (UserInputAttributes) Update ¶
func (a UserInputAttributes) Update(other Attribute) error
type WorkloadDeployment ¶
type WorkloadDeployment struct {
Deployment string `json:"deployment"`
DeploymentSignature string `json:"deployment_signature"`
Torrent string `json:"torrent"`
}
func NewWorkloadDeployment ¶
func NewWorkloadDeployment(deployment string, deploy_sig string, torrent string) *WorkloadDeployment
type WorkloadInfo ¶
type WorkloadInfo struct {
URL string `json:"url,omitempty"`
Org string `json:"org,omitempty"`
Version string `json:"version,omitempty"`
Arch string `json:"arch,omitempty"`
}