Documentation ¶
Index ¶
- Variables
- func CheckUpdateBool(changed bool, merged **bool, old *bool, new *bool, defValue bool) bool
- func CheckUpdateDuration(changed bool, merged **fftypes.FFDuration, old *fftypes.FFDuration, ...) bool
- func CheckUpdateEnum(changed bool, merged **fftypes.FFEnum, old *fftypes.FFEnum, ...) bool
- func CheckUpdateString(changed bool, merged **string, old *string, new *string, defValue string) bool
- func CheckUpdateStringMap(changed bool, merged *map[string]string, old map[string]string, ...) bool
- func CheckUpdateUint64(changed bool, merged **uint64, old *uint64, new *uint64, defValue int64) bool
- func NewULID() *fftypes.UUID
- type BaseRequest
- type BlockInfo
- type ContractDeployRequest
- type DistributionMode
- type ErrorHandlingType
- type EventBatch
- type EventContext
- type EventStream
- type EventStreamCheckpoint
- type EventStreamStatus
- type EventStreamType
- type EventStreamWithStatus
- type EventWithContext
- type Listener
- type ListenerWithStatus
- type LiveAddressBalance
- type LiveGasPrice
- type LiveStatus
- type ManagedTX
- type ManagedTransactionEvent
- type ManagedTransactionEventType
- type QueryRequest
- type QueryResponse
- type ReadyStatus
- type ReplyHeaders
- type ReplyType
- type RequestHeaders
- type RequestType
- type TransactionRequest
- type TransactionUpdateReply
- type TxAction
- type TxHistoryActionEntry
- type TxHistoryStateTransitionEntry
- type TxHistorySummaryEntry
- type TxStatus
- type TxSubStatus
- type WebSocketConfig
- type WebhookConfig
Constants ¶
This section is empty.
Variables ¶
var ( DistributionModeBroadcast = fftypes.FFEnumValue("distmode", "broadcast") DistributionModeLoadBalance = fftypes.FFEnumValue("distmode", "load_balance") )
var ( EventStreamTypeWebhook = fftypes.FFEnumValue("estype", "webhook") EventStreamTypeWebSocket = fftypes.FFEnumValue("estype", "websocket") )
var ( ErrorHandlingTypeBlock = fftypes.FFEnumValue("ehtype", "block") ErrorHandlingTypeSkip = fftypes.FFEnumValue("ehtype", "skip") )
Functions ¶
func CheckUpdateBool ¶
CheckUpdateBool helper merges supplied configuration, with a base, and applies a default if unset
func CheckUpdateDuration ¶
func CheckUpdateDuration(changed bool, merged **fftypes.FFDuration, old *fftypes.FFDuration, new *fftypes.FFDuration, defValue fftypes.FFDuration) bool
CheckUpdateDuration helper merges supplied configuration, with a base, and applies a default if unset
func CheckUpdateEnum ¶
func CheckUpdateEnum(changed bool, merged **fftypes.FFEnum, old *fftypes.FFEnum, new *fftypes.FFEnum, defValue fftypes.FFEnum) bool
CheckUpdateEnum helper merges supplied configuration, with a base, and applies a default if unset
func CheckUpdateString ¶
func CheckUpdateString(changed bool, merged **string, old *string, new *string, defValue string) bool
CheckUpdateString helper merges supplied configuration, with a base, and applies a default if unset
func CheckUpdateStringMap ¶
func CheckUpdateStringMap(changed bool, merged *map[string]string, old map[string]string, new map[string]string) bool
CheckUpdateStringMap helper merges supplied configuration, with a base, and applies a default if unset
func CheckUpdateUint64 ¶
func CheckUpdateUint64(changed bool, merged **uint64, old *uint64, new *uint64, defValue int64) bool
CheckUpdateUint64 helper merges supplied configuration, with a base, and applies a default if unset
Types ¶
type BaseRequest ¶
type BaseRequest struct {
// contains filtered or unexported fields
}
BaseRequest is the common headers to all requests, and captures the full input payload for later decoding to a specific type
func (*BaseRequest) UnmarshalJSON ¶
func (br *BaseRequest) UnmarshalJSON(data []byte) error
func (*BaseRequest) UnmarshalTo ¶
func (br *BaseRequest) UnmarshalTo(o interface{}) error
type ContractDeployRequest ¶
type ContractDeployRequest struct { Headers RequestHeaders `json:"headers"` ffcapi.ContractDeployPrepareRequest }
ContractDeployRequest is the payload sent to initiate a new transaction
type DistributionMode ¶
type ErrorHandlingType ¶
type EventBatch ¶ added in v0.9.12
type EventBatch struct { BatchNumber int64 `json:"batchNumber"` Events []*EventWithContext `json:"events"` }
type EventContext ¶
type EventStream ¶
type EventStream struct { ID *fftypes.UUID `ffstruct:"eventstream" json:"id"` Created *fftypes.FFTime `ffstruct:"eventstream" json:"created"` Updated *fftypes.FFTime `ffstruct:"eventstream" json:"updated"` Name *string `ffstruct:"eventstream" json:"name,omitempty"` Suspended *bool `ffstruct:"eventstream" json:"suspended,omitempty"` Type *EventStreamType `ffstruct:"eventstream" json:"type,omitempty" ffenum:"estype"` ErrorHandling *ErrorHandlingType `ffstruct:"eventstream" json:"errorHandling"` BatchSize *uint64 `ffstruct:"eventstream" json:"batchSize"` BatchTimeout *fftypes.FFDuration `ffstruct:"eventstream" json:"batchTimeout"` RetryTimeout *fftypes.FFDuration `ffstruct:"eventstream" json:"retryTimeout"` BlockedRetryDelay *fftypes.FFDuration `ffstruct:"eventstream" json:"blockedRetryDelay"` EthCompatBatchTimeoutMS *uint64 `ffstruct:"eventstream" json:"batchTimeoutMS,omitempty"` // input only, for backwards compatibility EthCompatRetryTimeoutSec *uint64 `ffstruct:"eventstream" json:"retryTimeoutSec,omitempty"` // input only, for backwards compatibility EthCompatBlockedRetryDelaySec *uint64 `ffstruct:"eventstream" json:"blockedRetryDelaySec,omitempty"` // input only, for backwards compatibility Webhook *WebhookConfig `ffstruct:"eventstream" json:"webhook,omitempty"` WebSocket *WebSocketConfig `ffstruct:"eventstream" json:"websocket,omitempty"` }
type EventStreamCheckpoint ¶
type EventStreamStatus ¶
type EventStreamStatus string
const ( EventStreamStatusStarted EventStreamStatus = "started" EventStreamStatusStopping EventStreamStatus = "stopping" EventStreamStatusStopped EventStreamStatus = "stopped" EventStreamStatusDeleted EventStreamStatus = "deleted" )
type EventStreamType ¶
type EventStreamWithStatus ¶
type EventStreamWithStatus struct { EventStream Status EventStreamStatus `ffstruct:"eventstream" json:"status"` }
type EventWithContext ¶
type EventWithContext struct { StandardContext EventContext ffcapi.Event }
EventWithContext is what is delivered There is custom serialization to flatten the whole structure, so all the custom `info` fields from the connector are alongside the required context fields. The `data` is kept separate
func (*EventWithContext) MarshalJSON ¶
func (e *EventWithContext) MarshalJSON() ([]byte, error)
func (*EventWithContext) UnmarshalJSON ¶
func (e *EventWithContext) UnmarshalJSON(b []byte) error
Note on unmarshal info will be a map with all the fields (except "data")
type Listener ¶
type Listener struct { ID *fftypes.UUID `ffstruct:"listener" json:"id,omitempty"` Created *fftypes.FFTime `ffstruct:"listener" json:"created"` Updated *fftypes.FFTime `ffstruct:"listener" json:"updated"` Name *string `ffstruct:"listener" json:"name"` StreamID *fftypes.UUID `ffstruct:"listener" json:"stream" ffexcludeoutput:"true"` EthCompatAddress *string `ffstruct:"listener" json:"address,omitempty"` EthCompatEvent *fftypes.JSONAny `ffstruct:"listener" json:"event,omitempty"` EthCompatMethods *fftypes.JSONAny `ffstruct:"listener" json:"methods,omitempty"` Filters []fftypes.JSONAny `ffstruct:"listener" json:"filters"` Options *fftypes.JSONAny `ffstruct:"listener" json:"options"` Signature string `ffstruct:"listener" json:"signature,omitempty" ffexcludeinput:"true"` FromBlock *string `ffstruct:"listener" json:"fromBlock,omitempty"` }
type ListenerWithStatus ¶ added in v0.9.6
type ListenerWithStatus struct { Listener ffcapi.EventListenerHWMResponse }
type LiveAddressBalance ¶ added in v1.1.6
type LiveAddressBalance struct {
ffcapi.AddressBalanceResponse
}
type LiveGasPrice ¶ added in v1.2.0
type LiveGasPrice struct {
ffcapi.GasPriceEstimateResponse
}
type LiveStatus ¶ added in v0.9.11
type LiveStatus struct {
ffcapi.LiveResponse
}
type ManagedTX ¶
type ManagedTX struct { ID string `json:"id"` Created *fftypes.FFTime `json:"created"` Updated *fftypes.FFTime `json:"updated"` Status TxStatus `json:"status"` DeleteRequested *fftypes.FFTime `json:"deleteRequested,omitempty"` SequenceID string `json:"sequenceId"` Nonce *fftypes.FFBigInt `json:"nonce"` Gas *fftypes.FFBigInt `json:"gas"` TransactionHeaders ffcapi.TransactionHeaders `json:"transactionHeaders"` TransactionData string `json:"transactionData"` TransactionHash string `json:"transactionHash,omitempty"` GasPrice *fftypes.JSONAny `json:"gasPrice"` PolicyInfo *fftypes.JSONAny `json:"policyInfo"` FirstSubmit *fftypes.FFTime `json:"firstSubmit,omitempty"` LastSubmit *fftypes.FFTime `json:"lastSubmit,omitempty"` ErrorMessage string `json:"errorMessage,omitempty"` Receipt *ffcapi.TransactionReceiptResponse `json:"receipt,omitempty"` Confirmations []BlockInfo `json:"confirmations,omitempty"` History []*TxHistoryStateTransitionEntry `json:"history,omitempty"` HistorySummary []*TxHistorySummaryEntry `json:"historySummary,omitempty"` }
ManagedTX is the structure stored for each new transaction request, using the external ID of the operation
Indexing:
Multiple index collection are stored for the managed transactions, to allow them to be managed including: - Nonce allocation: this is a critical index, and why cleanup is so important (mentioned below). We use this index to determine the next nonce to assign to a given signing key. - Created time: a timestamp ordered index for the transactions for convenient ordering. the key includes the ID of the TX for uniqueness. - Pending sequence: An entry in this index only exists while the transaction is pending, and is ordered by a UUIDv1 sequence allocated to each entry.
Index cleanup after partial write:
- All indexes are stored before the TX itself.
- When listing back entries, the persistence layer will automatically clean up indexes if the underlying TX they refer to is not available. For this reason the index records are written first.
type ManagedTransactionEvent ¶ added in v1.2.4
type ManagedTransactionEvent struct { Type ManagedTransactionEventType `json:"type"` Tx *ManagedTX `json:"transaction"` }
type ManagedTransactionEventType ¶ added in v1.2.4
type ManagedTransactionEventType int
ManagedTransactionEventType is a enum type that contains all types of transaction process events that a transaction handler emits.
const ( ManagedTXProcessSucceeded ManagedTransactionEventType = iota ManagedTXProcessFailed ManagedTXDeleted ManagedTXTransactionHashAdded ManagedTXTransactionHashRemoved )
type QueryRequest ¶
type QueryRequest struct { Headers RequestHeaders `json:"headers"` ffcapi.TransactionInput }
QueryRequest is the request payload to send to perform a synchronous query against the blockchain state
type QueryResponse ¶
type QueryResponse ffcapi.QueryInvokeResponse
QueryResponse is the response payload for a query
type ReadyStatus ¶ added in v0.9.11
type ReadyStatus struct {
ffcapi.ReadyResponse
}
type ReplyHeaders ¶
type RequestHeaders ¶
type RequestHeaders struct { ID string `ffstruct:"fftmrequest" json:"id"` Type RequestType `json:"type"` }
type RequestType ¶
type RequestType string
const ( RequestTypeSendTransaction RequestType = "SendTransaction" RequestTypeQuery RequestType = "Query" RequestTypeDeploy RequestType = "DeployContract" )
type TransactionRequest ¶
type TransactionRequest struct { Headers RequestHeaders `json:"headers"` ffcapi.TransactionInput }
TransactionRequest is the payload sent to initiate a new transaction
type TransactionUpdateReply ¶
type TransactionUpdateReply struct { Headers ReplyHeaders `json:"headers"` Status TxStatus `json:"status"` ProtocolID string `json:"protocolId"` TransactionHash string `json:"transactionHash,omitempty"` ContractLocation *fftypes.JSONAny `json:"contractLocation,omitempty"` }
TransactionUpdateReply add a "headers" structure that allows a processor of websocket replies/updates to filter on a standard structure to know how to process the message. Extensible to update types in the future. The reply is a small summary of the latest status change. Full status for a transaction must be retrieved with /transactions/{txid}
type TxAction ¶ added in v1.2.0
type TxAction string
TxAction is an action taken while attempting to progress a transaction between sub-states
const ( // TxActionAssignNonce indicates that a nonce has been assigned to the transaction TxActionAssignNonce TxAction = "AssignNonce" // TxActionRetrieveGasPrice indicates the operation is getting a gas price TxActionRetrieveGasPrice TxAction = "RetrieveGasPrice" // TxActionTimeout indicates that the transaction has timed out may need intervention to progress it TxActionTimeout TxAction = "Timeout" // TxActionSubmitTransaction indicates that the transaction has been submitted TxActionSubmitTransaction TxAction = "SubmitTransaction" // TxActionReceiveReceipt indicates that we have received a receipt for the transaction TxActionReceiveReceipt TxAction = "ReceiveReceipt" // TxActionConfirmTransaction indicates that the transaction has been confirmed TxActionConfirmTransaction TxAction = "Confirm" )
type TxHistoryActionEntry ¶ added in v1.2.1
type TxHistoryActionEntry struct { Time *fftypes.FFTime `json:"time"` Action TxAction `json:"action"` LastOccurrence *fftypes.FFTime `json:"lastOccurrence"` Count int `json:"count"` LastError *fftypes.JSONAny `json:"lastError,omitempty"` LastErrorTime *fftypes.FFTime `json:"lastErrorTime,omitempty"` LastInfo *fftypes.JSONAny `json:"lastInfo,omitempty"` }
An action taken in order to progress a transaction, e.g. retrieve gas price from an oracle. Actions are retaining similarly to the TxHistorySummaryEntry records, where we have a finite list based on the action name. Actions are only added to the list once, then updated when they occur multiple times. So if we are retrying the same set of actions over and over again the list of actions does not grow.
type TxHistoryStateTransitionEntry ¶ added in v1.2.1
type TxHistoryStateTransitionEntry struct { Status TxSubStatus `json:"subStatus"` // the subStatus we entered Time *fftypes.FFTime `json:"time"` // the time we transitioned to this subStatus Actions []*TxHistoryActionEntry `json:"actions"` // the unique actions we attempted while in this sub-status }
TxHistoryStateTransitionEntry represents a state that the policy engine that manages transaction submission has entered, and a list of the actions attempted within that state in order to attempt to move to the next state.
type TxHistorySummaryEntry ¶ added in v1.2.1
type TxHistorySummaryEntry struct { Status TxSubStatus `json:"subStatus,omitempty"` Action TxAction `json:"action,omitempty"` FirstOccurrence *fftypes.FFTime `json:"firstOccurrence"` LastOccurrence *fftypes.FFTime `json:"lastOccurrence"` Count int `json:"count"` }
TxHistorySummaryEntry records summarize the transaction history, by recording the number of times each subStatus was entered. Because the detailed history might wrap, this means we can retain some basic information about the complete history of the transaction beyond the life of the individual history records.
type TxStatus ¶
type TxStatus string
TxStatus is the current status of a transaction
const ( // TxStatusPending indicates the operation has been submitted, but is not yet confirmed as successful or failed TxStatusPending TxStatus = "Pending" // TxStatusSucceeded the infrastructure runtime has returned success for the operation TxStatusSucceeded TxStatus = "Succeeded" // TxStatusFailed happens when an error is reported by the infrastructure runtime TxStatusFailed TxStatus = "Failed" )
type TxSubStatus ¶ added in v1.2.0
type TxSubStatus string
TxSubStatus is an intermediate status a transaction may go through
const ( // TxSubStatusReceived indicates the transaction has been received by the connector TxSubStatusReceived TxSubStatus = "Received" // TxSubStatusStale indicates the transaction is now in stale TxSubStatusStale TxSubStatus = "Stale" // TxSubStatusTracking indicates we are tracking progress of the transaction TxSubStatusTracking TxSubStatus = "Tracking" // TxSubStatusConfirmed indicates we have confirmed that the transaction has been fully processed TxSubStatusConfirmed TxSubStatus = "Confirmed" // TxSubStatusFailed indicates we have failed to process the transaction and it will no longer be tracked TxSubStatusFailed TxSubStatus = "Failed" )
type WebSocketConfig ¶
type WebSocketConfig struct {
DistributionMode *DistributionMode `ffstruct:"wsconfig" json:"distributionMode,omitempty"`
}
type WebhookConfig ¶
type WebhookConfig struct { URL *string `ffstruct:"whconfig" json:"url,omitempty"` Headers map[string]string `ffstruct:"whconfig" json:"headers,omitempty"` TLSkipHostVerify *bool `ffstruct:"whconfig" json:"tlsSkipHostVerify,omitempty"` RequestTimeout *fftypes.FFDuration `ffstruct:"whconfig" json:"requestTimeout,omitempty"` EthCompatRequestTimeoutSec *int64 `ffstruct:"whconfig" json:"requestTimeoutSec,omitempty"` // input only, for backwards compatibility }