Documentation
¶
Index ¶
Constants ¶
const ( DefaultInputPlugin = "chainsync" DefaultOutputPlugin = "log" )
Variables ¶
This section is empty.
Functions ¶
func SaveAtomic ¶ added in v0.40.0
SaveAtomic encodes data as YAML and writes it durably to path via a unique temporary file + rename.
Reliability guarantees:
- Encoder is explicitly Closed so all buffered bytes are flushed before f.Close.
- syncFull (fsync on Linux/Windows, F_FULLFSYNC on macOS) runs before f.Close so data blocks are durable on physical storage prior to rename. Plain fsync on macOS does NOT provide this; see fsync_darwin.go.
- The parent directory is fsynced after rename so the rename is durable across a crash. Skipped on Windows where directory fsync semantics differ; on filesystems that return ENOTSUP for directory fsync (tmpfs, certain FUSE/SMB configurations) this step is a no-op and the rename's durability is filesystem- dependent.
- The temporary file name is generated by os.CreateTemp (O_EXCL + random suffix), so concurrent callers cannot truncate each other's in-flight tmp file.
- Calls to SaveAtomic with the same destination path are serialized by a per-path sync.Mutex; concurrent calls do not race the rename and no write is silently lost. (Different paths do not contend; symlinks to the same inode are not coalesced.)
SaveAtomic does not accept a context and will block for as long as the underlying syscalls take (potentially forever on a stalled disk). Callers that need cancellation responsiveness must wrap SaveAtomic externally; an in-package SaveAtomicCtx wrapper was considered and rejected because the leaked goroutine could out-of-order-clobber a subsequent successful save.
Types ¶
type ApiConfig ¶
type ApiConfig struct {
ListenAddress string `yaml:"address" envconfig:"API_ADDRESS"`
ListenPort uint `yaml:"port" envconfig:"API_PORT"`
Events ApiEventsConfig `yaml:"events" envconfig:"API_EVENTS"`
}
type ApiEventsConfig ¶ added in v0.38.0
type ApiEventsConfig struct {
BufferSize uint `yaml:"buffer-size" envconfig:"API_EVENTS_BUFFER_SIZE"`
}
type ByronGenesisConfig ¶ added in v0.34.0
type ByronGenesisConfig struct {
EndSlot *uint64 `yaml:"end_slot" envconfig:"BYRON_GENESIS_END_SLOT"`
EpochLength uint64 `yaml:"epoch_length" envconfig:"BYRON_GENESIS_EPOCH_LENGTH"`
ByronSlotsPerEpoch uint64 `yaml:"byron_slots_per_epoch" envconfig:"BYRON_GENESIS_BYRON_SLOTS_PER_EPOCH"`
}
ByronGenesisConfig holds Byron era genesis parameters
type Config ¶
type Config struct {
ByronGenesis ByronGenesisConfig `yaml:"byron_genesis" envconfig:"BYRON_GENESIS"`
Plugin map[string]map[string]map[string]any `yaml:"plugins" ignored:"true"`
ConfigFile string `yaml:"-" ignored:"true"`
Input string `yaml:"input" envconfig:"INPUT"`
Output string `yaml:"output" envconfig:"OUTPUT"`
KupoUrl string `yaml:"kupo_url" envconfig:"KUPO_URL"`
Api ApiConfig `yaml:"api" envconfig:"API"`
Debug DebugConfig `yaml:"debug" envconfig:"DEBUG"`
ShelleyGenesis ShelleyGenesisConfig `yaml:"shelley_genesis" envconfig:"SHELLEY_GENESIS"`
ShelleyTransEpoch int32 `yaml:"shelley_trans_epoch" envconfig:"SHELLEY_TRANS_EPOCH"`
Version bool `yaml:"-" ignored:"true"`
}
func (*Config) BindFlags ¶ added in v0.35.0
BindFlags registers independent CLI storage initialized from standard defaults.
func (*Config) Load ¶
Load replaces c with freshly resolved defaults, YAML, and environment values. A failed load leaves c unchanged. Load is not concurrent with readers of c.
func (*Config) LoadWithFlags ¶ added in v0.42.0
LoadWithFlags applies defaults < YAML < environment < explicit CLI flags. Flag storage is independent of c, so the same FlagSet can be reused on reload.
func (*Config) ResolvePlugins ¶ added in v0.46.0
ResolvePlugins snapshots plugin configuration. The top-level Kupo URL supplies a fallback only when an input's YAML does not explicitly provide kupo-url.
type DebugConfig ¶
type ShelleyGenesisConfig ¶ added in v0.34.0
type ShelleyGenesisConfig struct {
EpochLength uint64 `yaml:"epoch_length" envconfig:"SHELLEY_GENESIS_EPOCH_LENGTH"`
}
ShelleyGenesisConfig holds Shelley era genesis parameters