producer

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: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EL_PROD_AG_EXISTS_IGNORE_PROPOSAL  = "Agreement %v already exists, ignoring proposal: %v"
	EL_PROD_ERR_DEMARSH_TC_FOR_AG      = "received error demarshalling TsAndCs for agrement %v, %v"
	EL_PROD_NODE_REJECTED_PROPOSAL_MSG = "Node received Proposal message using agreement %v for service %v/%v from the agbot %v."
	EL_PROD_NODE_REJECTED_PROPOSAL     = "Node rejected the proposal for service %v/%v."
	EL_PROD_ERR_HANDLE_PROPOSAL        = "Error handling proposal for service %v/%v. Error: %v"
)
View Source
const TERM_REASON_AGBOT_REQUESTED = "ConsumerCancelled"
View Source
const TERM_REASON_CONTAINER_FAILURE = "ContainerFailure"
View Source
const TERM_REASON_IMAGE_DATA_ERROR = "ImageDataError"
View Source
const TERM_REASON_IMAGE_FETCH_AUTH_FAILURE = "ImageFetchAuthorizationFailure"
View Source
const TERM_REASON_IMAGE_FETCH_FAILURE = "ImageFetchFailure"
View Source
const TERM_REASON_IMAGE_SIG_VERIF_FAILURE = "ImageSignatureVerificationFailure"
View Source
const TERM_REASON_MICROSERVICE_FAILURE = "MicroserviceFailure"
View Source
const TERM_REASON_MS_DOWNGRADE_REQUIRED = "MicroserviceDowngradeRequired"
View Source
const TERM_REASON_MS_IMAGE_FETCH_FAILURE = "MicroserviceImageFetchFailure"
View Source
const TERM_REASON_MS_IMAGE_LOAD_FAILURE = "MicroserviceImageLoadFailure"
View Source
const TERM_REASON_MS_UPGRADE_REQUIRED = "MicroserviceUpgradeRequired"
View Source
const TERM_REASON_NODE_SHUTDOWN = "NodeShutdown"
View Source
const TERM_REASON_NODE_USERINPUT_CHANGED = "NodeUserInputChanged"
View Source
const TERM_REASON_NOT_EXECUTED_TIMEOUT = "NotExecuted"
View Source
const TERM_REASON_NOT_FINALIZED_TIMEOUT = "NotFinalized"
View Source
const TERM_REASON_NO_REPLY_ACK = "NoReplyAck"
View Source
const TERM_REASON_POLICY_CHANGED = "PolicyChanged"

The list of termination reasons that should be supported by all agreement protocols. The caller can pass these into the GetTerminationCode API to get a protocol specific reason code for that termination reason.

View Source
const TERM_REASON_SERVICE_SUSPENDED = "ServiceSuspended"
View Source
const TERM_REASON_USER_REQUESTED = "UserRequested"
View Source
const TERM_REASON_WL_IMAGE_LOAD_FAILURE = "WorkloadImageLoadFailure"

Variables

View Source
var BPHlogString = func(v interface{}) string {
	return fmt.Sprintf("Producer Basic Protocol Handler %v", v)
}
View Source
var BPPHlogString = func(p string, v interface{}) string {
	return fmt.Sprintf("Base Producer Protocol Handler (%v): %v", p, v)
}

Functions

func ConvertToServiceSpecs

func ConvertToServiceSpecs(apiSpecs policy.APISpecList) persistence.ServiceSpecs

This function converts an array of APISpecification to an array of ServiceSpec

func MarkI18nMessages

func MarkI18nMessages()

This is does nothing useful at run time. This code is only used in compileing time to make the eventlog messages gets into the catalog so that they can be translated. The event log messages will be saved in English. But the CLI can request them in different languages.

Types

type BCInitializedCommand

type BCInitializedCommand struct {
	Msg *events.BlockchainClientInitializedMessage
}

==============================================================================================================

func (BCInitializedCommand) ShortString

func (c BCInitializedCommand) ShortString() string

type BCStoppingCommand

type BCStoppingCommand struct {
	Msg *events.BlockchainClientStoppingMessage
}

==============================================================================================================

func (BCStoppingCommand) ShortString

func (c BCStoppingCommand) ShortString() string

type BCWritableCommand

type BCWritableCommand struct {
	Msg events.AccountFundedMessage
}

==============================================================================================================

func NewBCWritableCommand

func NewBCWritableCommand(msg *events.AccountFundedMessage) *BCWritableCommand

func (BCWritableCommand) ShortString

func (c BCWritableCommand) ShortString() string

type BaseProducerProtocolHandler

type BaseProducerProtocolHandler struct {
	// contains filtered or unexported fields
}

func (*BaseProducerProtocolHandler) FindAgreementWithSameWorkload

func (w *BaseProducerProtocolHandler) FindAgreementWithSameWorkload(ph abstractprotocol.ProtocolHandler, tcpol_name string) (bool, error)

Check if there are current unarchived agreements that have the same workload.

func (*BaseProducerProtocolHandler) GetAgbotMessageEndpoint

func (w *BaseProducerProtocolHandler) GetAgbotMessageEndpoint(agbotId string) (string, []byte, error)

func (*BaseProducerProtocolHandler) GetKnownBlockchain

func (*BaseProducerProtocolHandler) GetSendMessage

func (w *BaseProducerProtocolHandler) GetSendMessage() func(mt interface{}, pay []byte) error

func (*BaseProducerProtocolHandler) GetServiceResolver

func (w *BaseProducerProtocolHandler) GetServiceResolver() func(wURL string, wOrg string, wVersion string, wArch string) (*policy.APISpecList, error)

func (*BaseProducerProtocolHandler) HandleExtensionMessages

func (b *BaseProducerProtocolHandler) HandleExtensionMessages(msg *events.ExchangeDeviceMessage, exchangeMsg *exchange.DeviceMessage) (bool, bool, string, error)

func (*BaseProducerProtocolHandler) HandleProposal

func (*BaseProducerProtocolHandler) MatchPattern

func (w *BaseProducerProtocolHandler) MatchPattern(tcPolicy *policy.Policy) (bool, error)

check if the proposal has the same pattern

func (*BaseProducerProtocolHandler) Name

func (*BaseProducerProtocolHandler) PersistProposal

func (w *BaseProducerProtocolHandler) PersistProposal(proposal abstractprotocol.Proposal, reply abstractprotocol.ProposalReply, tcPolicy *policy.Policy, protocolMsg string)

func (*BaseProducerProtocolHandler) SetBlockchainClientAvailable

func (c *BaseProducerProtocolHandler) SetBlockchainClientAvailable(cmd *BCInitializedCommand)

func (*BaseProducerProtocolHandler) SetBlockchainClientNotAvailable

func (c *BaseProducerProtocolHandler) SetBlockchainClientNotAvailable(cmd *BCStoppingCommand)

func (*BaseProducerProtocolHandler) TerminateAgreement

func (w *BaseProducerProtocolHandler) TerminateAgreement(ag *persistence.EstablishedAgreement, reason uint, mt interface{}, pph ProducerProtocolHandler)

func (*BaseProducerProtocolHandler) UpdateConsumer

func (*BaseProducerProtocolHandler) UpdateConsumers

func (b *BaseProducerProtocolHandler) UpdateConsumers()

type BasicProtocolHandler

type BasicProtocolHandler struct {
	*BaseProducerProtocolHandler
	// contains filtered or unexported fields
}

func (*BasicProtocolHandler) AcceptCommand

func (c *BasicProtocolHandler) AcceptCommand(cmd worker.Command) bool

func (*BasicProtocolHandler) AgreementProtocolHandler

func (c *BasicProtocolHandler) AgreementProtocolHandler(typeName string, name string, org string) abstractprotocol.ProtocolHandler

func (*BasicProtocolHandler) GetTerminationCode

func (c *BasicProtocolHandler) GetTerminationCode(reason string) uint

func (*BasicProtocolHandler) GetTerminationReason

func (c *BasicProtocolHandler) GetTerminationReason(code uint) string

func (*BasicProtocolHandler) HandleBlockchainEventMessage

func (c *BasicProtocolHandler) HandleBlockchainEventMessage(cmd *BlockchainEventCommand) (string, bool, uint64, bool, error)

func (*BasicProtocolHandler) HandleExtensionMessages

func (c *BasicProtocolHandler) HandleExtensionMessages(msg *events.ExchangeDeviceMessage, exchangeMsg *exchange.DeviceMessage) (bool, bool, string, error)

Returns 2 booleans, first is whether or not the message was handled, the second is whether or not to cancel the agreement in the protocol msg.

func (*BasicProtocolHandler) HandleProposalMessage

func (c *BasicProtocolHandler) HandleProposalMessage(proposal abstractprotocol.Proposal, protocolMsg string, exchangeMsg *exchange.DeviceMessage) bool

func (*BasicProtocolHandler) Initialize

func (c *BasicProtocolHandler) Initialize()

func (*BasicProtocolHandler) IsAgreementVerifiable

func (c *BasicProtocolHandler) IsAgreementVerifiable(ag *persistence.EstablishedAgreement) bool

func (*BasicProtocolHandler) IsBlockchainClientAvailable

func (c *BasicProtocolHandler) IsBlockchainClientAvailable(typeName string, name string, org string) bool

func (*BasicProtocolHandler) IsBlockchainWritable

func (c *BasicProtocolHandler) IsBlockchainWritable(agreement *persistence.EstablishedAgreement) bool

func (*BasicProtocolHandler) SetBlockchainWritable

func (c *BasicProtocolHandler) SetBlockchainWritable(cmd *BCWritableCommand)

func (*BasicProtocolHandler) String

func (c *BasicProtocolHandler) String() string

func (*BasicProtocolHandler) TerminateAgreement

func (c *BasicProtocolHandler) TerminateAgreement(ag *persistence.EstablishedAgreement, reason uint)

func (*BasicProtocolHandler) VerifyAgreement

func (c *BasicProtocolHandler) VerifyAgreement(ag *persistence.EstablishedAgreement) (bool, error)

type BlockchainEventCommand

type BlockchainEventCommand struct {
	Msg events.EthBlockchainEventMessage
}

==============================================================================================================

func (BlockchainEventCommand) ShortString

func (e BlockchainEventCommand) ShortString() string

type ExchangeMessageCommand

type ExchangeMessageCommand struct {
	Msg events.ExchangeDeviceMessage
}

==============================================================================================================

func (ExchangeMessageCommand) ShortString

func (e ExchangeMessageCommand) ShortString() string

type ProducerProtocolHandler

type ProducerProtocolHandler interface {
	Initialize()
	Name() string
	AcceptCommand(cmd worker.Command) bool
	AgreementProtocolHandler(typeName string, name string, org string) abstractprotocol.ProtocolHandler
	HandleProposalMessage(proposal abstractprotocol.Proposal, protocolMsg string, exchangeMsg *exchange.DeviceMessage) bool
	HandleBlockchainEventMessage(cmd *BlockchainEventCommand) (string, bool, uint64, bool, error)
	TerminateAgreement(agreement *persistence.EstablishedAgreement, reason uint)
	GetSendMessage() func(mt interface{}, pay []byte) error
	GetTerminationCode(reason string) uint
	GetTerminationReason(code uint) string
	SetBlockchainClientAvailable(cmd *BCInitializedCommand)
	SetBlockchainClientNotAvailable(cmd *BCStoppingCommand)
	IsBlockchainClientAvailable(typeName string, name string, org string) bool
	SetBlockchainWritable(cmd *BCWritableCommand)
	IsBlockchainWritable(agreement *persistence.EstablishedAgreement) bool
	IsAgreementVerifiable(agreement *persistence.EstablishedAgreement) bool
	HandleExtensionMessages(msg *events.ExchangeDeviceMessage, exchangeMsg *exchange.DeviceMessage) (bool, bool, string, error)
	UpdateConsumer(ag *persistence.EstablishedAgreement)
	UpdateConsumers()
	GetKnownBlockchain(ag *persistence.EstablishedAgreement) (string, string, string)
	VerifyAgreement(ag *persistence.EstablishedAgreement) (bool, error)
}

Jump to

Keyboard shortcuts

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