mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-14 08:45:30 +03:00
5ca326af83
bridge/core: add ImportResult objects to stream import events bridge/core: launchpad support asynchronous import bridge/github: cancellable export and import functions bridge/gitlab: cancellable export and import functions commands: bridge pull/push gracefull kill bridge/github: fix github import bridge/github: use simple context for imports bridge/core: name parameters in interfaces github/core: Add EventError to export and import events types bridge/gitlab: add context support in gitlab requests functions bridge/gitlab: remove imported events count from importer logic bridge/github: remove imported events count from importer logic bridge/github: add context support in query and muration requets bridge/github: fix bug duplicate editions after multiple calls bridge/core: import import and export events String methods bridge/gitlab: fix error handling in note import events commands/bridge: Add statistics about imports and exports bridge/gitlab: properly handle context cancellation bridge/github: improve error handling bridge: break iterators on context cancel or timeout bridge: add context timeout support bridge: improve event formating and error handling commands: handle interrupt and switch cases bridge/github: add export mutation timeouts bridge: fix race condition bug in the github and gitlab importers bridge/github: improve context error handling
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package core
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/MichaelMure/git-bug/cache"
|
|
"github.com/MichaelMure/git-bug/repository"
|
|
)
|
|
|
|
type Configuration map[string]string
|
|
|
|
type BridgeImpl interface {
|
|
// Target return the target of the bridge (e.g.: "github")
|
|
Target() string
|
|
|
|
// Configure handle the user interaction and return a key/value configuration
|
|
// for future use
|
|
Configure(repo repository.RepoCommon, params BridgeParams) (Configuration, error)
|
|
|
|
// ValidateConfig check the configuration for error
|
|
ValidateConfig(conf Configuration) error
|
|
|
|
// NewImporter return an Importer implementation if the import is supported
|
|
NewImporter() Importer
|
|
|
|
// NewExporter return an Exporter implementation if the export is supported
|
|
NewExporter() Exporter
|
|
}
|
|
|
|
type Importer interface {
|
|
Init(conf Configuration) error
|
|
ImportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ImportResult, error)
|
|
}
|
|
|
|
type Exporter interface {
|
|
Init(conf Configuration) error
|
|
ExportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ExportResult, error)
|
|
}
|