route/internal/database/storage.go

31 lines
1.0 KiB
Go

package database
import (
"golang.org/x/net/context"
)
// Storage is the parent interface for the database backends of route.
type Storage interface {
// routes
GetRoute(ctx context.Context, id string) (Route, error)
GetRouteHost(ctx context.Context, host string) (Route, error)
GetAllRoutes(ctx context.Context, user string) ([]Route, error)
PutRoute(ctx context.Context, domain, kind string) (Route, error)
DeleteRoute(ctx context.Context, id string) error
// tokens
GetToken(ctx context.Context, token string) (Token, error)
GetTokenID(ctx context.Context, id string) (Token, error)
GetTokensForOwner(ctx context.Context, owner string) ([]Token, error)
PutToken(ctx context.Context, token, owner string, scopes []string) (Token, error)
DeleteToken(ctx context.Context, id string) error
DeactivateToken(ctx context.Context, id string) error
// certificates
GetCert(ctx context.Context, key string) ([]byte, error)
PutCert(ctx context.Context, key string, data []byte) error
DeleteCert(ctx context.Context, key string) error
Close() error
}