Documentation ¶
Index ¶
- Constants
- Variables
- func FromPluginTypeInput(pt PluginType) string
- func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig) *orm
- func NewService(orm ORM, jobORM job.ORM, db *sqlx.DB, jobSpawner job.Spawner, ...) *service
- type ChainConfig
- type ChainType
- type ConnectOpts
- type ConnectionsManager
- type DeleteJobArgs
- type FeedsManager
- type FluxMonitorConfig
- type InsecureConfig
- type JobConfig
- type JobProposal
- type JobProposalCounts
- type JobProposalSpec
- type JobProposalStatus
- type NullService
- func (ns NullService) ApproveSpec(ctx context.Context, id int64, force bool) error
- func (ns NullService) CancelSpec(ctx context.Context, id int64) error
- func (ns NullService) Close() error
- func (ns NullService) CountJobProposalsByStatus() (*JobProposalCounts, error)
- func (ns NullService) CountManagers() (int64, error)
- func (ns NullService) CreateChainConfig(ctx context.Context, cfg ChainConfig) (int64, error)
- func (ns NullService) DeleteChainConfig(ctx context.Context, id int64) (int64, error)
- func (ns NullService) DeleteJob(ctx context.Context, args *DeleteJobArgs) (int64, error)
- func (ns NullService) GetChainConfig(id int64) (*ChainConfig, error)
- func (ns NullService) GetJobProposal(id int64) (*JobProposal, error)
- func (ns NullService) GetManager(id int64) (*FeedsManager, error)
- func (ns NullService) GetSpec(id int64) (*JobProposalSpec, error)
- func (ns NullService) IsJobManaged(ctx context.Context, jobID int64) (bool, error)
- func (ns NullService) ListChainConfigsByManagerIDs(mgrIDs []int64) ([]ChainConfig, error)
- func (ns NullService) ListJobProposals() ([]JobProposal, error)
- func (ns NullService) ListJobProposalsByManagersIDs(ids []int64) ([]JobProposal, error)
- func (ns NullService) ListManagers() ([]FeedsManager, error)
- func (ns NullService) ListManagersByIDs(ids []int64) ([]FeedsManager, error)
- func (ns NullService) ListSpecsByJobProposalIDs(ids []int64) ([]JobProposalSpec, error)
- func (ns NullService) ProposeJob(ctx context.Context, args *ProposeJobArgs) (int64, error)
- func (ns NullService) RegisterManager(ctx context.Context, params RegisterManagerParams) (int64, error)
- func (ns NullService) RejectSpec(ctx context.Context, id int64) error
- func (ns NullService) RevokeJob(ctx context.Context, args *RevokeJobArgs) (int64, error)
- func (ns NullService) Start(ctx context.Context) error
- func (ns NullService) SyncNodeInfo(ctx context.Context, id int64) error
- func (ns NullService) Unsafe_SetConnectionsManager(_ ConnectionsManager)
- func (ns NullService) UpdateChainConfig(ctx context.Context, cfg ChainConfig) (int64, error)
- func (ns NullService) UpdateManager(ctx context.Context, mgr FeedsManager) error
- func (ns NullService) UpdateSpecDefinition(ctx context.Context, id int64, spec string) error
- type OCR1Config
- type OCR2Config
- type OCR2ConfigModel
- type OCRConfig
- type ORM
- type PluginType
- type Plugins
- type ProposeJobArgs
- type RPCHandlers
- func (h *RPCHandlers) DeleteJob(ctx context.Context, req *pb.DeleteJobRequest) (*pb.DeleteJobResponse, error)
- func (h *RPCHandlers) ProposeJob(ctx context.Context, req *pb.ProposeJobRequest) (*pb.ProposeJobResponse, error)
- func (h *RPCHandlers) RevokeJob(ctx context.Context, req *pb.RevokeJobRequest) (*pb.RevokeJobResponse, error)
- type RegisterManagerParams
- type RevokeJobArgs
- type Service
- type SpecStatus
Constants ¶
const ( JobTypeFluxMonitor = "fluxmonitor" JobTypeOffchainReporting = "ocr" JobTypeOffchainReporting2 = "ocr2" )
Variables ¶
var ( ErrOCR2Disabled = errors.New("ocr2 is disabled") ErrOCRDisabled = errors.New("ocr is disabled") ErrSingleFeedsManager = errors.New("only a single feeds manager is supported") ErrJobAlreadyExists = errors.New("a job for this contract address already exists - please use the 'force' option to replace it") ErrFeedsManagerDisabled = errors.New("feeds manager is disabled") )
Functions ¶
func FromPluginTypeInput ¶
func FromPluginTypeInput(pt PluginType) string
func NewService ¶
func NewService( orm ORM, jobORM job.ORM, db *sqlx.DB, jobSpawner job.Spawner, keyStore keystore.Master, insecureCfg InsecureConfig, jobCfg JobConfig, ocrCfg OCRConfig, ocr2Cfg OCR2Config, dbCfg pg.QConfig, legacyChains legacyevm.LegacyChainContainer, lggr logger.Logger, version string, ) *service
NewService constructs a new feeds service
Types ¶
type ChainConfig ¶
type ChainConfig struct { ID int64 FeedsManagerID int64 ChainID string ChainType ChainType AccountAddress string AdminAddress string FluxMonitorConfig FluxMonitorConfig OCR1Config OCR1Config OCR2Config OCR2ConfigModel CreatedAt time.Time UpdatedAt time.Time }
ChainConfig defines the chain configuration for a Feeds Manager.
type ConnectOpts ¶
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 ¶
type ConnectionsManager interface { Connect(opts ConnectOpts) Disconnect(id int64) error Close() GetClient(id int64) (pb.FeedsManagerClient, error) IsConnected(id int64) bool }
type DeleteJobArgs ¶
DeleteJobArgs are the arguments to provide to the DeleteJob method.
type FeedsManager ¶
type FeedsManager struct { ID int64 Name string URI string PublicKey crypto.PublicKey IsConnectionActive bool CreatedAt time.Time UpdatedAt time.Time }
FeedsManager defines a registered Feeds Manager Service and the connection information.
type FluxMonitorConfig ¶
type FluxMonitorConfig struct {
Enabled bool `json:"enabled"`
}
FluxMonitorConfig defines configuration for FluxMonitorJobs.
func (*FluxMonitorConfig) Scan ¶
func (c *FluxMonitorConfig) Scan(value interface{}) error
type InsecureConfig ¶ added in v2.3.0
type InsecureConfig interface {
OCRDevelopmentMode() bool
}
type JobConfig ¶ added in v2.3.0
type JobConfig interface {
DefaultHTTPTimeout() commonconfig.Duration
}
type JobProposal ¶
type JobProposal struct { ID int64 Name null.String RemoteUUID uuid.UUID // RemoteUUID is the uuid of the proposal in FMS. Status JobProposalStatus ExternalJobID uuid.NullUUID // ExternalJobID is the external job id in the job spec. FeedsManagerID int64 Multiaddrs pq.StringArray PendingUpdate bool CreatedAt time.Time UpdatedAt time.Time }
JobProposal represents a proposal which has been sent by a Feeds Manager.
A job proposal has multiple spec versions which are created each time the Feeds Manager sends a new proposal version.
type JobProposalCounts ¶
type JobProposalCounts struct { Pending int64 Cancelled int64 Approved int64 Rejected int64 Deleted int64 Revoked int64 }
JobProposalCounts defines the counts for job proposals of each status.
type JobProposalSpec ¶
type JobProposalSpec struct { ID int64 Definition string Status SpecStatus Version int32 JobProposalID int64 StatusUpdatedAt time.Time CreatedAt time.Time UpdatedAt time.Time }
JobProposalSpec defines a versioned proposed spec for a JobProposal.
func (*JobProposalSpec) CanEditDefinition ¶
func (s *JobProposalSpec) CanEditDefinition() bool
CanEditDefinition checks if the spec definition can be edited.
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" JobProposalStatusDeleted JobProposalStatus = "deleted" JobProposalStatusRevoked JobProposalStatus = "revoked" )
type NullService ¶
type NullService struct{}
NullService defines an implementation of the Feeds Service that is used when the Feeds Service is disabled.
func (NullService) ApproveSpec ¶
func (NullService) CancelSpec ¶
func (ns NullService) CancelSpec(ctx context.Context, id int64) error
func (NullService) Close ¶
func (ns NullService) Close() error
func (NullService) CountJobProposalsByStatus ¶
func (ns NullService) CountJobProposalsByStatus() (*JobProposalCounts, error)
func (NullService) CountManagers ¶
func (ns NullService) CountManagers() (int64, error)
func (NullService) CreateChainConfig ¶
func (ns NullService) CreateChainConfig(ctx context.Context, cfg ChainConfig) (int64, error)
func (NullService) DeleteChainConfig ¶
func (NullService) DeleteJob ¶
func (ns NullService) DeleteJob(ctx context.Context, args *DeleteJobArgs) (int64, error)
func (NullService) GetChainConfig ¶
func (ns NullService) GetChainConfig(id int64) (*ChainConfig, error)
func (NullService) GetJobProposal ¶
func (ns NullService) GetJobProposal(id int64) (*JobProposal, error)
func (NullService) GetManager ¶
func (ns NullService) GetManager(id int64) (*FeedsManager, error)
func (NullService) GetSpec ¶
func (ns NullService) GetSpec(id int64) (*JobProposalSpec, error)
func (NullService) IsJobManaged ¶
func (NullService) ListChainConfigsByManagerIDs ¶
func (ns NullService) ListChainConfigsByManagerIDs(mgrIDs []int64) ([]ChainConfig, error)
func (NullService) ListJobProposals ¶
func (ns NullService) ListJobProposals() ([]JobProposal, error)
func (NullService) ListJobProposalsByManagersIDs ¶
func (ns NullService) ListJobProposalsByManagersIDs(ids []int64) ([]JobProposal, error)
func (NullService) ListManagers ¶
func (ns NullService) ListManagers() ([]FeedsManager, error)
func (NullService) ListManagersByIDs ¶
func (ns NullService) ListManagersByIDs(ids []int64) ([]FeedsManager, error)
func (NullService) ListSpecsByJobProposalIDs ¶
func (ns NullService) ListSpecsByJobProposalIDs(ids []int64) ([]JobProposalSpec, error)
func (NullService) ProposeJob ¶
func (ns NullService) ProposeJob(ctx context.Context, args *ProposeJobArgs) (int64, error)
func (NullService) RegisterManager ¶
func (ns NullService) RegisterManager(ctx context.Context, params RegisterManagerParams) (int64, error)
func (NullService) RejectSpec ¶
func (ns NullService) RejectSpec(ctx context.Context, id int64) error
func (NullService) RevokeJob ¶
func (ns NullService) RevokeJob(ctx context.Context, args *RevokeJobArgs) (int64, error)
func (NullService) SyncNodeInfo ¶
func (ns NullService) SyncNodeInfo(ctx context.Context, id int64) error
func (NullService) Unsafe_SetConnectionsManager ¶
func (ns NullService) Unsafe_SetConnectionsManager(_ ConnectionsManager)
func (NullService) UpdateChainConfig ¶
func (ns NullService) UpdateChainConfig(ctx context.Context, cfg ChainConfig) (int64, error)
func (NullService) UpdateManager ¶
func (ns NullService) UpdateManager(ctx context.Context, mgr FeedsManager) error
func (NullService) UpdateSpecDefinition ¶
type OCR1Config ¶
type OCR1Config struct { Enabled bool `json:"enabled"` IsBootstrap bool `json:"is_bootstrap"` Multiaddr null.String `json:"multiaddr"` P2PPeerID null.String `json:"p2p_peer_id"` KeyBundleID null.String `json:"key_bundle_id"` }
OCR1Config defines configuration for OCR1 Jobs.
func (*OCR1Config) Scan ¶
func (c *OCR1Config) Scan(value interface{}) error
type OCR2Config ¶
type OCR2ConfigModel ¶ added in v2.3.0
type OCR2ConfigModel struct { Enabled bool `json:"enabled"` IsBootstrap bool `json:"is_bootstrap"` Multiaddr null.String `json:"multiaddr"` ForwarderAddress null.String `json:"forwarder_address"` P2PPeerID null.String `json:"p2p_peer_id"` KeyBundleID null.String `json:"key_bundle_id"` Plugins Plugins `json:"plugins"` }
OCR2ConfigModel defines configuration for OCR2 Jobs.
func (*OCR2ConfigModel) Scan ¶ added in v2.3.0
func (c *OCR2ConfigModel) Scan(value interface{}) error
type ORM ¶
type ORM interface { CountManagers() (int64, error) CreateManager(ms *FeedsManager, qopts ...pg.QOpt) (int64, error) GetManager(id int64) (*FeedsManager, error) ListManagers() (mgrs []FeedsManager, err error) ListManagersByIDs(ids []int64) ([]FeedsManager, error) UpdateManager(mgr FeedsManager, qopts ...pg.QOpt) error CreateBatchChainConfig(cfgs []ChainConfig, qopts ...pg.QOpt) ([]int64, error) CreateChainConfig(cfg ChainConfig, qopts ...pg.QOpt) (int64, error) DeleteChainConfig(id int64) (int64, error) GetChainConfig(id int64) (*ChainConfig, error) ListChainConfigsByManagerIDs(mgrIDs []int64) ([]ChainConfig, error) UpdateChainConfig(cfg ChainConfig) (int64, error) CountJobProposals() (int64, error) CountJobProposalsByStatus() (counts *JobProposalCounts, err error) CreateJobProposal(jp *JobProposal) (int64, error) DeleteProposal(id int64, qopts ...pg.QOpt) error GetJobProposal(id int64, qopts ...pg.QOpt) (*JobProposal, error) GetJobProposalByRemoteUUID(uuid uuid.UUID) (*JobProposal, error) ListJobProposals() (jps []JobProposal, err error) ListJobProposalsByManagersIDs(ids []int64, qopts ...pg.QOpt) ([]JobProposal, error) UpdateJobProposalStatus(id int64, status JobProposalStatus, qopts ...pg.QOpt) error // NEEDED? UpsertJobProposal(jp *JobProposal, qopts ...pg.QOpt) (int64, error) ApproveSpec(id int64, externalJobID uuid.UUID, qopts ...pg.QOpt) error CancelSpec(id int64, qopts ...pg.QOpt) error CreateSpec(spec JobProposalSpec, qopts ...pg.QOpt) (int64, error) ExistsSpecByJobProposalIDAndVersion(jpID int64, version int32, qopts ...pg.QOpt) (exists bool, err error) GetApprovedSpec(jpID int64, qopts ...pg.QOpt) (*JobProposalSpec, error) GetLatestSpec(jpID int64) (*JobProposalSpec, error) GetSpec(id int64, qopts ...pg.QOpt) (*JobProposalSpec, error) ListSpecsByJobProposalIDs(ids []int64, qopts ...pg.QOpt) ([]JobProposalSpec, error) RejectSpec(id int64, qopts ...pg.QOpt) error RevokeSpec(id int64, qopts ...pg.QOpt) error UpdateSpecDefinition(id int64, spec string, qopts ...pg.QOpt) error IsJobManaged(jobID int64, qopts ...pg.QOpt) (bool, error) }
type PluginType ¶
type PluginType string
const ( PluginTypeCommit PluginType = "COMMIT" PluginTypeExecute PluginType = "EXECUTE" PluginTypeMedian PluginType = "MEDIAN" PluginTypeMercury PluginType = "MERCURY" PluginTypeUnknown PluginType = "UNKNOWN" )
func ToPluginType ¶
func ToPluginType(s string) (PluginType, error)
type Plugins ¶
type ProposeJobArgs ¶
type ProposeJobArgs struct { FeedsManagerID int64 RemoteUUID uuid.UUID Multiaddrs pq.StringArray Version int32 Spec string }
ProposeJobArgs are the arguments to provide to the ProposeJob method.
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) DeleteJob ¶
func (h *RPCHandlers) DeleteJob(ctx context.Context, req *pb.DeleteJobRequest) (*pb.DeleteJobResponse, error)
DeleteJob deletes a job proposal record.
func (*RPCHandlers) ProposeJob ¶
func (h *RPCHandlers) ProposeJob(ctx context.Context, req *pb.ProposeJobRequest) (*pb.ProposeJobResponse, error)
ProposeJob creates a new job proposal record for the feeds manager
func (*RPCHandlers) RevokeJob ¶
func (h *RPCHandlers) RevokeJob(ctx context.Context, req *pb.RevokeJobRequest) (*pb.RevokeJobResponse, error)
RevokeJob revokes a pending job proposal record.
type RegisterManagerParams ¶
type RegisterManagerParams struct { Name string URI string PublicKey crypto.PublicKey ChainConfigs []ChainConfig }
type RevokeJobArgs ¶
RevokeJobArgs are the arguments to provide the RevokeJob method
type Service ¶
type Service interface { Start(ctx context.Context) error Close() error CountManagers() (int64, error) GetManager(id int64) (*FeedsManager, error) ListManagers() ([]FeedsManager, error) ListManagersByIDs(ids []int64) ([]FeedsManager, error) RegisterManager(ctx context.Context, params RegisterManagerParams) (int64, error) UpdateManager(ctx context.Context, mgr FeedsManager) error CreateChainConfig(ctx context.Context, cfg ChainConfig) (int64, error) DeleteChainConfig(ctx context.Context, id int64) (int64, error) GetChainConfig(id int64) (*ChainConfig, error) ListChainConfigsByManagerIDs(mgrIDs []int64) ([]ChainConfig, error) UpdateChainConfig(ctx context.Context, cfg ChainConfig) (int64, error) DeleteJob(ctx context.Context, args *DeleteJobArgs) (int64, error) IsJobManaged(ctx context.Context, jobID int64) (bool, error) ProposeJob(ctx context.Context, args *ProposeJobArgs) (int64, error) RevokeJob(ctx context.Context, args *RevokeJobArgs) (int64, error) SyncNodeInfo(ctx context.Context, id int64) error CountJobProposalsByStatus() (*JobProposalCounts, error) GetJobProposal(id int64) (*JobProposal, error) ListJobProposals() ([]JobProposal, error) ListJobProposalsByManagersIDs(ids []int64) ([]JobProposal, error) ApproveSpec(ctx context.Context, id int64, force bool) error CancelSpec(ctx context.Context, id int64) error GetSpec(id int64) (*JobProposalSpec, error) ListSpecsByJobProposalIDs(ids []int64) ([]JobProposalSpec, error) RejectSpec(ctx context.Context, id int64) error UpdateSpecDefinition(ctx context.Context, id int64, spec string) error Unsafe_SetConnectionsManager(ConnectionsManager) }
Service represents a behavior of the feeds service
type SpecStatus ¶
type SpecStatus string
SpecStatus is the status of each proposed spec.
const ( // SpecStatusPending defines a spec status which has been proposed by the // FMS. SpecStatusPending SpecStatus = "pending" // SpecStatusApproved defines a spec status which the node op has approved. // An approved spec is currently being run by the node. SpecStatusApproved SpecStatus = "approved" // SpecStatusRejected defines a spec status which was proposed, but was // rejected by the node op. SpecStatusRejected SpecStatus = "rejected" // SpecStatusCancelled defines a spec status which was previously approved, // but cancelled by the node op. A cancelled spec is not being run by the // node. SpecStatusCancelled SpecStatus = "cancelled" // SpecStatusRevoked defines a spec status which was revoked. A revoked spec cannot be // approved. SpecStatusRevoked SpecStatus = "revoked" )