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 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 LiveStatus
- type ManagedTX
- type ManagedTXError
- type QueryRequest
- type QueryResponse
- type ReadyStatus
- type ReplyHeaders
- type ReplyType
- type RequestHeaders
- type RequestType
- type TransactionRequest
- type TransactionUpdateReply
- type TxStatus
- 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 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 *fftypes.UUID `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"` Receipt *ffcapi.TransactionReceiptResponse `json:"receipt,omitempty"` ErrorMessage string `json:"errorMessage,omitempty"` ErrorHistory []*ManagedTXError `json:"errorHistory"` Confirmations []confirmations.BlockInfo `json:"confirmations,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 ManagedTXError ¶
type ManagedTXError struct { Time *fftypes.FFTime `json:"time"` Error string `json:"error,omitempty"` Mapped ffcapi.ErrorReason `json:"mapped,omitempty"` }
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"` ManagedTX }
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 update types in the future.
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 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 }