refactor(pipeline): ввести Runner интерфейс
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -9,6 +9,18 @@ import (
|
||||
"git.tswf.io/infra/go-synapse-backupper/pkg/domain/pgdump"
|
||||
)
|
||||
|
||||
// Runner orchestrates the dump → encrypt → sink pipeline.
|
||||
type Runner interface {
|
||||
// Run executes the full backup pipeline: pg_dump → encrypt → sink.
|
||||
Run(
|
||||
ctx context.Context,
|
||||
pgDumpOpts pgdump.Options,
|
||||
recipients []crypto.RecipientPub,
|
||||
sink domain.Sink,
|
||||
rand io.Reader,
|
||||
) error
|
||||
}
|
||||
|
||||
// Option configures a Runner.
|
||||
type Option func(*runner)
|
||||
|
||||
@@ -26,14 +38,14 @@ func WithEncryptor(encryptor crypto.Encryptor) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// Runner orchestrates the dump → encrypt → sink pipeline.
|
||||
// runner is the private implementation of Runner.
|
||||
type runner struct {
|
||||
dumper pgdump.Dumper
|
||||
encryptor crypto.Encryptor
|
||||
}
|
||||
|
||||
// NewRunner creates a pipeline runner with the given functional options.
|
||||
func NewRunner(options ...Option) *runner {
|
||||
func NewRunner(options ...Option) Runner {
|
||||
r := &runner{}
|
||||
for _, option := range options {
|
||||
option(r)
|
||||
|
||||
Reference in New Issue
Block a user