Documentation ¶
Index ¶
- func ConvertAttributesToUserInput(attributes []persistence.UserInputAttributes) []policy.UserInput
- func ConvertUserInputToAttributes(userInput []policy.UserInput) []persistence.Attribute
- func DeleteNodePolicy(pDevice *persistence.ExchangeDevice, db *bolt.DB, ...) error
- func DeleteNodeUserInput(pDevice *persistence.ExchangeDevice, db *bolt.DB, ...) error
- func ExchangeNodePolicyChanged(pDevice *persistence.ExchangeDevice, db *bolt.DB, ...) (bool, *externalpolicy.ExternalPolicy, error)
- func ExchangeNodeUserInputChanged(pDevice *persistence.ExchangeDevice, db *bolt.DB, ...) (bool, []policy.UserInput, error)
- func GetChangedServices(oldUserInput, newUserInput []policy.UserInput) persistence.ServiceSpecs
- func GetExchangeSurfaceErrors(pDevice *persistence.ExchangeDevice, getErrors exchange.SurfaceErrorsHandler) (error, []persistence.SurfaceError)
- func GetProcessedExchangeNodePolicy(pDevice *persistence.ExchangeDevice, ...) (*exchange.ExchangePolicy, error)
- func HasPersistentAgreement(db *bolt.DB, serviceResolverHandler exchange.ServiceResolverHandler, ...) bool
- func HashUserInput(ui []policy.UserInput) ([]byte, error)
- func NodePolicyInitalSetup(db *bolt.DB, config *config.HorizonConfig, ...) (*externalpolicy.ExternalPolicy, error)
- func NodeUserInputInitalSetup(db *bolt.DB, getDevice exchange.DeviceHandler, ...) error
- func PatchNodePolicy(pDevice *persistence.ExchangeDevice, db *bolt.DB, patchObject interface{}, ...) (*externalpolicy.ExternalPolicy, error)
- func PatchNodeUserInput(pDevice *persistence.ExchangeDevice, db *bolt.DB, ...) error
- func PersistingEAFilter(agreementPersistentTime int) persistence.EAFilter
- func PutExchangeSurfaceErrors(pDevice *persistence.ExchangeDevice, ...) error
- func SaveNodeUserInput(pDevice *persistence.ExchangeDevice, db *bolt.DB, ...) error
- func SetDefaultNodePolicy(config *config.HorizonConfig, pDevice *persistence.ExchangeDevice, db *bolt.DB, ...) (*externalpolicy.ExternalPolicy, error)
- func SyncLocalUserInputWithExchange(db *bolt.DB, pDevice *persistence.ExchangeDevice, ...) (bool, persistence.ServiceSpecs, error)
- func SyncNodePolicyWithExchange(db *bolt.DB, pDevice *persistence.ExchangeDevice, ...) (bool, *externalpolicy.ExternalPolicy, error)
- func UpdateNodePolicy(pDevice *persistence.ExchangeDevice, db *bolt.DB, ...) error
- func UpdateNodeUserInput(pDevice *persistence.ExchangeDevice, db *bolt.DB, ...) (persistence.ServiceSpecs, error)
- func UpdateSurfaceErrors(db *bolt.DB, pDevice persistence.ExchangeDevice, ...) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAttributesToUserInput ¶
func ConvertAttributesToUserInput(attributes []persistence.UserInputAttributes) []policy.UserInput
func ConvertUserInputToAttributes ¶
func ConvertUserInputToAttributes(userInput []policy.UserInput) []persistence.Attribute
func DeleteNodePolicy ¶
func DeleteNodePolicy(pDevice *persistence.ExchangeDevice, db *bolt.DB, getExchangeNodePolicy exchange.NodePolicyHandler, deleteExchangeNodePolicy exchange.DeleteNodePolicyHandler) error
Delete the node policy from local db and the exchange
func DeleteNodeUserInput ¶
func DeleteNodeUserInput(pDevice *persistence.ExchangeDevice, db *bolt.DB, getDevice exchange.DeviceHandler, patchDevice exchange.PatchDeviceHandler) error
Delete the node user input from local db and the exchange
func ExchangeNodePolicyChanged ¶
func ExchangeNodePolicyChanged(pDevice *persistence.ExchangeDevice, db *bolt.DB, getExchangeNodePolicy exchange.NodePolicyHandler) (bool, *externalpolicy.ExternalPolicy, error)
check if the node policy has been changed from last sync. It returns the latest node policy on the exchange.
func ExchangeNodeUserInputChanged ¶
func ExchangeNodeUserInputChanged(pDevice *persistence.ExchangeDevice, db *bolt.DB, getDevice exchange.DeviceHandler) (bool, []policy.UserInput, error)
check if the node user input has been changed from last sync.
func GetChangedServices ¶
func GetChangedServices(oldUserInput, newUserInput []policy.UserInput) persistence.ServiceSpecs
Compare old and new user inputs and get a list of services that have been updated, added or deleted.
func GetExchangeSurfaceErrors ¶
func GetExchangeSurfaceErrors(pDevice *persistence.ExchangeDevice, getErrors exchange.SurfaceErrorsHandler) (error, []persistence.SurfaceError)
This function returns the node errors currently surfaced to the exchange
func GetProcessedExchangeNodePolicy ¶
func GetProcessedExchangeNodePolicy(pDevice *persistence.ExchangeDevice, getExchangeNodePolicy exchange.NodePolicyHandler, putExchangeNodePolicy exchange.PutNodePolicyHandler) (*exchange.ExchangePolicy, error)
This function retrievs the node's policy from the exchange, adds the node built-in properties if needed. Then it saves the new node policy to the exchange again and then returns the new node policy. If the exchange node policy already has the built-in properties, it just returns the one from the exchange.
func HasPersistentAgreement ¶
func HasPersistentAgreement(db *bolt.DB, serviceResolverHandler exchange.ServiceResolverHandler, pDevice persistence.ExchangeDevice, msgPrinter *message.Printer, errorLog persistence.SurfaceError, agreementPersistentTime int) bool
HasPersistentAgreement takes a recordID and returns true if there is a persistent agreement with the same workload on the node.
func NodePolicyInitalSetup ¶
func NodePolicyInitalSetup(db *bolt.DB, config *config.HorizonConfig, getExchangeNodePolicy exchange.NodePolicyHandler, putExchangeNodePolicy exchange.PutNodePolicyHandler) (*externalpolicy.ExternalPolicy, error)
If the both local and exchange node policy are not created, use the default. Otherwise, update the local node policy with the one from the exchange.
func NodeUserInputInitalSetup ¶
func NodeUserInputInitalSetup(db *bolt.DB, getDevice exchange.DeviceHandler, patchDevice exchange.PatchDeviceHandler) error
For backward compatibility. If the exchange node user input is not set and local nodes has UserInputAttributes, convert all UserInputAttributes to UserInput format and save it locally and on the exchange. If the exchange has node user input for this node, sync it to the local node. All UserInputAttributes will be removed. Exchange is the master.
func PatchNodePolicy ¶
func PatchNodePolicy(pDevice *persistence.ExchangeDevice, db *bolt.DB, patchObject interface{}, nodeGetPolicyHandler exchange.NodePolicyHandler, nodePutPolicyHandler exchange.PutNodePolicyHandler) (*externalpolicy.ExternalPolicy, error)
func PatchNodeUserInput ¶
func PatchNodeUserInput(pDevice *persistence.ExchangeDevice, db *bolt.DB, userInputs []policy.UserInput, getDevice exchange.DeviceHandler, patchDevice exchange.PatchDeviceHandler) error
Add the given user input to the exchange node user input.
func PersistingEAFilter ¶
func PersistingEAFilter(agreementPersistentTime int) persistence.EAFilter
PersistingEAFilter is a filter for searching for agreements that have persisted for a certain period.
func PutExchangeSurfaceErrors ¶
func PutExchangeSurfaceErrors(pDevice *persistence.ExchangeDevice, putErrors exchange.PutSurfaceErrorsHandler, errors []persistence.SurfaceError) error
func SaveNodeUserInput ¶
func SaveNodeUserInput(pDevice *persistence.ExchangeDevice, db *bolt.DB, userInputs []policy.UserInput, getDevice exchange.DeviceHandler, patchDevice exchange.PatchDeviceHandler) error
This fuction saves the given user input into exchange, and local db
func SetDefaultNodePolicy ¶
func SetDefaultNodePolicy(config *config.HorizonConfig, pDevice *persistence.ExchangeDevice, db *bolt.DB, getExchangeNodePolicy exchange.NodePolicyHandler, putExchangeNodePolicy exchange.PutNodePolicyHandler) (*externalpolicy.ExternalPolicy, error)
Sets the default node policy on local db and the exchange
func SyncLocalUserInputWithExchange ¶
func SyncLocalUserInputWithExchange(db *bolt.DB, pDevice *persistence.ExchangeDevice, getDevice exchange.DeviceHandler) (bool, persistence.ServiceSpecs, error)
Gets all the UserInputAttriutues from the DB and convert then into
func SyncNodePolicyWithExchange ¶
func SyncNodePolicyWithExchange(db *bolt.DB, pDevice *persistence.ExchangeDevice, getExchangeNodePolicy exchange.NodePolicyHandler, putExchangeNodePolicy exchange.PutNodePolicyHandler) (bool, *externalpolicy.ExternalPolicy, error)
Check the node policy changes on the exchange and update the local copy with the changes.
func UpdateNodePolicy ¶
func UpdateNodePolicy(pDevice *persistence.ExchangeDevice, db *bolt.DB, nodePolicy *externalpolicy.ExternalPolicy, nodeGetPolicyHandler exchange.NodePolicyHandler, nodePutPolicyHandler exchange.PutNodePolicyHandler) error
Update (create new or replace old) node policy on local db and the exchange
func UpdateNodeUserInput ¶
func UpdateNodeUserInput(pDevice *persistence.ExchangeDevice, db *bolt.DB, userInputs []policy.UserInput, getDevice exchange.DeviceHandler, patchDevice exchange.PatchDeviceHandler) (persistence.ServiceSpecs, error)
Update (create new or replace) node user input on local db and the exchange
func UpdateSurfaceErrors ¶
func UpdateSurfaceErrors(db *bolt.DB, pDevice persistence.ExchangeDevice, getErrors exchange.SurfaceErrorsHandler, putErrors exchange.PutSurfaceErrorsHandler, serviceResolverHandler exchange.ServiceResolverHandler, errorTimeout int, agreementPersistentTime int) int
UpdateSurfaceErrors is called periodically by a subwoker under the agreement worker. This will close any surfaced errors that have persistent related agreements and update the local and exchange copies. The node copy is the master EXCEPT for the hidden field of each error.
Types ¶
This section is empty.