mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-25 13:57:56 +02:00
Run exporter in goroutine
Use channel to pass data from exporter to importer
This commit is contained in:
parent
1ba165a631
commit
298697dcfc
7 changed files with 124 additions and 42 deletions
|
@ -38,13 +38,13 @@ type ListensExport interface {
|
|||
// Returns a list of all listens newer then oldestTimestamp.
|
||||
// The returned list of listens is supposed to be ordered by the
|
||||
// Listen.ListenedAt timestamp, with the oldest entry first.
|
||||
ExportListens(oldestTimestamp time.Time) ([]Listen, error)
|
||||
ExportListens(oldestTimestamp time.Time, results chan ListensResult)
|
||||
}
|
||||
|
||||
// Must be implemented by services supporting the import of listens.
|
||||
type ListensImport interface {
|
||||
// Imports the given list of listens.
|
||||
ImportListens(listens []Listen, oldestTimestamp time.Time) (ImportResult, error)
|
||||
ImportListens(results chan ListensResult, oldestTimestamp time.Time) (ImportResult, error)
|
||||
}
|
||||
|
||||
// Must be implemented by services supporting the export of loves.
|
||||
|
@ -52,13 +52,23 @@ type LovesExport interface {
|
|||
// Returns a list of all loves newer then oldestTimestamp.
|
||||
// The returned list of listens is supposed to be ordered by the
|
||||
// Love.Created timestamp, with the oldest entry first.
|
||||
ExportLoves(oldestTimestamp time.Time) ([]Love, error)
|
||||
ExportLoves(oldestTimestamp time.Time, results chan LovesResult)
|
||||
}
|
||||
|
||||
// Must be implemented by services supporting the import of loves.
|
||||
type LovesImport interface {
|
||||
// Imports the given list of loves.
|
||||
ImportLoves(loves []Love, oldestTimestamp time.Time) (ImportResult, error)
|
||||
ImportLoves(results chan LovesResult, oldestTimestamp time.Time) (ImportResult, error)
|
||||
}
|
||||
|
||||
type ListensResult struct {
|
||||
Error error
|
||||
Listens ListensList
|
||||
}
|
||||
|
||||
type LovesResult struct {
|
||||
Error error
|
||||
Loves LovesList
|
||||
}
|
||||
|
||||
type ImportResult struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue