modules

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package 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.

The 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnchorProviderNames

func AnchorProviderNames() []string

AnchorProviderNames returns a snapshot of all currently registered anchor provider names. Used by step.audit.anchor when providers = [] (all configured).

func GetAnchorProvider

func GetAnchorProvider(instanceName string) (providers.AnchorProvider, bool)

GetAnchorProvider looks up an AnchorProvider by instance name.

func GetDB

func GetDB(partitionName string) (*sql.DB, bool)

GetDB looks up a *sql.DB by ledger partition name.

func GetLedger

func GetLedger(partitionName string) (*chain.Appender, bool)

GetLedger looks up an Appender by ledger partition name.

func NewGitAnchorProviderModule

func NewGitAnchorProviderModule(instanceName string, cfg *auditv1.GitAnchorProviderConfig) (sdk.ModuleInstance, error)

NewGitAnchorProviderModule creates a ModuleInstance for audit.anchor_provider.git from a typed GitAnchorProviderConfig.

func NewLedgerModule

func NewLedgerModule(instanceName string, config *auditv1.LedgerConfig) (sdk.ModuleInstance, error)

NewLedgerModule creates a LedgerModule from a typed LedgerConfig proto. Returns an error if config.Name or config.Dsn is empty.

func NewOpenTimestampsProviderModule

func NewOpenTimestampsProviderModule(instanceName string, cfg *auditv1.OpenTimestampsProviderConfig) (sdk.ModuleInstance, error)

NewOpenTimestampsProviderModule creates a ModuleInstance for audit.anchor_provider.opentimestamps from a typed OpenTimestampsProviderConfig.

func NewSigstoreProviderModule

func NewSigstoreProviderModule(instanceName string, cfg *auditv1.SigstoreProviderConfig) (sdk.ModuleInstance, error)

NewSigstoreProviderModule creates a ModuleInstance for audit.anchor_provider.sigstore from a typed SigstoreProviderConfig.

func RegisterAnchorProvider

func RegisterAnchorProvider(instanceName string, p providers.AnchorProvider)

RegisterAnchorProvider registers an AnchorProvider under the given instance name.

func RegisterDB

func RegisterDB(partitionName string, db *sql.DB)

RegisterDB stores a *sql.DB under the given ledger partition name.

func RegisterLedger

func RegisterLedger(partitionName string, a *chain.Appender)

RegisterLedger registers an Appender in the global ledger registry under the given partition name.

func UnregisterAnchorProvider

func UnregisterAnchorProvider(instanceName string)

UnregisterAnchorProvider removes a provider from the registry (called on Stop and in tests).

func UnregisterDB

func UnregisterDB(partitionName string)

UnregisterDB removes a DB from the registry (called on Stop and in tests).

func UnregisterLedger

func UnregisterLedger(partitionName string)

UnregisterLedger removes a ledger Appender from the registry (called on Stop and in tests).

Types

type LedgerModule

type LedgerModule struct {
	// contains filtered or unexported fields
}

LedgerModule 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).

func (*LedgerModule) Init

func (m *LedgerModule) Init() error

Init 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.

func (*LedgerModule) Start

func (m *LedgerModule) Start(_ context.Context) error

Start is a no-op for the ledger module.

func (*LedgerModule) Stop

func (m *LedgerModule) Stop(_ context.Context) error

Stop unregisters the ledger and DB, then closes the underlying DB connection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL