Skip to content

Commit

Permalink
Reduce the number of automation types needed in common
Browse files Browse the repository at this point in the history
  • Loading branch information
ferglor committed Jan 12, 2024
1 parent 1755c71 commit 306f99b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 74 deletions.
16 changes: 0 additions & 16 deletions pkg/types/automation/basetypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ func init() {
checkResultStringTemplate = strings.Replace(checkResultStringTemplate, "\n", "", -1)
}

type UpkeepType uint8

const (
// Exploratory AUTO 4335: add type for unknown
ConditionTrigger UpkeepType = iota
LogTrigger
)

type TransmitEventType int

const (
Expand Down Expand Up @@ -339,11 +331,3 @@ type ReportedUpkeep struct {
// WorkID represents the unit of work for the reported upkeep
WorkID string
}

// RetryRecord is a record of a payload that can be retried after a certain interval.
type RetryRecord struct {
// payload is the desired unit of work to be retried
Payload UpkeepPayload
// Interval is the time interval after which the same payload can be retried.
Interval time.Duration
}
58 changes: 0 additions & 58 deletions pkg/types/automation/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/services"
)

type UpkeepTypeGetter func(UpkeepIdentifier) UpkeepType
type WorkIDGenerator func(UpkeepIdentifier, Trigger) string

// UpkeepStateStore is the interface for managing upkeeps final state in a local store.
type UpkeepStateStore interface {
UpkeepStateUpdater
Expand Down Expand Up @@ -59,10 +56,6 @@ type RecoverableProvider interface {
GetRecoveryProposals(context.Context) ([]UpkeepPayload, error)
}

type TransmitEventProvider interface {
GetLatestEvents(context.Context) ([]TransmitEvent, error)
}

type ConditionalUpkeepProvider interface {
GetActiveUpkeeps(context.Context) ([]UpkeepPayload, error)
}
Expand All @@ -72,11 +65,6 @@ type PayloadBuilder interface {
BuildPayloads(context.Context, ...CoordinatedBlockProposal) ([]UpkeepPayload, error)
}

type Runnable interface {
// Can get results for a subset of payloads along with an error
CheckUpkeeps(context.Context, ...UpkeepPayload) ([]CheckResult, error)
}

type BlockSubscriber interface {
// Subscribe provides an identifier integer, a new channel, and potentially an error
Subscribe() (int, chan BlockHistory, error)
Expand All @@ -89,49 +77,3 @@ type BlockSubscriber interface {
type UpkeepStateUpdater interface {
SetUpkeepState(context.Context, CheckResult, UpkeepState) error
}

type RetryQueue interface {
// Enqueue adds new items to the queue
Enqueue(items ...RetryRecord) error
// Dequeue returns the next n items in the queue, considering retry time schedules
Dequeue(n int) ([]UpkeepPayload, error)
}

type ProposalQueue interface {
// Enqueue adds new items to the queue
Enqueue(items ...CoordinatedBlockProposal) error
// Dequeue returns the next n items in the queue, considering retry time schedules
Dequeue(t UpkeepType, n int) ([]CoordinatedBlockProposal, error)
}

type ResultStore interface {
Add(...CheckResult)
Remove(...string)
View() ([]CheckResult, error)
}

type Coordinator interface {
PreProcess(_ context.Context, payloads []UpkeepPayload) ([]UpkeepPayload, error)

Accept(ReportedUpkeep) bool
ShouldTransmit(ReportedUpkeep) bool
FilterResults([]CheckResult) ([]CheckResult, error)
FilterProposals([]CoordinatedBlockProposal) ([]CoordinatedBlockProposal, error)
}

type MetadataStore interface {
SetBlockHistory(BlockHistory)
GetBlockHistory() BlockHistory

AddProposals(proposals ...CoordinatedBlockProposal)
ViewProposals(utype UpkeepType) []CoordinatedBlockProposal
RemoveProposals(proposals ...CoordinatedBlockProposal)

Start(context.Context) error
Close() error
}

type Ratio interface {
// OfInt should return n out of x such that n/x ~ r (ratio)
OfInt(int) int
}

0 comments on commit 306f99b

Please sign in to comment.