Documentation ¶
Index ¶
- Constants
- Variables
- func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.LogConfig) *orm
- func NewService(orm ORM, jobORM job.ORM, db *sqlx.DB, jobSpawner job.Spawner, ...) *service
- type Config
- type ConnectOpts
- type ConnectionsManager
- type FeedsManager
- type JobProposal
- 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) CountManagers() (int64, error)
- func (ns NullService) CreateJobProposal(jp *JobProposal) (int64, 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) 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(ms *FeedsManager) (int64, error)
- func (ns NullService) RejectSpec(ctx context.Context, id int64) error
- func (ns NullService) Start() error
- func (ns NullService) SyncNodeInfo(id int64) error
- func (ns NullService) Unsafe_SetConnectionsManager(_ ConnectionsManager)
- 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 ORM
- type ProposeJobArgs
- type RPCHandlers
- type Service
- type SpecStatus
Constants ¶
const ( JobTypeFluxMonitor = "fluxmonitor" JobTypeOffchainReporting = "ocr" JobTypeOffchainReporting2 = "ocr2" )
We only support OCR and FM for the feeds manager
Variables ¶
var ( ErrOCRDisabled = errors.New("ocr is disabled") ErrSingleFeedsManager = errors.New("only a single feeds manager is supported") ErrBootstrapXorJobs = errors.New("feeds manager cannot be bootstrap while having assigned job types") ErrJobAlreadyExists = errors.New("a job for this contract address already exists - please use the 'force' option to replace it") )
Functions ¶
Types ¶
type Config ¶ added in v0.10.10
type Config interface { 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
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 Status JobProposalStatus // ExternalJobID is the external job id in the spec. ExternalJobID uuid.NullUUID 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 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 spec version for a job proposal
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) 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) 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) 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(ms *FeedsManager) (int64, error)
func (NullService) RejectSpec ¶ added in v1.2.0
func (ns NullService) RejectSpec(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) 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 ORM ¶
type ORM interface { CountManagers() (int64, error) CreateManager(ms *FeedsManager) (int64, error) GetManager(id int64) (*FeedsManager, error) ListManagers() (mgrs []FeedsManager, err error) ListManagersByIDs(ids []int64) ([]FeedsManager, error) UpdateManager(mgr FeedsManager, qopts ...pg.QOpt) error CreateJobProposal(jp *JobProposal) (int64, error) CountJobProposals() (int64, 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) 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 Service ¶
type Service interface { Start() error Close() error CountManagers() (int64, error) GetManager(id int64) (*FeedsManager, error) ListManagersByIDs(ids []int64) ([]FeedsManager, error) ListManagers() ([]FeedsManager, error) RegisterManager(ms *FeedsManager) (int64, error) UpdateManager(ctx context.Context, mgr FeedsManager) error ProposeJob(ctx context.Context, args *ProposeJobArgs) (int64, error) SyncNodeInfo(id int64) error IsJobManaged(ctx context.Context, jobID int64) (bool, error) GetJobProposal(id int64) (*JobProposal, error) ListJobProposalsByManagersIDs(ids []int64) ([]JobProposal, error) ListJobProposals() ([]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 ¶ 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" )