1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00
2021-11-19 19:08:59 +01:00

35 lines
1.0 KiB
Go

// Package sources provides the base interface for all
// route server data source implementations.
package sources
import (
"errors"
"github.com/alice-lg/alice-lg/pkg/api"
)
// Source Errors
var (
// SourceNotFound indicates that a source could
// not be resolved by an identifier.
ErrSourceNotFound = errors.New("route server unknown")
// ErrSourceBusy is returned when a refresh is
// already in progress.
ErrSourceBusy = errors.New("source is busy")
)
// Source is a generic datasource for alice.
// All route server adapters implement this interface.
type Source interface {
ExpireCaches() int
Status() (*api.StatusResponse, error)
Neighbors() (*api.NeighborsResponse, error)
NeighborsStatus() (*api.NeighborsStatusResponse, error)
Routes(neighborID string) (*api.RoutesResponse, error)
RoutesReceived(neighborID string) (*api.RoutesResponse, error)
RoutesFiltered(neighborID string) (*api.RoutesResponse, error)
RoutesNotExported(neighborID string) (*api.RoutesResponse, error)
AllRoutes() (*api.RoutesResponse, error)
}