Documentation ¶
Index ¶
- Variables
- func NewState(leader, healthy, active bool) *state
- type Config
- type HealthCheckConfig
- type OpConductor
- func (oc *OpConductor) AddServerAsNonvoter(_ context.Context, id string, addr string) error
- func (oc *OpConductor) AddServerAsVoter(_ context.Context, id string, addr string) error
- func (oc *OpConductor) ClusterMembership(_ context.Context) ([]*consensus.ServerInfo, error)
- func (oc *OpConductor) CommitUnsafePayload(_ context.Context, payload *eth.ExecutionPayloadEnvelope) error
- func (oc *OpConductor) HTTPEndpoint() string
- func (oc *OpConductor) LatestUnsafePayload(_ context.Context) *eth.ExecutionPayloadEnvelope
- func (oc *OpConductor) Leader(_ context.Context) bool
- func (oc *OpConductor) LeaderWithID(_ context.Context) *consensus.ServerInfo
- func (oc *OpConductor) Pause(ctx context.Context) error
- func (oc *OpConductor) Paused() bool
- func (oc *OpConductor) RemoveServer(_ context.Context, id string) error
- func (oc *OpConductor) Resume(ctx context.Context) error
- func (oc *OpConductor) SequencerHealthy(_ context.Context) bool
- func (oc *OpConductor) Start(ctx context.Context) error
- func (oc *OpConductor) Stop(ctx context.Context) error
- func (oc *OpConductor) Stopped() bool
- func (oc *OpConductor) TransferLeader(_ context.Context) error
- func (oc *OpConductor) TransferLeaderToServer(_ context.Context, id string, addr string) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrResumeTimeout = errors.New("timeout to resume conductor") ErrPauseTimeout = errors.New("timeout to pause conductor") ErrUnsafeHeadMismarch = errors.New("unsafe head mismatch") ErrUnableToRetrieveUnsafeHeadFromConsensus = errors.New("unable to retrieve unsafe head from consensus") )
Functions ¶
Types ¶
type Config ¶
type Config struct { // ConsensusAddr is the address to listen for consensus connections. ConsensusAddr string // ConsensusPort is the port to listen for consensus connections. ConsensusPort int // RaftServerID is the unique ID for this server used by raft consensus. RaftServerID string // RaftStorageDir is the directory to store raft data. RaftStorageDir string // RaftBootstrap is true if this node should bootstrap a new raft cluster. RaftBootstrap bool // NodeRPC is the HTTP provider URL for op-node. NodeRPC string // ExecutionRPC is the HTTP provider URL for execution layer. ExecutionRPC string // Paused is true if the conductor should start in a paused state. Paused bool // HealthCheck is the health check configuration. HealthCheck HealthCheckConfig // RollupCfg is the rollup config. RollupCfg rollup.Config // RPCEnableProxy is true if the sequencer RPC proxy should be enabled. RPCEnableProxy bool LogConfig oplog.CLIConfig MetricsConfig opmetrics.CLIConfig PprofConfig oppprof.CLIConfig RPC oprpc.CLIConfig }
type HealthCheckConfig ¶
type HealthCheckConfig struct { // Interval is the interval (in seconds) to check the health of the sequencer. Interval uint64 // UnsafeInterval is the interval allowed between unsafe head and now in seconds. UnsafeInterval uint64 // SafeInterval is the interval between safe head progression measured in seconds. SafeInterval uint64 // MinPeerCount is the minimum number of peers required for the sequencer to be healthy. MinPeerCount uint64 }
HealthCheckConfig defines health check configuration.
func (*HealthCheckConfig) Check ¶
func (c *HealthCheckConfig) Check() error
type OpConductor ¶
type OpConductor struct {
// contains filtered or unexported fields
}
OpConductor represents a full conductor instance and its resources, it does:
- performs health checks on sequencer
- participate in consensus protocol for leader election
- and control sequencer state based on leader, sequencer health and sequencer active status.
OpConductor has three states:
- running: it is running normally, which executes control loop and participates in leader election.
- paused: control loop (sequencer start/stop) is paused, but it still participates in leader election, and receives health updates.
- stopped: it is stopped, which means it is not participating in leader election and control loop. OpConductor cannot be started again from stopped mode.
func NewOpConductor ¶
func NewOpConductor( ctx context.Context, cfg *Config, log log.Logger, version string, ctrl client.SequencerControl, cons consensus.Consensus, hmon health.HealthMonitor, ) (*OpConductor, error)
NewOpConductor creates a new OpConductor instance.
func (*OpConductor) AddServerAsNonvoter ¶
AddServerAsNonvoter adds a server as a non-voter to the cluster. non-voter will not participate in leader election.
func (*OpConductor) AddServerAsVoter ¶
AddServerAsVoter adds a server as a voter to the cluster.
func (*OpConductor) ClusterMembership ¶
func (oc *OpConductor) ClusterMembership(_ context.Context) ([]*consensus.ServerInfo, error)
ClusterMembership returns current cluster's membership information.
func (*OpConductor) CommitUnsafePayload ¶
func (oc *OpConductor) CommitUnsafePayload(_ context.Context, payload *eth.ExecutionPayloadEnvelope) error
CommitUnsafePayload commits a unsafe payload (latest head) to the cluster FSM.
func (*OpConductor) HTTPEndpoint ¶
func (oc *OpConductor) HTTPEndpoint() string
func (*OpConductor) LatestUnsafePayload ¶
func (oc *OpConductor) LatestUnsafePayload(_ context.Context) *eth.ExecutionPayloadEnvelope
LatestUnsafePayload returns the latest unsafe payload envelope from FSM.
func (*OpConductor) Leader ¶
func (oc *OpConductor) Leader(_ context.Context) bool
Leader returns true if OpConductor is the leader.
func (*OpConductor) LeaderWithID ¶
func (oc *OpConductor) LeaderWithID(_ context.Context) *consensus.ServerInfo
LeaderWithID returns the current leader's server ID and address.
func (*OpConductor) Pause ¶
func (oc *OpConductor) Pause(ctx context.Context) error
Pause pauses the control loop of OpConductor, but still allows it to participate in leader election.
func (*OpConductor) Paused ¶
func (oc *OpConductor) Paused() bool
Paused returns true if OpConductor is paused.
func (*OpConductor) RemoveServer ¶
func (oc *OpConductor) RemoveServer(_ context.Context, id string) error
RemoveServer removes a server from the cluster.
func (*OpConductor) Resume ¶
func (oc *OpConductor) Resume(ctx context.Context) error
Resume resumes the control loop of OpConductor.
func (*OpConductor) SequencerHealthy ¶
func (oc *OpConductor) SequencerHealthy(_ context.Context) bool
SequencerHealthy returns true if sequencer is healthy.
func (*OpConductor) Start ¶
func (oc *OpConductor) Start(ctx context.Context) error
Start implements cliapp.Lifecycle.
func (*OpConductor) Stop ¶
func (oc *OpConductor) Stop(ctx context.Context) error
Stop implements cliapp.Lifecycle.
func (*OpConductor) Stopped ¶
func (oc *OpConductor) Stopped() bool
Stopped implements cliapp.Lifecycle.
func (*OpConductor) TransferLeader ¶
func (oc *OpConductor) TransferLeader(_ context.Context) error
TransferLeader transfers leadership to another server.
func (*OpConductor) TransferLeaderToServer ¶
TransferLeaderToServer transfers leadership to a specific server.