{"modulePath":"github.com/GoCodeAlone/workflow-plugin-audit-chain","version":"v0.2.6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package modules\n\nPackage modules provides workflow modular.Module implementations for the audit-chain plugin.  Each module type wires a layer from the chain/ and providers/ packages into the workflow engine's dependency-injection system.\n\nThe package exposes package-level registries (ledger and anchor-provider) so that step implementations can look up the handles they need without coupling to specific module instances.\n\n## Functions\n\n```go\nfunc AnchorProviderNames() []string\n```\nAnchorProviderNames returns a snapshot of all currently registered anchor provider names. Used by step.audit.anchor when providers = \\[] (all configured).\n\n```go\nfunc GetAnchorProvider(instanceName string) (providers.AnchorProvider, bool)\n```\nGetAnchorProvider looks up an AnchorProvider by instance name.\n\n```go\nfunc GetDB(partitionName string) (*sql.DB, bool)\n```\nGetDB looks up a \\*sql.DB by ledger partition name.\n\n```go\nfunc GetLedger(partitionName string) (*chain.Appender, bool)\n```\nGetLedger looks up an Appender by ledger partition name.\n\n```go\nfunc NewGitAnchorProviderModule(instanceName string, cfg *auditv1.GitAnchorProviderConfig) (sdk.ModuleInstance, error)\n```\nNewGitAnchorProviderModule creates a ModuleInstance for audit.anchor\\_provider.git from a typed GitAnchorProviderConfig.\n\n```go\nfunc NewLedgerModule(instanceName string, config *auditv1.LedgerConfig) (sdk.ModuleInstance, error)\n```\nNewLedgerModule creates a LedgerModule from a typed LedgerConfig proto. Returns an error if config.Name or config.Dsn is empty.\n\n```go\nfunc NewOpenTimestampsProviderModule(instanceName string, cfg *auditv1.OpenTimestampsProviderConfig) (sdk.ModuleInstance, error)\n```\nNewOpenTimestampsProviderModule creates a ModuleInstance for audit.anchor\\_provider.opentimestamps from a typed OpenTimestampsProviderConfig.\n\n```go\nfunc NewSigstoreProviderModule(instanceName string, cfg *auditv1.SigstoreProviderConfig) (sdk.ModuleInstance, error)\n```\nNewSigstoreProviderModule creates a ModuleInstance for audit.anchor\\_provider.sigstore from a typed SigstoreProviderConfig.\n\n```go\nfunc RegisterAnchorProvider(instanceName string, p providers.AnchorProvider)\n```\nRegisterAnchorProvider registers an AnchorProvider under the given instance name.\n\n```go\nfunc RegisterDB(partitionName string, db *sql.DB)\n```\nRegisterDB stores a \\*sql.DB under the given ledger partition name.\n\n```go\nfunc RegisterLedger(partitionName string, a *chain.Appender)\n```\nRegisterLedger registers an Appender in the global ledger registry under the given partition name.\n\n```go\nfunc UnregisterAnchorProvider(instanceName string)\n```\nUnregisterAnchorProvider removes a provider from the registry (called on Stop and in tests).\n\n```go\nfunc UnregisterDB(partitionName string)\n```\nUnregisterDB removes a DB from the registry (called on Stop and in tests).\n\n```go\nfunc UnregisterLedger(partitionName string)\n```\nUnregisterLedger removes a ledger Appender from the registry (called on Stop and in tests).\n\n## Types\n\n```go\ntype LedgerModule struct {\n\t// contains filtered or unexported fields\n}\n```\nLedgerModule implements sdk.ModuleInstance for the audit.ledger module type. It opens a Postgres connection, creates a chain.Appender, and registers it in the global ledger registry under LedgerConfig.Name (the partition key).\n\n```go\nfunc (m *LedgerModule) Init() error\n```\nInit opens the Postgres connection and registers the Appender. sql.Open is lazy: the connection string is validated at parse time but no network call is made until the first query. This keeps Init fast and allows unit tests to run without a real Postgres instance. Returns an error if called more than once to prevent connection pool leaks.\n\n```go\nfunc (m *LedgerModule) Start(_ context.Context) error\n```\nStart is a no-op for the ledger module.\n\n```go\nfunc (m *LedgerModule) Stop(_ context.Context) error\n```\nStop unregisters the ledger and DB, then closes the underlying DB connection.\n\n","path":"github.com/GoCodeAlone/workflow-plugin-audit-chain/modules","name":"modules","synopsis":"Package modules provides workflow modular.Module implementations for the audit-chain plugin.","isRedistributable":true}
