synchronization

package
v0.8.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// ConnectionStatusDisconnected is the default state
	ConnectionStatusDisconnected = ConnectionStatus("disconnected")
	// ConnectionStatusConnected is used when the client is successfully connected
	ConnectionStatusConnected = ConnectionStatus("connected")
	// ConnectionStatusError is used when there is an error
	ConnectionStatusError = ConnectionStatus("error")
)

Variables

View Source
var (
	// ErrReceiveTimeout is returned when no message is received after a
	// specified duration in Receive
	ErrReceiveTimeout = errors.New("timeout waiting for message")
)

Functions

This section is empty.

Types

type ConnectionStatus added in v0.8.2

type ConnectionStatus string

type StatsPusher

type StatsPusher interface {
	Start() error
	Close() error
	PushNow()
	GetURL() url.URL
	GetStatus() ConnectionStatus
}

StatsPusher polls for events and pushes them via a WebSocketClient. Events are consumed by the Explorer. Currently there is only one event type: an encoding of a JobRun.

func NewStatsPusher

func NewStatsPusher(orm *orm.ORM, url *url.URL, accessKey, secret string, afters ...utils.Afterer) StatsPusher

NewStatsPusher returns a new event queuer

type SyncJobRunPresenter

type SyncJobRunPresenter struct {
	*models.JobRun
}

SyncJobRunPresenter presents a JobRun for synchronization purposes

func (SyncJobRunPresenter) MarshalJSON

func (p SyncJobRunPresenter) MarshalJSON() ([]byte, error)

MarshalJSON returns the JobRun as JSON

type TxStatus

type TxStatus string

TxStatus indicates if a transaction is fulfilled or not

const (
	// StatusFulfilledRunLog indicates that a ChainlinkFulfilled event was
	// detected in the transaction receipt.
	StatusFulfilledRunLog TxStatus = "fulfilledRunLog"
	// StatusNoFulfilledRunLog indicates that no ChainlinkFulfilled events were
	// detected in the transaction receipt.
	StatusNoFulfilledRunLog = "noFulfilledRunLog"
)

type WebSocketClient

type WebSocketClient interface {
	Url() url.URL
	Status() ConnectionStatus
	Start() error
	Close() error
	Send([]byte)
	Receive(...time.Duration) ([]byte, error)
}

WebSocketClient encapsulates all the functionality needed to push run information to explorer.

func NewWebSocketClient

func NewWebSocketClient(url *url.URL, accessKey, secret string) WebSocketClient

NewWebSocketClient returns a stats pusher using a websocket for delivery.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL