microservice

package
v3.2.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MS_CLEAR_OLD_AGS_FAILED = 201
View Source
const MS_DEFAULT_ACTIVEUPGRADE = false
View Source
const MS_DEFAULT_AUTOUPGRADE = true

microservice defaults

View Source
const MS_DELETED_BY_DOWNGRADE_PROCESS = 208
View Source
const MS_DELETED_BY_UPGRADE_PROCESS = 205
View Source
const MS_DELETED_FOR_AG_ENDED = 206
View Source
const MS_EXEC_FAILED = 202
View Source
const MS_IMAGE_FETCH_FAILED = 207
View Source
const MS_IMAGE_LOAD_FAILED = 204
View Source
const MS_REREG_EXCH_FAILED = 203
View Source
const MS_UNREG_EXCH_FAILED = 200

microservice instance terminated reason code

Variables

This section is empty.

Functions

func ConvertServiceToPersistent

func ConvertServiceToPersistent(es *exchange.ServiceDefinition, org string) (*persistence.MicroserviceDefinition, error)

This function converts the structure from exchange service to persistence.

func CreateMicroserviceDef

func CreateMicroserviceDef(db *bolt.DB, service_name string, service_org string, service_version string, service_arch string,
	getService exchange.ServiceHandler) (*persistence.MicroserviceDefinition, error)

Create and save the MicroserviceDefiniton for given service. The service_version is a version range. Please make sure there is no MicroserviceDefinition for this service before calling this function.

func DecodeReasonCode

func DecodeReasonCode(code uint64) string

func FindOrCreateMicroserviceDef

func FindOrCreateMicroserviceDef(db *bolt.DB, service_name string, service_org string, service_version string, service_arch string,
	getService exchange.ServiceHandler) (*persistence.MicroserviceDefinition, error)

Find the MicroserviceDefinition object in the local db for the given service spec. The version is a version range. If not found, create one with hightest version within the range. TODO: we need to get the common version range if the msdef for this service exists.

func GenMicroservicePolicy

func GenMicroservicePolicy(msdef *persistence.MicroserviceDefinition, policyPath string, db *bolt.DB, e chan events.Message, deviceOrg string, pattern string) error

Generate a new policy file for given ms and then register the microservice in the exchange.

func GetRollbackMicroserviceDef

Get a msdef with a lower version compared to the given msdef version and return the new microservice def.

func GetUpgradeMicroserviceDef

Get the new microservice def that the given msdef need to upgrade to. This function gets the msdef with highest version within defined version range from the exchange and compare the version and content with the current msdef and decide if it needs to upgrade. It returns the new msdef if the old one needs to be upgraded, otherwide return nil.

func MicroserviceReadyForUpgrade

func MicroserviceReadyForUpgrade(msdef *persistence.MicroserviceDefinition, db *bolt.DB) bool

check if the given msdef is eligible for a upgrade

func RemoveMicroservicePolicy

func RemoveMicroservicePolicy(spec_ref string, org string, version string, msdef_id string, policy_path string, pm *policy.PolicyManager) error

Remove the policy for the given microservice and rename the policy file name.

func UnregisterMicroserviceExchange

func UnregisterMicroserviceExchange(getExchangeDevice exchange.DeviceHandler,
	patchExchangeDevice exchange.PatchDeviceHandler,
	spec_ref string, org string,
	device_id string, device_token string, db *bolt.DB) error

Unregisters the given microservice from the exchange

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL