Documentation ¶
Index ¶
- Constants
- Variables
- func NewAbiPacker() *abiPacker
- type HttpClient
- type MercuryClient
- type MercuryConfigProvider
- type MercuryData
- type MercuryEndpointMock
- type Packer
- type SimulatedMercuryServer
- func (ms *SimulatedMercuryServer) CallCount() int
- func (ms *SimulatedMercuryServer) Password() string
- func (ms *SimulatedMercuryServer) RegisterHandler(h http.HandlerFunc)
- func (ms *SimulatedMercuryServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (ms *SimulatedMercuryServer) Start()
- func (ms *SimulatedMercuryServer) Stop()
- func (ms *SimulatedMercuryServer) URL() string
- func (ms *SimulatedMercuryServer) Username() string
- type StreamsLookup
- type StreamsLookupError
Constants ¶
View Source
const ( FeedIDs = "feedIDs" // valid for v0.3 FeedIdHex = "feedIdHex" // valid for v0.2 BlockNumber = "blockNumber" // valid for v0.2 Timestamp = "timestamp" // valid for v0.3 RetryIntervalTimeout = time.Duration(-1) RequestTimeout = 10 * time.Second )
Variables ¶
View Source
var CalculateStreamsRetryConfigFn = func(upkeepType automationTypes.UpkeepType, prk string, mercuryConfig MercuryConfigProvider) (retryInterval time.Duration) { var retries int totalAttempts, ok := mercuryConfig.GetPluginRetry(prk) if ok { retries = totalAttempts.(int) if retries < totalFastPluginRetries { retryInterval = 1 * time.Second } else if retries < totalMediumPluginRetries { retryInterval = 5 * time.Second } else { retryInterval = RetryIntervalTimeout } } else { retryInterval = 1 * time.Second } if upkeepType == automationTypes.ConditionTrigger { retryInterval = RetryIntervalTimeout } mercuryConfig.SetPluginRetry(prk, retries+1, cache.DefaultExpiration) return retryInterval }
CalculateStreamsRetryConfig returns plugin retry interval based on how many times plugin has retried this work
View Source
var GenerateHMACFn = func(method string, path string, body []byte, clientId string, secret string, ts int64) string { bodyHash := sha256.New() bodyHash.Write(body) hashString := fmt.Sprintf("%s %s %s %s %d", method, path, hex.EncodeToString(bodyHash.Sum(nil)), clientId, ts) signedMessage := hmac.New(sha256.New, []byte(secret)) signedMessage.Write([]byte(hashString)) userHmac := hex.EncodeToString(signedMessage.Sum(nil)) return userHmac }
Functions ¶
func NewAbiPacker ¶ added in v2.9.0
func NewAbiPacker() *abiPacker
Types ¶
type MercuryClient ¶
type MercuryClient interface { // DoRequest makes a data stream request, it manages retries and returns the following: // state: the state of the pipeline execution. This field is coupled with err. If state is NoPipelineError then err is nil, otherwise err is non nil and appropriate state is returned // data: the data returned from the data stream if there's NoPipelineError // errCode: the errorCode of streams request if data is nil and there's NoPipelineError // retryable: whether the request is retryable. Only applicable for errored states. // retryInterval: the interval to wait before retrying the request. Only applicable for errored states. // err: non nil if some internal error occurs in pipeline DoRequest(ctx context.Context, streamsLookup *StreamsLookup, upkeepType automationTypes.UpkeepType, pluginRetryKey string) (encoding.PipelineExecutionState, [][]byte, encoding.ErrCode, bool, time.Duration, error) }
type MercuryConfigProvider ¶
type MercuryData ¶
type MercuryData struct { Index int Bytes [][]byte // Mercury values if request is successful ErrCode encoding.ErrCode // Error code if mercury gives an error State encoding.PipelineExecutionState // NoPipelineError if no error during execution, otherwise appropriate error Retryable bool // Applicable if State != NoPipelineError Error error // non nil if State != NoPipelineError }
type MercuryEndpointMock ¶ added in v2.10.0
type Packer ¶
type Packer interface { UnpackCheckCallbackResult(callbackResp []byte) (encoding.PipelineExecutionState, bool, []byte, encoding.UpkeepFailureReason, *big.Int, error) PackGetUpkeepPrivilegeConfig(upkeepId *big.Int) ([]byte, error) UnpackGetUpkeepPrivilegeConfig(resp []byte) ([]byte, error) DecodeStreamsLookupRequest(data []byte) (*StreamsLookupError, error) PackUserCheckErrorHandler(errCode encoding.ErrCode, extraData []byte) ([]byte, error) }
type SimulatedMercuryServer ¶ added in v2.10.0
type SimulatedMercuryServer struct {
// contains filtered or unexported fields
}
func NewSimulatedMercuryServer ¶ added in v2.10.0
func NewSimulatedMercuryServer() *SimulatedMercuryServer
func (*SimulatedMercuryServer) CallCount ¶ added in v2.10.0
func (ms *SimulatedMercuryServer) CallCount() int
func (*SimulatedMercuryServer) Password ¶ added in v2.10.0
func (ms *SimulatedMercuryServer) Password() string
func (*SimulatedMercuryServer) RegisterHandler ¶ added in v2.10.0
func (ms *SimulatedMercuryServer) RegisterHandler(h http.HandlerFunc)
func (*SimulatedMercuryServer) ServeHTTP ¶ added in v2.10.0
func (ms *SimulatedMercuryServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*SimulatedMercuryServer) Start ¶ added in v2.10.0
func (ms *SimulatedMercuryServer) Start()
func (*SimulatedMercuryServer) Stop ¶ added in v2.10.0
func (ms *SimulatedMercuryServer) Stop()
func (*SimulatedMercuryServer) URL ¶ added in v2.10.0
func (ms *SimulatedMercuryServer) URL() string
func (*SimulatedMercuryServer) Username ¶ added in v2.10.0
func (ms *SimulatedMercuryServer) Username() string
type StreamsLookup ¶
type StreamsLookup struct { *StreamsLookupError UpkeepId *big.Int Block uint64 }
func (*StreamsLookup) IsMercuryV02 ¶
func (l *StreamsLookup) IsMercuryV02() bool
func (*StreamsLookup) IsMercuryV03 ¶
func (l *StreamsLookup) IsMercuryV03() bool
func (*StreamsLookup) IsMercuryV03UsingBlockNumber ¶ added in v2.9.0
func (l *StreamsLookup) IsMercuryV03UsingBlockNumber() bool
IsMercuryV03UsingBlockNumber is used to distinguish the batch path. It is used for Mercury V03 only
Click to show internal directories.
Click to hide internal directories.