feeds

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 27 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")
	ErrSingleFeedsManager = errors.New("only a single feeds manager is supported")
)

Functions

func NewORM

func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.LogConfig) *orm

func NewService

func NewService(
	orm ORM,
	jobORM job.ORM,
	db *sqlx.DB,
	jobSpawner job.Spawner,
	keyStore keystore.Master,
	cfg Config,
	chainSet evm.ChainSet,
	lggr logger.Logger,
	version string,
) *service

NewService constructs a new feeds service

Types

type Config added in v0.10.10

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
	LogSQL() bool
}

type ConnectOpts added in v1.0.0

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.0.0

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

	// 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 added in v0.10.9

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
	ProposedAt     time.Time
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

func (*JobProposal) CanEditSpec added in v1.1.0

func (jp *JobProposal) CanEditSpec() bool

type JobProposalStatus added in v0.10.9

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 NullService added in v1.1.0

type NullService struct{}

func (NullService) ApproveJobProposal added in v1.1.0

func (ns NullService) ApproveJobProposal(ctx context.Context, id int64) error

func (NullService) CancelJobProposal added in v1.1.0

func (ns NullService) CancelJobProposal(ctx context.Context, id int64) error

func (NullService) Close added in v1.1.0

func (ns NullService) Close() error

func (NullService) CountManagers added in v1.1.0

func (ns NullService) CountManagers() (int64, error)

func (NullService) CreateJobProposal added in v1.1.0

func (ns NullService) CreateJobProposal(jp *JobProposal) (int64, error)

func (NullService) GetJobProposal added in v1.1.0

func (ns NullService) GetJobProposal(id int64) (*JobProposal, error)

func (NullService) GetJobProposalsByManagersIDs added in v1.1.0

func (ns NullService) GetJobProposalsByManagersIDs(ids []int64) ([]JobProposal, error)

func (NullService) GetManager added in v1.1.0

func (ns NullService) GetManager(id int64) (*FeedsManager, error)

func (NullService) GetManagers added in v1.1.0

func (ns NullService) GetManagers(ids []int64) ([]FeedsManager, error)

func (NullService) IsJobManaged added in v1.1.0

func (ns NullService) IsJobManaged(ctx context.Context, jobID int64) (bool, error)

func (NullService) ListJobProposals added in v1.1.0

func (ns NullService) ListJobProposals() ([]JobProposal, error)

func (NullService) ListManagers added in v1.1.0

func (ns NullService) ListManagers() ([]FeedsManager, error)

func (NullService) ProposeJob added in v1.1.0

func (ns NullService) ProposeJob(jp *JobProposal) (int64, error)

func (NullService) RegisterManager added in v1.1.0

func (ns NullService) RegisterManager(ms *FeedsManager) (int64, error)

func (NullService) RejectJobProposal added in v1.1.0

func (ns NullService) RejectJobProposal(ctx context.Context, id int64) error

func (NullService) Start added in v1.1.0

func (ns NullService) Start() error

func (NullService) SyncNodeInfo added in v1.1.0

func (ns NullService) SyncNodeInfo(id int64) error

func (NullService) Unsafe_SetConnectionsManager added in v1.1.0

func (ns NullService) Unsafe_SetConnectionsManager(_ ConnectionsManager)

func (NullService) UpdateFeedsManager added in v1.1.0

func (ns NullService) UpdateFeedsManager(ctx context.Context, mgr FeedsManager) error

func (NullService) UpdateJobProposalSpec added in v1.1.0

func (ns NullService) UpdateJobProposalSpec(ctx context.Context, id int64, spec string) error

type ORM

type ORM interface {
	ApproveJobProposal(id int64, externalJobID uuid.UUID, status JobProposalStatus, qopts ...pg.QOpt) error
	CancelJobProposal(id int64, qopts ...pg.QOpt) error
	CountJobProposals() (int64, error)
	CountManagers() (int64, error)
	CreateJobProposal(jp *JobProposal) (int64, error)
	CreateManager(ms *FeedsManager) (int64, error)
	GetJobProposal(id int64, qopts ...pg.QOpt) (*JobProposal, error)
	GetJobProposalsByManagersIDs(ids []int64, qopts ...pg.QOpt) ([]JobProposal, error)
	GetJobProposalByRemoteUUID(uuid uuid.UUID) (*JobProposal, error)
	GetManager(id int64) (*FeedsManager, error)
	GetManagers(ids []int64) ([]FeedsManager, error)
	IsJobManaged(jobID int64, qopts ...pg.QOpt) (bool, error)
	ListJobProposals() (jps []JobProposal, err error)
	ListManagers() (mgrs []FeedsManager, err error)
	UpdateJobProposalSpec(id int64, spec string, qopts ...pg.QOpt) error
	UpdateJobProposalStatus(id int64, status JobProposalStatus, qopts ...pg.QOpt) error
	UpdateManager(mgr FeedsManager, qopts ...pg.QOpt) error
	UpsertJobProposal(jp *JobProposal) (int64, error)
}

type RPCHandlers added in v0.10.9

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

RPCHandlers define handlers for RPC method calls from the Feeds Manager

func NewRPCHandlers added in v0.10.9

func NewRPCHandlers(svc Service, feedsManagerID int64) *RPCHandlers

func (*RPCHandlers) ProposeJob added in v0.10.9

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)
	GetManagers(ids []int64) ([]FeedsManager, error)
	ListManagers() ([]FeedsManager, error)
	ListJobProposals() ([]JobProposal, error)
	GetJobProposalsByManagersIDs(ids []int64) ([]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)
}

Service represents a behavior of the feeds service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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