Documentation
¶
Index ¶
- Variables
- func EnsureDefaultConfig(homeDir string) error
- func MarkReadyHandler() engine.TaskHandler
- func ReadPeersFile(homeDir string) ([]string, error)
- func SignalSeid(sig syscall.Signal) error
- func UpdatePeersHandler(homeDir string) engine.TaskHandler
- type ConfigPatcher
- type EC2ClientFactory
- type EC2DescribeAPI
- type EC2TagsSource
- type GenesisFetcher
- type GenesisS3Config
- type HTTPDoer
- type NodeIDQuerier
- type PatchSet
- type PeerDiscoverer
- type PeerSource
- type S3ClientFactory
- type S3GetObjectAPI
- type S3Uploader
- type S3UploaderFactory
- type SnapshotConfig
- type SnapshotGenerationPatch
- type SnapshotRestorer
- type SnapshotUploadConfig
- type SnapshotUploader
- type StateSyncConfig
- type StateSyncConfigurer
- type StaticSource
Constants ¶
This section is empty.
Variables ¶
var SignalSeidFn = SignalSeid
SignalSeidFn is the function used to signal the seid process. Replaceable for testing.
Functions ¶
func EnsureDefaultConfig ¶
EnsureDefaultConfig creates the seid home directory structure and writes a minimal default config.toml if one does not already exist. The default is embedded from defaults/config.toml.
func MarkReadyHandler ¶
func MarkReadyHandler() engine.TaskHandler
MarkReadyHandler returns a no-op TaskHandler. When it succeeds, the engine marks itself as ready.
func ReadPeersFile ¶
ReadPeersFile reads the peer list written by discover-peers.
func SignalSeid ¶
SignalSeid finds the seid process in the shared PID namespace and sends the specified signal. With shareProcessNamespace: true, /proc is shared across all containers in the pod.
func UpdatePeersHandler ¶
func UpdatePeersHandler(homeDir string) engine.TaskHandler
UpdatePeersHandler returns a TaskHandler that patches persistent_peers in config.toml and sends SIGHUP to seid to trigger a config reload.
Types ¶
type ConfigPatcher ¶
type ConfigPatcher struct {
// contains filtered or unexported fields
}
ConfigPatcher applies TOML patches to seid configuration files.
func NewConfigPatcher ¶
func NewConfigPatcher(homeDir string) *ConfigPatcher
NewConfigPatcher creates a patcher targeting the given home directory.
func (*ConfigPatcher) Handler ¶
func (p *ConfigPatcher) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler that adapts map[string]any params to a typed PatchSet and delegates to PatchConfig.
func (*ConfigPatcher) PatchConfig ¶
func (p *ConfigPatcher) PatchConfig(_ context.Context, ps PatchSet) error
PatchConfig reads config.toml (and app.toml when snapshot generation is configured), applies the patch set, and writes atomically. If no peers are in the patch set, it reads from the peers file written by discover-peers (if it exists).
type EC2ClientFactory ¶
type EC2ClientFactory func(ctx context.Context, region string) (EC2DescribeAPI, error)
EC2ClientFactory builds an EC2 client for a given region.
type EC2DescribeAPI ¶
type EC2DescribeAPI interface {
DescribeInstances(ctx context.Context, params *ec2.DescribeInstancesInput, optFns ...func(*ec2.Options)) (*ec2.DescribeInstancesOutput, error)
}
EC2DescribeAPI abstracts the EC2 DescribeInstances call for testing.
func DefaultEC2ClientFactory ¶
func DefaultEC2ClientFactory(ctx context.Context, region string) (EC2DescribeAPI, error)
DefaultEC2ClientFactory creates a real EC2 client using Pod Identity credentials.
type EC2TagsSource ¶
type EC2TagsSource struct {
Region string
Tags map[string]string
EC2Factory EC2ClientFactory
QueryNodeID NodeIDQuerier
}
EC2TagsSource discovers peers by querying EC2 for running instances matching the configured tags.
type GenesisFetcher ¶
type GenesisFetcher struct {
// contains filtered or unexported fields
}
GenesisFetcher downloads genesis.json from S3 and writes it to the config directory.
func NewGenesisFetcher ¶
func NewGenesisFetcher(homeDir string, factory S3ClientFactory) *GenesisFetcher
NewGenesisFetcher creates a fetcher targeting the given home directory.
func (*GenesisFetcher) Fetch ¶
func (g *GenesisFetcher) Fetch(ctx context.Context, cfg GenesisS3Config) error
Fetch downloads genesis.json from S3, skipping if the marker file exists.
func (*GenesisFetcher) Handler ¶
func (g *GenesisFetcher) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler that parses params and delegates to Fetch.
type GenesisS3Config ¶
GenesisS3Config holds S3 coordinates for genesis.json download.
type NodeIDQuerier ¶
NodeIDQuerier fetches a Tendermint node ID from an IP address.
type PatchSet ¶
type PatchSet struct {
Peers []string
NodeMode string
// SnapshotGeneration, when non-nil, configures app.toml for archival
// pruning and periodic Tendermint state-sync snapshot production.
SnapshotGeneration *SnapshotGenerationPatch
}
PatchSet describes the TOML patches to apply to config.toml and app.toml.
type PeerDiscoverer ¶
type PeerDiscoverer struct {
// contains filtered or unexported fields
}
PeerDiscoverer resolves peers from multiple sources and writes them to a file.
func NewPeerDiscoverer ¶
func NewPeerDiscoverer(homeDir string, ec2Factory EC2ClientFactory, nodeIDQuerier NodeIDQuerier) *PeerDiscoverer
NewPeerDiscoverer creates a discoverer targeting the given home directory.
func (*PeerDiscoverer) Discover ¶
Discover queries EC2 for running instances tagged with the given chain ID. Deprecated: Use EC2TagsSource directly or the sources-based Handler.
func (*PeerDiscoverer) Handler ¶
func (d *PeerDiscoverer) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler that parses peer source params and dispatches to the appropriate PeerSource implementations.
Supports two param formats:
- New: {"sources": [{"type": "ec2Tags", "region": "...", "tags": {...}}, ...]}
- Legacy: {"region": "...", "chainId": "..."} (backward compat)
type PeerSource ¶
PeerSource discovers peers from a specific source type.
type S3ClientFactory ¶
type S3ClientFactory func(ctx context.Context, region string) (S3GetObjectAPI, error)
S3ClientFactory builds an S3 client for a given region. Replaceable for testing.
type S3GetObjectAPI ¶
type S3GetObjectAPI interface {
GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
}
S3GetObjectAPI abstracts the S3 GetObject call for testing.
func DefaultS3ClientFactory ¶
func DefaultS3ClientFactory(ctx context.Context, region string) (S3GetObjectAPI, error)
DefaultS3ClientFactory creates a real S3 client using IRSA credentials.
type S3Uploader ¶
type S3Uploader interface {
UploadObject(ctx context.Context, input *transfermanager.UploadObjectInput, opts ...func(*transfermanager.Options)) (*transfermanager.UploadObjectOutput, error)
}
S3Uploader abstracts the transfermanager upload call for testing.
func DefaultS3UploaderFactory ¶
func DefaultS3UploaderFactory(ctx context.Context, region string) (S3Uploader, error)
DefaultS3UploaderFactory creates a transfermanager.Client backed by a real S3 client.
type S3UploaderFactory ¶
type S3UploaderFactory func(ctx context.Context, region string) (S3Uploader, error)
S3UploaderFactory builds an S3Uploader for a given region.
type SnapshotConfig ¶
SnapshotConfig holds S3 coordinates for snapshot download.
type SnapshotGenerationPatch ¶
SnapshotGenerationPatch holds the app.toml values needed to produce Tendermint state-sync snapshots.
type SnapshotRestorer ¶
type SnapshotRestorer struct {
// contains filtered or unexported fields
}
SnapshotRestorer downloads and extracts a snapshot archive from S3.
func NewSnapshotRestorer ¶
func NewSnapshotRestorer(homeDir string, factory S3ClientFactory) *SnapshotRestorer
NewSnapshotRestorer creates a restorer targeting the given home directory.
func (*SnapshotRestorer) Handler ¶
func (r *SnapshotRestorer) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler that adapts the map[string]any params to a typed SnapshotConfig and delegates to Restore.
func (*SnapshotRestorer) Restore ¶
func (r *SnapshotRestorer) Restore(ctx context.Context, cfg SnapshotConfig) error
Restore downloads and extracts the snapshot, skipping if the marker file exists. It reads latest.txt from the prefix to resolve the current snapshot object key.
type SnapshotUploadConfig ¶
SnapshotUploadConfig holds the parameters for the snapshot upload task.
type SnapshotUploader ¶
type SnapshotUploader struct {
// contains filtered or unexported fields
}
SnapshotUploader scans for locally produced Tendermint state-sync snapshots and uploads new ones to S3.
func NewSnapshotUploader ¶
func NewSnapshotUploader(homeDir string, factory S3UploaderFactory) *SnapshotUploader
NewSnapshotUploader creates an uploader targeting the given home directory.
func (*SnapshotUploader) Handler ¶
func (u *SnapshotUploader) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler for the snapshot-upload task.
func (*SnapshotUploader) Upload ¶
func (u *SnapshotUploader) Upload(ctx context.Context, cfg SnapshotUploadConfig) error
Upload finds the latest complete snapshot, archives it, and streams it to S3. It picks the second-to-latest snapshot height to avoid uploading an in-progress snapshot. If the snapshot has already been uploaded (tracked via a local state file), it no-ops.
The archive is streamed through an io.Pipe so it never needs to be buffered entirely in memory; the transfermanager handles multipart upload automatically.
type StateSyncConfig ¶
type StateSyncConfig struct {
TrustHeight int64 `json:"trustHeight"`
TrustHash string `json:"trustHash"`
RpcServers string `json:"rpcServers"`
}
StateSyncConfig holds the trust point and RPC servers for Tendermint state sync.
func ReadStateSyncFile ¶
func ReadStateSyncFile(homeDir string) (*StateSyncConfig, error)
ReadStateSyncFile reads the state sync config written by configure-state-sync.
type StateSyncConfigurer ¶
type StateSyncConfigurer struct {
// contains filtered or unexported fields
}
StateSyncConfigurer discovers a trust point from peers and writes the config file.
func NewStateSyncConfigurer ¶
func NewStateSyncConfigurer(homeDir string, client HTTPDoer) *StateSyncConfigurer
NewStateSyncConfigurer creates a configurer targeting the given home directory.
func (*StateSyncConfigurer) Configure ¶
func (s *StateSyncConfigurer) Configure(ctx context.Context) error
Configure reads the peers file, queries a peer for a trust point, and writes the state sync config file.
func (*StateSyncConfigurer) Handler ¶
func (s *StateSyncConfigurer) Handler() engine.TaskHandler
Handler returns an engine.TaskHandler.
type StaticSource ¶
type StaticSource struct {
Addresses []string
}
StaticSource returns a fixed list of peer addresses.