synchronization

package
v0.10.9 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 28 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")
)
View Source
const (
	ExplorerTextMessage   = websocket.TextMessage
	ExplorerBinaryMessage = websocket.BinaryMessage
)
View Source
const CloseTimeout = 100 * time.Millisecond
View Source
const SendBufferSize = 100

SendBufferSize is the number of messages to keep in the buffer before dropping additional ones

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

func InsertSyncEventForJobRun added in v0.10.2

func InsertSyncEventForJobRun(db *gorm.DB, run *models.JobRun) error

InsertSyncEventForJobRun generates an event for a change to job_runs

Types

type ConnectionStatus added in v0.8.2

type ConnectionStatus string

type ExplorerClient added in v0.9.3

type ExplorerClient interface {
	service.Service
	Url() url.URL
	Status() ConnectionStatus
	Send(context.Context, []byte, ...int)
	Receive(context.Context, ...time.Duration) ([]byte, error)
}

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

func NewExplorerClient added in v0.9.3

func NewExplorerClient(url *url.URL, accessKey, secret string, loggingArgs ...bool) ExplorerClient

NewExplorerClient returns a stats pusher using a websocket for delivery.

type NoopExplorerClient added in v0.9.3

type NoopExplorerClient struct{}

func (NoopExplorerClient) Close added in v0.9.3

func (NoopExplorerClient) Close() error

func (NoopExplorerClient) Healthy added in v0.10.8

func (NoopExplorerClient) Healthy() error

func (NoopExplorerClient) Ready added in v0.10.8

func (NoopExplorerClient) Ready() error

func (NoopExplorerClient) Receive added in v0.9.3

func (NoopExplorerClient) Send added in v0.9.3

func (NoopExplorerClient) Send(context.Context, []byte, ...int)

func (NoopExplorerClient) Start added in v0.9.3

func (NoopExplorerClient) Start() error

func (NoopExplorerClient) Status added in v0.9.3

func (NoopExplorerClient) Url added in v0.9.3

func (NoopExplorerClient) Url() url.URL

type NoopStatsPusher added in v0.9.3

type NoopStatsPusher struct{}

func (NoopStatsPusher) AllSyncEvents added in v0.9.7

func (NoopStatsPusher) AllSyncEvents(cb func(models.SyncEvent) error) error

func (NoopStatsPusher) Close added in v0.9.3

func (NoopStatsPusher) Close() error

func (NoopStatsPusher) GetStatus added in v0.9.3

func (NoopStatsPusher) GetStatus() ConnectionStatus

func (NoopStatsPusher) GetURL added in v0.9.3

func (NoopStatsPusher) GetURL() url.URL

func (NoopStatsPusher) Healthy added in v0.10.8

func (NoopStatsPusher) Healthy() error

func (NoopStatsPusher) PushNow added in v0.9.3

func (NoopStatsPusher) PushNow()

func (NoopStatsPusher) Ready added in v0.10.8

func (NoopStatsPusher) Ready() error

func (NoopStatsPusher) Start added in v0.9.3

func (NoopStatsPusher) Start() error

type StatsPusher

type StatsPusher interface {
	service.Service
	PushNow()
	GetURL() url.URL
	GetStatus() ConnectionStatus
	AllSyncEvents(cb func(models.SyncEvent) error) error
}

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(db *gorm.DB, explorerClient ExplorerClient, afters ...utils.Afterer) StatsPusher

NewStatsPusher returns a new StatsPusher service

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"
)

Jump to

Keyboard shortcuts

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