store

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2022 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompareResult

type CompareResult int
const (
	CompareResultInvalid CompareResult = iota
	CompareResultNewer
	CompareResultNotEqual
	CompareResultEqual
	CompareResultStatusNotEqual
)

type Gateway

type Gateway interface {
	ID() core.GatewayID
	Meta() map[string]string
	ShouldUpdate(other Gateway) bool
	Listeners() []Listener
	ShouldBind(route Route) bool
}

Gateway describes a gateway.

type Listener

type Listener interface {
	ID() string
	CanBind(ctx context.Context, route Route) (bool, error)
	Config() ListenerConfig
	IsValid() bool
}

Listener describes the basic methods of a gateway listener.

type ListenerConfig

type ListenerConfig struct {
	Name     string
	Hostname string
	Port     int
	Protocol string
	TLS      core.TLSParams
}

ListenerConfig contains the common configuration options of a listener.

type Route

type Route interface {
	ID() string
	Compare(other Route) CompareResult
	Resolve(listener Listener) *core.ResolvedRoute
}

Route should be implemented by all route source integrations

type RouteTrackingListener

type RouteTrackingListener interface {
	Listener

	OnRouteAdded(route Route)
	OnRouteRemoved(id string)
}

RouteTrackingListener is an optional extension to Listener that tracks when routes have been bound to it.

type StatusTrackingGateway

type StatusTrackingGateway interface {
	Gateway

	TrackSync(ctx context.Context, sync func() (bool, error)) error
}

StatusTrackingGateway is an optional extension of Gateway. If supported by a Store, when a Gateway is synced to an external location, its corresponding callbacks should be called.

type StatusTrackingRoute

type StatusTrackingRoute interface {
	Route

	SyncStatus(ctx context.Context) error
	OnBound(gateway Gateway)
	OnBindFailed(err error, gateway Gateway)
	OnGatewayRemoved(gateway Gateway)
}

StatusTrackingRoute is an optional extension of Route. If supported by a Store, when a Route is bound or fails to be bound to a gateway, its corresponding callbacks should be called. At the end of any methods affecting the route's binding, SyncStatus should be called.

type Store

type Store interface {
	GatewayExists(ctx context.Context, id core.GatewayID) (bool, error)
	CanFetchSecrets(ctx context.Context, id core.GatewayID, secrets []string) (bool, error)
	DeleteGateway(ctx context.Context, id core.GatewayID) error
	UpsertGateway(ctx context.Context, gateway Gateway) error
	DeleteRoute(ctx context.Context, id string) error
	UpsertRoute(ctx context.Context, route Route) error
	Sync(ctx context.Context) error
}

Store is used for persisting and querying gateways and routes

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL