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:
2026-08-09 00:32:07 +03:00
parent 328f517543
commit 9c6fc8cffa
3 changed files with 20 additions and 17 deletions
+14 -2
View File
@@ -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)