feeds

package
v1.10.17 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobTypeFluxMonitor       = "fluxmonitor"
	JobTypeOffchainReporting = "ocr"
)

We only support OCR and FM for the feeds manager

Variables

View Source
var (
	ErrOCRDisabled = errors.New("ocr is disabled")
)

Functions

func NewORM

func NewORM(db *gorm.DB) *orm

func NewService

func NewService(
	orm ORM,
	jobORM job.ORM,
	txm postgres.TransactionManager,
	jobSpawner job.Spawner,
	csaKeyStore keystore.CSA,
	ethKeyStore keystore.Eth,
	cfg Config,
	chainSet evm.ChainSet,
	lggr logger.Logger,
	version string,
) *service

NewService constructs a new feeds service

Types

type Config

type Config interface {
	ChainID() *big.Int
	Dev() bool
	FeatureOffchainReporting() bool
	DefaultHTTPTimeout() models.Duration
	OCRBlockchainTimeout() time.Duration
	OCRContractConfirmations() uint16
	OCRContractPollInterval() time.Duration
	OCRContractSubscribeInterval() time.Duration
	OCRContractTransmitterTransmitTimeout() time.Duration
	OCRDatabaseTimeout() time.Duration
	OCRObservationTimeout() time.Duration
	OCRObservationGracePeriod() time.Duration
}

type ConnectOpts added in v1.10.17

type ConnectOpts struct {
	FeedsManagerID int64

	// URI is the URI of the feeds manager
	URI string

	// Privkey defines the local CSA private key
	Privkey []byte

	// Pubkey defines the Feeds Manager Service's public key
	Pubkey []byte

	// Handlers defines the wsrpc Handlers
	Handlers pb.NodeServiceServer

	// OnConnect defines a callback for when the dial succeeds
	OnConnect func(pb.FeedsManagerClient)
}

ConnectOpts defines the required options to connect to an FMS server

type ConnectionsManager added in v1.10.17

type ConnectionsManager interface {
	Connect(opts ConnectOpts)
	Disconnect(id int64) error
	Close()
	GetClient(id int64) (pb.FeedsManagerClient, error)
	IsConnected(id int64) bool
}

type FeedsManager

type FeedsManager struct {
	ID        int64
	Name      string
	URI       string
	PublicKey crypto.PublicKey
	JobTypes  pq.StringArray `gorm:"type:text[]"`

	// Determines whether the node will be used as a bootstrap peer. If this is
	// true, you must have both an OCRBootstrapAddr and OCRBootstrapPeerID.
	IsOCRBootstrapPeer bool

	// The libp2p multiaddress which the node operator will assign to this node
	// for bootstrap peer discovery.
	OCRBootstrapPeerMultiaddr null.String

	// IsConnectionActive is the indicator of connection activeness
	IsConnectionActive bool

	CreatedAt time.Time
	UpdatedAt time.Time
}

FeedsManager contains feeds manager related fields

func (FeedsManager) TableName

func (FeedsManager) TableName() string

type JobProposal

type JobProposal struct {
	ID int64
	// RemoteUUID is the unique id of the proposal in FMS.
	RemoteUUID uuid.UUID
	Spec       string
	Status     JobProposalStatus
	// ExternalJobID is the external job id in the spec.
	ExternalJobID  uuid.NullUUID
	FeedsManagerID int64
	Multiaddrs     pq.StringArray `gorm:"type:text[]"`
	ProposedAt     time.Time
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

func (*JobProposal) CanEditSpec added in v1.10.17

func (jp *JobProposal) CanEditSpec() bool

type JobProposalStatus

type JobProposalStatus string

JobProposalStatus are the status codes that define the stage of a proposal

const (
	JobProposalStatusPending   JobProposalStatus = "pending"
	JobProposalStatusApproved  JobProposalStatus = "approved"
	JobProposalStatusRejected  JobProposalStatus = "rejected"
	JobProposalStatusCancelled JobProposalStatus = "cancelled"
)

type ORM

type ORM interface {
	ApproveJobProposal(ctx context.Context, id int64, externalJobID uuid.UUID, status JobProposalStatus) error
	CancelJobProposal(ctx context.Context, id int64) error
	CountJobProposals(ctx context.Context) (int64, error)
	CountManagers(ctx context.Context) (int64, error)
	CreateJobProposal(ctx context.Context, jp *JobProposal) (int64, error)
	CreateManager(ctx context.Context, ms *FeedsManager) (int64, error)
	GetJobProposal(ctx context.Context, id int64) (*JobProposal, error)
	GetJobProposalByRemoteUUID(ctx context.Context, uuid uuid.UUID) (*JobProposal, error)
	GetManager(ctx context.Context, id int64) (*FeedsManager, error)
	IsJobManaged(ctx context.Context, jobID int64) (bool, error)
	ListJobProposals(ctx context.Context) ([]JobProposal, error)
	ListManagers(ctx context.Context) ([]FeedsManager, error)
	UpdateJobProposalSpec(ctx context.Context, id int64, spec string) error
	UpdateJobProposalStatus(ctx context.Context, id int64, status JobProposalStatus) error
	UpdateManager(ctx context.Context, mgr FeedsManager) error
	UpsertJobProposal(ctx context.Context, jp *JobProposal) (int64, error)
}

type RPCHandlers

type RPCHandlers struct {
	// contains filtered or unexported fields
}

RPCHandlers define handlers for RPC method calls from the Feeds Manager

func NewRPCHandlers

func NewRPCHandlers(svc Service, feedsManagerID int64) *RPCHandlers

func (*RPCHandlers) ProposeJob

ProposeJob creates a new job proposal record for the feeds manager

type Service

type Service interface {
	Start() error
	Close() error

	ApproveJobProposal(ctx context.Context, id int64) error
	CountManagers() (int64, error)
	CancelJobProposal(ctx context.Context, id int64) error
	CreateJobProposal(jp *JobProposal) (int64, error)
	GetJobProposal(id int64) (*JobProposal, error)
	GetManager(id int64) (*FeedsManager, error)
	ListManagers() ([]FeedsManager, error)
	ListJobProposals() ([]JobProposal, error)
	ProposeJob(jp *JobProposal) (int64, error)
	RegisterManager(ms *FeedsManager) (int64, error)
	RejectJobProposal(ctx context.Context, id int64) error
	SyncNodeInfo(id int64) error
	UpdateJobProposalSpec(ctx context.Context, id int64, spec string) error
	UpdateFeedsManager(ctx context.Context, mgr FeedsManager) error
	IsJobManaged(ctx context.Context, jobID int64) (bool, error)

	Unsafe_SetConnectionsManager(ConnectionsManager)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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