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 ¶
This section is empty.
Types ¶
type ConnectionStatus ¶
type ConnectionStatus string
type ExplorerClient ¶
type ExplorerClient interface { Url() url.URL Status() ConnectionStatus Start() error Close() error Send([]byte, ...int) Receive(...time.Duration) ([]byte, error) }
ExplorerClient encapsulates all the functionality needed to push run information to explorer.
func NewExplorerClient ¶
func NewExplorerClient(url *url.URL, accessKey, secret string) ExplorerClient
NewExplorerClient returns a stats pusher using a websocket for delivery.
type NoopExplorerClient ¶
type NoopExplorerClient struct{}
func (NoopExplorerClient) Close ¶
func (NoopExplorerClient) Close() error
func (NoopExplorerClient) Receive ¶
func (NoopExplorerClient) Receive(...time.Duration) ([]byte, error)
func (NoopExplorerClient) Send ¶
func (NoopExplorerClient) Send([]byte, ...int)
func (NoopExplorerClient) Start ¶
func (NoopExplorerClient) Start() error
func (NoopExplorerClient) Status ¶
func (NoopExplorerClient) Status() ConnectionStatus
func (NoopExplorerClient) Url ¶
func (NoopExplorerClient) Url() url.URL
type NoopStatsPusher ¶
type NoopStatsPusher struct{}
func (NoopStatsPusher) AllSyncEvents ¶
func (NoopStatsPusher) AllSyncEvents(cb func(models.SyncEvent) error) error
func (NoopStatsPusher) Close ¶
func (NoopStatsPusher) Close() error
func (NoopStatsPusher) GetStatus ¶
func (NoopStatsPusher) GetStatus() ConnectionStatus
func (NoopStatsPusher) GetURL ¶
func (NoopStatsPusher) GetURL() url.URL
func (NoopStatsPusher) PushNow ¶
func (NoopStatsPusher) PushNow()
func (NoopStatsPusher) Start ¶
func (NoopStatsPusher) Start() error
type StatsPusher ¶
type StatsPusher interface { Start() error Close() error 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 ¶
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 SeerlinkFulfilled event was // detected in the transaction receipt. StatusFulfilledRunLog TxStatus = "fulfilledRunLog" // StatusNoFulfilledRunLog indicates that no SeerlinkFulfilled events were // detected in the transaction receipt. StatusNoFulfilledRunLog = "noFulfilledRunLog" )
Click to show internal directories.
Click to hide internal directories.