interfaces.go

 1package core
 2
 3import (
 4	"context"
 5	"time"
 6
 7	"github.com/MichaelMure/git-bug/cache"
 8)
 9
10type Configuration map[string]string
11
12type BridgeImpl interface {
13	// Target return the target of the bridge (e.g.: "github")
14	Target() string
15
16	// Configure handle the user interaction and return a key/value configuration
17	// for future use
18	Configure(repo *cache.RepoCache, params BridgeParams) (Configuration, error)
19
20	// ValidateConfig check the configuration for error
21	ValidateConfig(conf Configuration) error
22
23	// NewImporter return an Importer implementation if the import is supported
24	NewImporter() Importer
25
26	// NewExporter return an Exporter implementation if the export is supported
27	NewExporter() Exporter
28}
29
30type Importer interface {
31	Init(repo *cache.RepoCache, conf Configuration) error
32	ImportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ImportResult, error)
33}
34
35type Exporter interface {
36	Init(repo *cache.RepoCache, conf Configuration) error
37	ExportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ExportResult, error)
38}