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, version uint64) error
- func (oc *OpConductor) AddServerAsVoter(_ context.Context, id string, addr string, version uint64) error
- func (oc *OpConductor) ClusterMembership(_ context.Context) (*consensus.ClusterMembership, error)
- func (oc *OpConductor) CommitUnsafePayload(_ context.Context, payload *eth.ExecutionPayloadEnvelope) error
- func (oc *OpConductor) ConsensusEndpoint() string
- func (oc *OpConductor) HTTPEndpoint() string
- func (oc *OpConductor) LatestUnsafePayload(_ context.Context) (*eth.ExecutionPayloadEnvelope, error)
- func (oc *OpConductor) Leader(ctx context.Context) bool
- func (oc *OpConductor) LeaderOverridden() bool
- func (oc *OpConductor) LeaderWithID(ctx context.Context) *consensus.ServerInfo
- func (oc *OpConductor) OverrideLeader(override bool)
- func (oc *OpConductor) Pause(ctx context.Context) error
- func (oc *OpConductor) Paused() bool
- func (oc *OpConductor) RemoveServer(_ context.Context, id string, version uint64) 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 ¶
Functions ¶
Types ¶
type Config ¶
type Config struct { // ConsensusAddr is the address, excluding port, to listen on for consensus connections. // E.g. 0.0.0.0 to bind to the external-facing network interface. ConsensusAddr string // ConsensusPort is the port to listen on for consensus connections. // If 0, the server binds to a port selected by the system. ConsensusPort int // ConsensusAdvertisedAddr is the network address, including port, to advertise to other peers. // This is optional: if empty, the address that the server network transport binds to is used instead. // E.g. local tests may use temporary addresses, rather than preset known addresses. ConsensusAdvertisedAddr string // 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 // RaftSnapshotInterval is the interval to check if a snapshot should be taken. RaftSnapshotInterval time.Duration // RaftSnapshotThreshold is the number of logs to trigger a snapshot. RaftSnapshotThreshold uint64 // RaftTrailingLogs is the number of logs to keep after a snapshot. RaftTrailingLogs uint64 // 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 ¶ added in v1.4.3
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 // SafeEnabled is whether to enable safe head progression checks. SafeEnabled bool // 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 ¶ added in v1.4.3
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 ¶ added in v1.4.3
func NewOpConductor( ctx context.Context, cfg *Config, log log.Logger, m metrics.Metricer, version string, ctrl client.SequencerControl, cons consensus.Consensus, hmon health.HealthMonitor, ) (*OpConductor, error)
NewOpConductor creates a new OpConductor instance.
func (*OpConductor) AddServerAsNonvoter ¶ added in v1.5.0
func (oc *OpConductor) AddServerAsNonvoter(_ context.Context, id string, addr string, version uint64) error
AddServerAsNonvoter adds a server as a non-voter to the cluster. non-voter will not participate in leader election.
func (*OpConductor) AddServerAsVoter ¶ added in v1.5.0
func (oc *OpConductor) AddServerAsVoter(_ context.Context, id string, addr string, version uint64) error
AddServerAsVoter adds a server as a voter to the cluster.
func (*OpConductor) ClusterMembership ¶ added in v1.7.0
func (oc *OpConductor) ClusterMembership(_ context.Context) (*consensus.ClusterMembership, error)
ClusterMembership returns current cluster's membership information.
func (*OpConductor) CommitUnsafePayload ¶ added in v1.5.0
func (oc *OpConductor) CommitUnsafePayload(_ context.Context, payload *eth.ExecutionPayloadEnvelope) error
CommitUnsafePayload commits an unsafe payload (latest head) to the cluster FSM ensuring strong consistency by leveraging Raft consensus mechanisms.
func (*OpConductor) ConsensusEndpoint ¶ added in v1.9.5
func (oc *OpConductor) ConsensusEndpoint() string
ConsensusEndpoint returns the raft consensus server address to connect to.
func (*OpConductor) HTTPEndpoint ¶ added in v1.5.0
func (oc *OpConductor) HTTPEndpoint() string
HTTPEndpoint returns the HTTP RPC endpoint
func (*OpConductor) LatestUnsafePayload ¶ added in v1.7.0
func (oc *OpConductor) LatestUnsafePayload(_ context.Context) (*eth.ExecutionPayloadEnvelope, error)
LatestUnsafePayload returns the latest unsafe payload envelope from FSM in a strongly consistent fashion.
func (*OpConductor) Leader ¶ added in v1.5.0
func (oc *OpConductor) Leader(ctx context.Context) bool
Leader returns true if OpConductor is the leader.
func (*OpConductor) LeaderOverridden ¶ added in v1.9.5
func (oc *OpConductor) LeaderOverridden() bool
func (*OpConductor) LeaderWithID ¶ added in v1.5.0
func (oc *OpConductor) LeaderWithID(ctx context.Context) *consensus.ServerInfo
LeaderWithID returns the current leader's server ID and address.
func (*OpConductor) OverrideLeader ¶ added in v1.9.5
func (oc *OpConductor) OverrideLeader(override bool)
func (*OpConductor) Pause ¶ added in v1.4.3
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 ¶ added in v1.4.3
func (oc *OpConductor) Paused() bool
Paused returns true if OpConductor is paused.
func (*OpConductor) RemoveServer ¶ added in v1.5.0
RemoveServer removes a server from the cluster.
func (*OpConductor) Resume ¶ added in v1.4.3
func (oc *OpConductor) Resume(ctx context.Context) error
Resume resumes the control loop of OpConductor.
func (*OpConductor) SequencerHealthy ¶ added in v1.5.0
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 ¶ added in v1.5.0
func (oc *OpConductor) TransferLeader(_ context.Context) error
TransferLeader transfers leadership to another server.
func (*OpConductor) TransferLeaderToServer ¶ added in v1.5.0
TransferLeaderToServer transfers leadership to a specific server.