Documentation
¶
Overview ¶
Package match provides matching presets and utils for selecting devstack components.
Matchers can be composed, e.g.: - `And(OpGeth, WithLabel("name", "alice"))` to select the op-geth node named "alice". - `Or(OpGeth, OpReth)` to select an op-geth or op-reth node. - `Not(OpGeth)` to select anything but an op-geth node.
Custom matchers can also be implemented: - MatchFn can filter a list of elements down to just the matched elements - MatchElemFn can filter by checking each individual element
For convenience, aliases for common matchers are also provided, e.g. for matching "chain A", or matching the first L2 EL node.
Index ¶
- Constants
- Variables
- func And[I comparable, E stack.Identifiable[I]](matchers ...stack.Matcher[I, E]) stack.Matcher[I, E]
- func Assume[I comparable, E stack.Identifiable[I]](t devtest.T, inner stack.Matcher[I, E]) stack.Matcher[I, E]
- func ByIndex[I comparable, E stack.Identifiable[I]](index int) stack.Matcher[I, E]
- func EngineFor(cl stack.L2CLNode) stack.Matcher[stack.L2ELNodeID, stack.L2ELNode]
- func First[I comparable, E stack.Identifiable[I]]() stack.Matcher[I, E]
- func L2ChainById(id stack.L2NetworkID) stack.Matcher[stack.L2NetworkID, stack.L2Network]
- func Last[I comparable, E stack.Identifiable[I]]() stack.Matcher[I, E]
- func Not[I comparable, E stack.Identifiable[I]](matcher stack.Matcher[I, E]) stack.Matcher[I, E]
- func Only[I comparable, E stack.Identifiable[I]]() stack.Matcher[I, E]
- func Or[I comparable, E stack.Identifiable[I]](matchers ...stack.Matcher[I, E]) stack.Matcher[I, E]
- func Second[I comparable, E stack.Identifiable[I]]() stack.Matcher[I, E]
- func WithEngine(engine stack.L2ELNodeID) stack.Matcher[stack.L2CLNodeID, stack.L2CLNode]
- func WithLabel[I comparable, E interface{ ... }](key, value string) stack.Matcher[I, E]
- func WithSequencerActive(ctx context.Context) stack.Matcher[stack.L2CLNodeID, stack.L2CLNode]
- type MatchElemFn
- type MatchFn
- type Vendor
Constants ¶
const (
LabelVendor = "vendor"
)
Variables ¶
var FirstL1CL = First[stack.L1CLNodeID, stack.L1CLNode]()
var FirstL1EL = First[stack.L1ELNodeID, stack.L1ELNode]()
var FirstL1Network = First[stack.L1NetworkID, stack.L1Network]()
var FirstL2Batcher = First[stack.L2BatcherID, stack.L2Batcher]()
var FirstL2CL = First[stack.L2CLNodeID, stack.L2CLNode]()
var FirstL2Challenger = First[stack.L2ChallengerID, stack.L2Challenger]()
var FirstL2EL = First[stack.L2ELNodeID, stack.L2ELNode]()
var FirstL2Network = First[stack.L2NetworkID, stack.L2Network]()
var FirstL2Proposer = First[stack.L2ProposerID, stack.L2Proposer]()
var FirstSuperchain = First[stack.SuperchainID, stack.Superchain]()
var FirstSupervisor = First[stack.SupervisorID, stack.Supervisor]()
var FirstSyncTester = First[stack.SyncTesterID, stack.SyncTester]()
var FirstTestSequencer = First[stack.TestSequencerID, stack.TestSequencer]()
var L2ChainA = First[stack.L2NetworkID, stack.L2Network]()
L2ChainA is an alias for the first L2 network.
var L2ChainB = Second[stack.L2NetworkID, stack.L2Network]()
L2ChainB is an alias for the second L2 network.
var SecondL2CL = Second[stack.L2CLNodeID, stack.L2CLNode]()
var SecondL2EL = Second[stack.L2ELNodeID, stack.L2ELNode]()
var SecondSupervisor = Second[stack.SupervisorID, stack.Supervisor]()
Functions ¶
func And ¶
func And[I comparable, E stack.Identifiable[I]](matchers ...stack.Matcher[I, E]) stack.Matcher[I, E]
And combines all the matchers, by running them all, narrowing down the set with each application. If none are provided, all inputs are matched.
func Assume ¶
func Assume[I comparable, E stack.Identifiable[I]](t devtest.T, inner stack.Matcher[I, E]) stack.Matcher[I, E]
Assume skips the test if no elements were matched with the inner matcher
func ByIndex ¶
func ByIndex[I comparable, E stack.Identifiable[I]](index int) stack.Matcher[I, E]
ByIndex matches element i (zero-indexed).
func First ¶
func First[I comparable, E stack.Identifiable[I]]() stack.Matcher[I, E]
func L2ChainById ¶ added in v1.13.4
func L2ChainById(id stack.L2NetworkID) stack.Matcher[stack.L2NetworkID, stack.L2Network]
L2ChainById returns a matcher for the L2 network with the given ID.
func Last ¶
func Last[I comparable, E stack.Identifiable[I]]() stack.Matcher[I, E]
Last matches the last element.
func Not ¶
func Not[I comparable, E stack.Identifiable[I]](matcher stack.Matcher[I, E]) stack.Matcher[I, E]
Not matches the elements that do not match the given matcher.
func Only ¶
func Only[I comparable, E stack.Identifiable[I]]() stack.Matcher[I, E]
Only matches the only value. If there are none, or more than one, then no value is matched.
func Or ¶
func Or[I comparable, E stack.Identifiable[I]](matchers ...stack.Matcher[I, E]) stack.Matcher[I, E]
Or returns each of the inputs that have a match with any of the matchers. All inputs are applied to all matchers, even if matched previously.
func Second ¶
func Second[I comparable, E stack.Identifiable[I]]() stack.Matcher[I, E]
func WithEngine ¶
func WithEngine(engine stack.L2ELNodeID) stack.Matcher[stack.L2CLNodeID, stack.L2CLNode]
func WithLabel ¶
func WithLabel[I comparable, E interface { stack.Identifiable[I] Label(key string) string }](key, value string) stack.Matcher[I, E]
func WithSequencerActive ¶ added in v1.13.5
Types ¶
type MatchElemFn ¶
type MatchElemFn[I comparable, E stack.Identifiable[I]] func(elem E) bool
MatchElemFn implements stack.Matcher, checking one element at a time.
func (MatchElemFn[I, E]) Match ¶
func (m MatchElemFn[I, E]) Match(elems []E) (out []E)
func (MatchElemFn[I, E]) String ¶
func (m MatchElemFn[I, E]) String() string
type MatchFn ¶
type MatchFn[I comparable, E stack.Identifiable[I]] func(elems []E) []E
MatchFn implements stack.Matcher, checking all elements at once.