seerlink

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: ISC Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application interface {
	Start() error
	Stop() error
	GetStore() *strpkg.Store
	GetJobORM() job.ORM
	GetExternalInitiatorManager() ExternalInitiatorManager
	GetStatsPusher() synchronization.StatsPusher
	WakeSessionReaper()
	AddJob(job models.JobSpec) error
	AddJobV2(ctx context.Context, job job.SpecDB, name null.String) (int32, error)
	ArchiveJob(models.JobID) error
	DeleteJobV2(ctx context.Context, jobID int32) error
	RunJobV2(ctx context.Context, jobID int32, meta map[string]interface{}) (int64, error)
	AddServiceAgreement(*models.ServiceAgreement) error
	NewBox() packr.Box
	AwaitRun(ctx context.Context, runID int64) error
	services.RunManager
}

Application implements the common functions used in the core node.

func NewApplication

func NewApplication(config *orm.Config, ethClient eth.Client, advisoryLocker postgres.AdvisoryLocker, keyStoreGenerator strpkg.KeyStoreGenerator, externalInitiatorManager ExternalInitiatorManager, onConnectCallbacks ...func(Application)) Application

NewApplication initializes a new store if one is not already present at the configured root directory (default: ~/.seerlink), the logger at the same directory and returns the Application to be used by the node.

type ExternalInitiatorManager

type ExternalInitiatorManager interface {
	Notify(models.JobSpec, *strpkg.Store) error
	DeleteJob(db *gorm.DB, jobID models.JobID) error
}

ExternalInitiatorManager manages HTTP requests to remote external initiators

type SeerlinkApplication

type SeerlinkApplication struct {
	Exiter      func(int)
	HeadTracker *services.HeadTracker
	StatsPusher synchronization.StatsPusher
	services.RunManager
	RunQueue         services.RunQueue
	JobSubscriber    services.JobSubscriber
	GasUpdater       services.GasUpdater
	EthBroadcaster   bulletprooftxmanager.EthBroadcaster
	LogBroadcaster   log.Broadcaster
	EventBroadcaster postgres.EventBroadcaster
	JobORM           job.ORM

	FluxMonitor              fluxmonitor.Service
	Scheduler                *services.Scheduler
	Store                    *strpkg.Store
	ExternalInitiatorManager ExternalInitiatorManager
	SessionReaper            utils.SleeperTask
	// contains filtered or unexported fields
}

SeerlinkApplication contains fields for the JobSubscriber, Scheduler, and Store. The JobSubscriber and Scheduler are also available in the services package, but the Store has its own package.

func (*SeerlinkApplication) AddJob

func (app *SeerlinkApplication) AddJob(job models.JobSpec) error

AddJob adds a job to the store and the scheduler. If there was an error from adding the job to the store, the job will not be added to the scheduler.

func (*SeerlinkApplication) AddJobV2

func (app *SeerlinkApplication) AddJobV2(ctx context.Context, job job.SpecDB, name null.String) (int32, error)

func (*SeerlinkApplication) AddServiceAgreement

func (app *SeerlinkApplication) AddServiceAgreement(sa *models.ServiceAgreement) error

AddServiceAgreement adds a Service Agreement which includes a job that needs to be scheduled.

func (*SeerlinkApplication) ArchiveJob

func (app *SeerlinkApplication) ArchiveJob(ID models.JobID) error

ArchiveJob silences the job from the system, preventing future job runs. It is idempotent and can be run as many times as you like.

func (*SeerlinkApplication) AwaitRun

func (app *SeerlinkApplication) AwaitRun(ctx context.Context, runID int64) error

func (*SeerlinkApplication) DeleteJobV2

func (app *SeerlinkApplication) DeleteJobV2(ctx context.Context, jobID int32) error

func (*SeerlinkApplication) GetExternalInitiatorManager

func (app *SeerlinkApplication) GetExternalInitiatorManager() ExternalInitiatorManager

func (*SeerlinkApplication) GetJobORM

func (app *SeerlinkApplication) GetJobORM() job.ORM

func (*SeerlinkApplication) GetStatsPusher

func (app *SeerlinkApplication) GetStatsPusher() synchronization.StatsPusher

func (*SeerlinkApplication) GetStore

func (app *SeerlinkApplication) GetStore() *strpkg.Store

GetStore returns the pointer to the store for the SeerlinkApplication.

func (*SeerlinkApplication) NewBox

func (app *SeerlinkApplication) NewBox() packr.Box

NewBox returns the packr.Box instance that holds the static assets to be delivered by the router.

func (*SeerlinkApplication) RunJobV2

func (app *SeerlinkApplication) RunJobV2(ctx context.Context, jobID int32, meta map[string]interface{}) (int64, error)

func (*SeerlinkApplication) Start

func (app *SeerlinkApplication) Start() error

Start all necessary services. If successful, nil will be returned. Also listens for interrupt signals from the operating system so that the application can be properly closed before the application exits.

func (*SeerlinkApplication) Stop

func (app *SeerlinkApplication) Stop() error

Stop allows the application to exit by halting schedules, closing logs, and closing the DB connection.

func (*SeerlinkApplication) StopIfStarted

func (app *SeerlinkApplication) StopIfStarted() error

func (*SeerlinkApplication) WakeSessionReaper

func (app *SeerlinkApplication) WakeSessionReaper()

WakeSessionReaper wakes up the reaper to do its reaping.

type StartCloser

type StartCloser interface {
	Start() error
	Close() error
}

Jump to

Keyboard shortcuts

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