diff --git a/models/interfaces.go b/models/interfaces.go index 9ebecea..2db0687 100644 --- a/models/interfaces.go +++ b/models/interfaces.go @@ -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) }