Documentation ¶
Index ¶
- Constants
- Variables
- 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 Config
- type ConnectOpts
- type ConnectionsManager
- type FeedsManager
- type FluxMonitorConfig
- type JobProposal
- type JobProposalCounts
- type JobProposalSpec
- type JobProposalStatus
- type NullService
- func (ns NullService) ApproveJobProposal(ctx context.Context, id int64) error
- 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) CreateJobProposal(jp *JobProposal) (int64, error)
- func (ns NullService) DeleteChainConfig(ctx context.Context, id int64) (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) 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) UpdateJobProposalSpec(ctx context.Context, id int64, spec string) 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 ORM
- type ProposeJobArgs
- type RPCHandlers
- type RegisterManagerParams
- 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 ¶
Types ¶
type ChainConfig ¶ added in v1.5.0
type ChainConfig struct { ID int64 FeedsManagerID int64 ChainID string ChainType ChainType AccountAddress string AdminAddress string FluxMonitorConfig FluxMonitorConfig OCR1Config OCR1Config OCR2Config OCR2Config CreatedAt time.Time UpdatedAt time.Time }
ChainConfig defines the chain configuration for a Feeds Manager.
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 IsConnectionActive bool CreatedAt time.Time UpdatedAt time.Time }
FeedsManager defines a registered Feeds Manager Service and the connection information.
type FluxMonitorConfig ¶ added in v1.5.0
type FluxMonitorConfig struct {
Enabled bool `json:"enabled"`
}
FluxMonitorConfig defines configuration for FluxMonitorJobs.
func (*FluxMonitorConfig) Scan ¶ added in v1.5.0
func (c *FluxMonitorConfig) Scan(value interface{}) error
type JobProposal ¶ added in v0.10.9
type JobProposal struct { ID int64 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 ¶ added in v1.12.0
JobProposalCounts defines the counts for job proposals of each status.
type JobProposalSpec ¶ added in v1.2.0
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 ¶ added in v1.2.0
func (s *JobProposalSpec) CanEditDefinition() bool
CanEditDefinition checks if the spec definition can be edited.
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{}
NullService defines an implementation of the Feeds Service that is used when the Feeds Service is disabled.
func (NullService) ApproveJobProposal ¶ added in v1.1.0
func (ns NullService) ApproveJobProposal(ctx context.Context, id int64) error
func (NullService) ApproveSpec ¶ added in v1.2.0
func (NullService) CancelSpec ¶ added in v1.2.0
func (ns NullService) CancelSpec(ctx context.Context, id int64) error
func (NullService) Close ¶ added in v1.1.0
func (ns NullService) Close() error
func (NullService) CountJobProposalsByStatus ¶ added in v1.12.0
func (ns NullService) CountJobProposalsByStatus() (*JobProposalCounts, error)
func (NullService) CountManagers ¶ added in v1.1.0
func (ns NullService) CountManagers() (int64, error)
func (NullService) CreateChainConfig ¶ added in v1.5.0
func (ns NullService) CreateChainConfig(ctx context.Context, cfg ChainConfig) (int64, error)
func (NullService) CreateJobProposal ¶ added in v1.1.0
func (ns NullService) CreateJobProposal(jp *JobProposal) (int64, error)
func (NullService) DeleteChainConfig ¶ added in v1.5.0
func (NullService) GetChainConfig ¶ added in v1.5.0
func (ns NullService) GetChainConfig(id int64) (*ChainConfig, error)
func (NullService) GetJobProposal ¶ added in v1.1.0
func (ns NullService) GetJobProposal(id int64) (*JobProposal, error)
func (NullService) GetManager ¶ added in v1.1.0
func (ns NullService) GetManager(id int64) (*FeedsManager, error)
func (NullService) GetSpec ¶ added in v1.2.0
func (ns NullService) GetSpec(id int64) (*JobProposalSpec, error)
func (NullService) IsJobManaged ¶ added in v1.1.0
func (NullService) ListChainConfigsByManagerIDs ¶ added in v1.5.0
func (ns NullService) ListChainConfigsByManagerIDs(mgrIDs []int64) ([]ChainConfig, error)
func (NullService) ListJobProposals ¶ added in v1.1.0
func (ns NullService) ListJobProposals() ([]JobProposal, error)
func (NullService) ListJobProposalsByManagersIDs ¶ added in v1.2.0
func (ns NullService) ListJobProposalsByManagersIDs(ids []int64) ([]JobProposal, error)
func (NullService) ListManagers ¶ added in v1.1.0
func (ns NullService) ListManagers() ([]FeedsManager, error)
func (NullService) ListManagersByIDs ¶ added in v1.2.0
func (ns NullService) ListManagersByIDs(ids []int64) ([]FeedsManager, error)
func (NullService) ListSpecsByJobProposalIDs ¶ added in v1.2.0
func (ns NullService) ListSpecsByJobProposalIDs(ids []int64) ([]JobProposalSpec, error)
func (NullService) ProposeJob ¶ added in v1.1.0
func (ns NullService) ProposeJob(ctx context.Context, args *ProposeJobArgs) (int64, error)
func (NullService) RegisterManager ¶ added in v1.1.0
func (ns NullService) RegisterManager(ctx context.Context, params RegisterManagerParams) (int64, error)
func (NullService) RejectSpec ¶ added in v1.2.0
func (ns NullService) RejectSpec(ctx context.Context, id int64) error
func (NullService) SyncNodeInfo ¶ added in v1.1.0
func (ns NullService) SyncNodeInfo(ctx context.Context, id int64) error
func (NullService) Unsafe_SetConnectionsManager ¶ added in v1.1.0
func (ns NullService) Unsafe_SetConnectionsManager(_ ConnectionsManager)
func (NullService) UpdateChainConfig ¶ added in v1.5.0
func (ns NullService) UpdateChainConfig(ctx context.Context, cfg ChainConfig) (int64, error)
func (NullService) UpdateJobProposalSpec ¶ added in v1.1.0
func (NullService) UpdateManager ¶ added in v1.2.0
func (ns NullService) UpdateManager(ctx context.Context, mgr FeedsManager) error
func (NullService) UpdateSpecDefinition ¶ added in v1.2.0
type OCR1Config ¶ added in v1.5.0
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 ¶ added in v1.5.0
func (c *OCR1Config) Scan(value interface{}) error
type OCR2Config ¶ added in v1.5.0
type OCR2Config 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"` }
OCR2Config defines configuration for OCR2 Jobs.
func (*OCR2Config) Scan ¶ added in v1.5.0
func (c *OCR2Config) 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 CreateChainConfig(cfg ChainConfig, qopts ...pg.QOpt) (int64, error) CreateBatchChainConfig(cfgs []ChainConfig, qopts ...pg.QOpt) ([]int64, error) DeleteChainConfig(id int64) (int64, error) GetChainConfig(id int64) (*ChainConfig, error) UpdateChainConfig(cfg ChainConfig) (int64, error) ListChainConfigsByManagerIDs(mgrIDs []int64) ([]ChainConfig, error) CreateJobProposal(jp *JobProposal) (int64, error) CountJobProposals() (int64, error) CountJobProposalsByStatus() (counts *JobProposalCounts, err 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) 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 UpdateSpecDefinition(id int64, spec string, qopts ...pg.QOpt) error IsJobManaged(jobID int64, qopts ...pg.QOpt) (bool, error) }
type ProposeJobArgs ¶ added in v1.2.0
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 ¶ 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
func (h *RPCHandlers) ProposeJob(ctx context.Context, req *pb.ProposeJobRequest) (*pb.ProposeJobResponse, error)
ProposeJob creates a new job proposal record for the feeds manager
type RegisterManagerParams ¶ added in v1.5.0
type RegisterManagerParams struct { Name string URI string PublicKey crypto.PublicKey ChainConfigs []ChainConfig }
type Service ¶
type Service interface { Start(ctx context.Context) error Close() error CountManagers() (int64, error) GetManager(id int64) (*FeedsManager, error) ListManagersByIDs(ids []int64) ([]FeedsManager, error) ListManagers() ([]FeedsManager, error) RegisterManager(ctx context.Context, params RegisterManagerParams) (int64, error) UpdateManager(ctx context.Context, mgr FeedsManager) error GetChainConfig(id int64) (*ChainConfig, error) CreateChainConfig(ctx context.Context, cfg ChainConfig) (int64, error) DeleteChainConfig(ctx context.Context, id int64) (int64, error) ListChainConfigsByManagerIDs(mgrIDs []int64) ([]ChainConfig, error) UpdateChainConfig(ctx context.Context, cfg ChainConfig) (int64, error) ProposeJob(ctx context.Context, args *ProposeJobArgs) (int64, error) SyncNodeInfo(ctx context.Context, id int64) error IsJobManaged(ctx context.Context, jobID int64) (bool, error) GetJobProposal(id int64) (*JobProposal, error) ListJobProposalsByManagersIDs(ids []int64) ([]JobProposal, error) ListJobProposals() ([]JobProposal, error) CountJobProposalsByStatus() (*JobProposalCounts, 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 ¶ added in v1.2.0
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" )