Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Window - Dataset size for moving average Window = 100 // MinDelay - minimum delay before first try MinDelay = 100 * time.Millisecond // MaxDelay - maximum delay between tries MaxDelay = 10 * time.Second // Factor - exponential backoff factor Factor = 1.3 // InitialDelayFraction - start with a large faction of the current average InitialDelayFraction = 0.8 // FirstRetryFraction - then retry with exponential backoff using a fraction of that initial delay FirstRetryDelayFraction = 0.15 // TracerFrequency - run an aggressive txn every X txns, and reset average TracerFrequency = 25 // TracerDivisor - when a tracer runs, it runs at this division of the average TracerDivisor = 5 // ResetThreshold - if a tracer comes in below this threshold of the average, we reset ResetThreshold = 0.3 )
Intention is that these values are a good baseline for the low-level exponential backoff retry of getting transaction receipts up to a maximum time. The maximum time is configured outside of this code, as when a transction receipt never comes back we cannot infer anything about the timing of successful transactions
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TxContext ¶
type TxContext interface { // Return the Go context Context() context.Context // Get the headers of the message Headers() *messages.CommonHeaders // Unmarshal the supplied message into a give type Unmarshal(msg interface{}) error // Send an error reply SendErrorReply(status int, err error) // Send an error reply SendErrorReplyWithTX(status int, err error, txHash string) // Send a reply that can be marshaled into bytes. // Sets all the common headers on behalf of the caller, based on the request context Reply(replyMsg messages.ReplyWithHeaders) // Get a string summary String() string }
TxnContext is passed for each message that arrives at the bridge
type TxDelayTracker ¶
type TxDelayTracker interface { GetInitialDelay() (delay time.Duration) GetRetryDelay(initialDelay time.Duration, retry int) (delay time.Duration) ReportSuccess(timeTaken time.Duration) }
TxnDelayTracker - helps manage delays when checking for txn receipts
func NewTxDelayTracker ¶
func NewTxDelayTracker() TxDelayTracker
NewTxnDelayTracker - constructs a new tracker
type TxProcessor ¶
type TxProcessor interface { OnMessage(TxContext) Init(client.RPCClient) GetRPCClient() client.RPCClient }
TxProcessor interface is called for each message, as is responsible for tracking all in-flight messages
func NewTxProcessor ¶
func NewTxProcessor(conf *conf.RESTGatewayConf) TxProcessor
NewTxnProcessor constructor for message procss
Click to show internal directories.
Click to hide internal directories.