mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-16 10:09:28 +02:00
Added basic documentation of backend interfaces
This commit is contained in:
parent
bae81d9b08
commit
3a76ec7988
1 changed files with 14 additions and 0 deletions
|
@ -27,23 +27,37 @@ import (
|
|||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// A listen service backend.
|
||||
// All listen services must implement this interface.
|
||||
type Backend interface {
|
||||
FromConfig(config *viper.Viper) Backend
|
||||
}
|
||||
|
||||
// Must be implemented by services supporting the export of listens.
|
||||
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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// Must be implemented by services supporting the export of loves.
|
||||
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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue