diff options
Diffstat (limited to 'bridge/core')
-rw-r--r-- | bridge/core/bridge.go | 20 | ||||
-rw-r--r-- | bridge/core/interfaces.go | 4 |
2 files changed, 8 insertions, 16 deletions
diff --git a/bridge/core/bridge.go b/bridge/core/bridge.go index c72ff6b4..10f6b109 100644 --- a/bridge/core/bridge.go +++ b/bridge/core/bridge.go @@ -299,14 +299,14 @@ func (b *Bridge) getExporter() Exporter { return b.exporter } -func (b *Bridge) ensureImportInit() error { +func (b *Bridge) ensureImportInit(ctx context.Context) error { if b.initImportDone { return nil } importer := b.getImporter() if importer != nil { - err := importer.Init(b.repo, b.conf) + err := importer.Init(ctx, b.repo, b.conf) if err != nil { return err } @@ -316,22 +316,14 @@ func (b *Bridge) ensureImportInit() error { return nil } -func (b *Bridge) ensureExportInit() error { +func (b *Bridge) ensureExportInit(ctx context.Context) error { if b.initExportDone { return nil } - importer := b.getImporter() - if importer != nil { - err := importer.Init(b.repo, b.conf) - if err != nil { - return err - } - } - exporter := b.getExporter() if exporter != nil { - err := exporter.Init(b.repo, b.conf) + err := exporter.Init(ctx, b.repo, b.conf) if err != nil { return err } @@ -355,7 +347,7 @@ func (b *Bridge) ImportAllSince(ctx context.Context, since time.Time) (<-chan Im return nil, err } - err = b.ensureImportInit() + err = b.ensureImportInit(ctx) if err != nil { return nil, err } @@ -409,7 +401,7 @@ func (b *Bridge) ExportAll(ctx context.Context, since time.Time) (<-chan ExportR return nil, err } - err = b.ensureExportInit() + err = b.ensureExportInit(ctx) if err != nil { return nil, err } diff --git a/bridge/core/interfaces.go b/bridge/core/interfaces.go index 63340a95..f20f1642 100644 --- a/bridge/core/interfaces.go +++ b/bridge/core/interfaces.go @@ -36,11 +36,11 @@ type BridgeImpl interface { } type Importer interface { - Init(repo *cache.RepoCache, conf Configuration) error + Init(ctx context.Context, repo *cache.RepoCache, conf Configuration) error ImportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ImportResult, error) } type Exporter interface { - Init(repo *cache.RepoCache, conf Configuration) error + Init(ctx context.Context, repo *cache.RepoCache, conf Configuration) error ExportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ExportResult, error) } |