Documentation
¶
Index ¶
- Constants
- func AddReceiptToBatch(ctx context.Context, namespace string, plugin core.Named, ...) error
- func GetNamespaceFromSubName(subName string) string
- func HandleReceipt(ctx context.Context, namespace string, plugin core.Named, ...) error
- func WrapRESTError(ctx context.Context, errRes *BlockchainRESTError, res *resty.Response, ...) error
- type BatchPinParams
- type BlockchainCallbacks
- type BlockchainRESTError
- type BlockchainReceiptHeaders
- type BlockchainReceiptNotification
- type EventsToDispatch
- type FireflySubscriptions
- type SubscriptionInfo
Constants ¶
const ( ReceiptTransactionSuccess string = "TransactionSuccess" ReceiptTransactionFailed string = "TransactionFailed" )
possible values of BlockchainReceiptHeaders.ReplyType
Variables ¶
This section is empty.
Functions ¶
func AddReceiptToBatch ¶ added in v1.4.0
func AddReceiptToBatch(ctx context.Context, namespace string, plugin core.Named, reply *BlockchainReceiptNotification, updates *[]*core.OperationUpdate) error
Common function for synchronously handling receipts from blockchain connectors. This won't actually handle the receipt, but will rather collect it into updates. The caller will call BulkOperationUpdates with the batch later.
func GetNamespaceFromSubName ¶
func HandleReceipt ¶ added in v1.1.3
func HandleReceipt(ctx context.Context, namespace string, plugin core.Named, reply *BlockchainReceiptNotification, callbacks BlockchainCallbacks) error
Common function for handling receipts from blockchain connectors.
func WrapRESTError ¶ added in v1.3.0
func WrapRESTError(ctx context.Context, errRes *BlockchainRESTError, res *resty.Response, err error, defMsgKey i18n.ErrorMessageKey) error
Types ¶
type BatchPinParams ¶
type BlockchainCallbacks ¶
type BlockchainCallbacks interface { SetHandler(namespace string, handler blockchain.Callbacks) SetOperationalHandler(namespace string, handler core.OperationCallbacks) // BulkOperationUpdates is a synchronous way to update multiple operations and will return when the updates have been committed to the database or there has been an error // An insertion ordering guarantee is only provided when this code is called on a single goroutine inside of the connector. // It is the responsibility of the connector code to allocate that routine, and ensure that there is only one. // Note: onComplete at each update level is not called, as this is a bulk operation and should be reponsibility of the caller to manage if needed. BulkOperationUpdates(ctx context.Context, namespace string, updates []*core.OperationUpdate) error OperationUpdate(ctx context.Context, plugin core.Named, nsOpID string, status core.OpStatus, blockchainTXID, errorMessage string, opOutput fftypes.JSONObject) // Common logic for parsing a BatchPinOrNetworkAction event, and if not discarded to add it to the by-namespace map PrepareBatchPinOrNetworkAction(ctx context.Context, events EventsToDispatch, subInfo *SubscriptionInfo, location *fftypes.JSONAny, event *blockchain.Event, signingKey *core.VerifierRef, params *BatchPinParams) // Common logic for parsing a BatchPinOrNetworkAction event, and if not discarded to add it to the by-namespace map PrepareBlockchainEvent(ctx context.Context, events EventsToDispatch, namespace string, event *blockchain.EventForListener) // Dispatch logic, that ensures all the right namespace callbacks get called for the event batch DispatchBlockchainEvents(ctx context.Context, events EventsToDispatch) error }
func NewBlockchainCallbacks ¶
func NewBlockchainCallbacks() BlockchainCallbacks
type BlockchainRESTError ¶ added in v1.3.0
type BlockchainRESTError struct { Error string `json:"error,omitempty"` // See https://github.com/hyperledger/firefly-transaction-manager/blob/main/pkg/ffcapi/submission_error.go SubmissionRejected bool `json:"submissionRejected,omitempty"` }
type BlockchainReceiptHeaders ¶ added in v1.1.3
type BlockchainReceiptNotification ¶ added in v1.1.3
type BlockchainReceiptNotification struct { Headers BlockchainReceiptHeaders `json:"headers,omitempty"` TxHash string `json:"transactionHash,omitempty"` Message string `json:"errorMessage,omitempty"` ProtocolID string `json:"protocolId,omitempty"` ContractLocation *fftypes.JSONAny `json:"contractLocation,omitempty"` }
type EventsToDispatch ¶ added in v1.3.0
type EventsToDispatch map[string][]*blockchain.EventToDispatch
EventsToDispatch is a by-namespace map of ordered blockchain events. Note there are some old listeners that do not have a namespace on them, and hence are stored under the empty string, and dispatched to all namespaces.
type FireflySubscriptions ¶
type FireflySubscriptions interface { AddSubscription(ctx context.Context, namespace *core.Namespace, version int, subID string, extra interface{}) RemoveSubscription(ctx context.Context, subID string) GetSubscription(subID string) *SubscriptionInfo }
func NewFireflySubscriptions ¶
func NewFireflySubscriptions() FireflySubscriptions
type SubscriptionInfo ¶
type SubscriptionInfo struct { Version int V1Namespace map[string][]string V2Namespace string Extra interface{} }
A single subscription on network version 1 may receive events from many remote namespaces, which in turn map to one or more local namespaces. A subscription on network version 2 is always specific to a single local namespace.