storage

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const AkkerisAppLabelKey = "akkeris.io/app-name"
View Source
const AkkerisDynoTypeLabelKey = "akkeris.io/dyno-type"
View Source
const DrainAnnotationKey = "logtrain.akkeris.io/drains"
View Source
const HostnameAnnotationKey = "logtrain.akkeris.io/hostname"
View Source
const TagAnnotationKey = "logtrain.akkeris.io/tag"

Variables

This section is empty.

Functions

func GetHostNameFromTLO

func GetHostNameFromTLO(kube kubernetes.Interface, obj meta.Object, useAkkerisHosts bool) string

GetHostNameFromTLO derives a hostname from an object in kubernetes

func GetKubernetesClient added in v0.0.64

func GetKubernetesClient(kubeConfigPath string) (kubernetes.Interface, error)

GetKubernetesClient returns a new kubernetes client by testing the in cluster config or checking the file path

Types

type DataSource

type DataSource interface {
	AddRoute() chan LogRoute
	RemoveRoute() chan LogRoute
	GetAllRoutes() ([]LogRoute, error)
	EmitNewRoute(route LogRoute) error
	EmitRemoveRoute(route LogRoute) error
	Writable() bool
	Close() error
	Dial() error
}

Datasource describes an interface for querying and listening for routes

func FindDataSources added in v0.0.64

func FindDataSources(useKubernetes bool, kubeConfig string, usePostgres bool, databaseURL string) ([]DataSource, error)

FindDataSources finds what datasources may be availabl and returns instantiated objects

type KubernetesDataSource

type KubernetesDataSource struct {
	// contains filtered or unexported fields
}

KubernetesDataSource uses kubernetes as a datasource for routes by listening to annotations

func CreateKubernetesDataSource

func CreateKubernetesDataSource(kube kubernetes.Interface, checkPermissions bool) (*KubernetesDataSource, error)

CreateKubernetesDataSource creates a new kubernetes data source from a kube client

func (*KubernetesDataSource) AddRoute

func (kds *KubernetesDataSource) AddRoute() chan LogRoute

AddRoute returns a channel where new routes are published to

func (*KubernetesDataSource) Close

func (kds *KubernetesDataSource) Close() error

Close closes the data sources

func (*KubernetesDataSource) Dial added in v0.4.1

func (kds *KubernetesDataSource) Dial() error

Dial connects the data source

func (*KubernetesDataSource) EmitNewRoute added in v0.0.64

func (kds *KubernetesDataSource) EmitNewRoute(route LogRoute) error

EmitNewRoute always returns an error as this datasource is not currently writable.

func (*KubernetesDataSource) EmitRemoveRoute added in v0.0.64

func (kds *KubernetesDataSource) EmitRemoveRoute(route LogRoute) error

EmitRemoveRoute always returns an error as this datasource is not currently writable.

func (*KubernetesDataSource) GetAllRoutes

func (kds *KubernetesDataSource) GetAllRoutes() ([]LogRoute, error)

GetAllRoutes returns all routes the datasource is aware of

func (*KubernetesDataSource) RemoveRoute

func (kds *KubernetesDataSource) RemoveRoute() chan LogRoute

RemoveRoute returns a channel where route removals are published

func (*KubernetesDataSource) Writable added in v0.0.64

func (kds *KubernetesDataSource) Writable() bool

Writable returns false always as this datasource is not writable.

type Listener

type Listener interface {
	Close() error
	Listen(string) error
	NotificationChannel() <-chan *pq.Notification
	Ping() error
}

This normally isnt needed but in order to pass in a fake listener for testing we need this.

type LogRoute

type LogRoute struct {
	Endpoint string
	Hostname string
	Tag      string
	// contains filtered or unexported fields
}

LogRoute describes a structure for routes from Hostname -> Endpoint

type MemoryDataSource added in v0.0.64

type MemoryDataSource struct {
	// contains filtered or unexported fields
}

MemoryDataSource is used by logtail and tests

func CreateMemoryDataSource added in v0.0.64

func CreateMemoryDataSource() *MemoryDataSource

CreateMemoryDataSource creates a memory data source for testing or logtail.

func (*MemoryDataSource) AddRoute added in v0.0.64

func (dataSource *MemoryDataSource) AddRoute() chan LogRoute

AddRoute returns a channel that informs the listener of new routes

func (*MemoryDataSource) Close added in v0.0.64

func (dataSource *MemoryDataSource) Close() error

Close closes this memory data source

func (*MemoryDataSource) Dial added in v0.4.1

func (dataSource *MemoryDataSource) Dial() error

Dial connects the data source

func (*MemoryDataSource) EmitNewRoute added in v0.0.64

func (dataSource *MemoryDataSource) EmitNewRoute(route LogRoute) error

EmitNewRoute adds a new route and emits it by the add route channel

func (*MemoryDataSource) EmitRemoveRoute added in v0.0.64

func (dataSource *MemoryDataSource) EmitRemoveRoute(route LogRoute) error

EmitRemoveRoute removes a route from the datasource and emits it to the remote route channel

func (*MemoryDataSource) GetAllRoutes added in v0.0.64

func (dataSource *MemoryDataSource) GetAllRoutes() ([]LogRoute, error)

GetAllRoutes returns all routes

func (*MemoryDataSource) RemoveRoute added in v0.0.64

func (dataSource *MemoryDataSource) RemoveRoute() chan LogRoute

RemoveRoute returns a channel that informs the listener of route removals

func (*MemoryDataSource) Writable added in v0.0.64

func (dataSource *MemoryDataSource) Writable() bool

Writable indicates if emitting new add/remove routes can be called safely, some datasources are read only and cannot be written to.

type PostgresDataSource

type PostgresDataSource struct {
	// contains filtered or unexported fields
}

func CreatePostgresDataSource

func CreatePostgresDataSource(db *sql.DB, listener Listener, init bool) (*PostgresDataSource, error)

func CreatePostgresDataSourceWithURL added in v0.0.64

func CreatePostgresDataSourceWithURL(databaseURL string) (*PostgresDataSource, error)

CreatePostgresDataSourceWithURL creates a postgres datasource from a database url.

func (*PostgresDataSource) AddRoute

func (pds *PostgresDataSource) AddRoute() chan LogRoute

func (*PostgresDataSource) Close added in v0.0.64

func (pds *PostgresDataSource) Close() error

Close closes the postgres datasource.

func (*PostgresDataSource) Dial added in v0.4.1

func (pds *PostgresDataSource) Dial() error

Dial connects the data source

func (*PostgresDataSource) EmitNewRoute added in v0.0.64

func (pds *PostgresDataSource) EmitNewRoute(route LogRoute) error

EmitNewRoute always returns an error as this datasource is not currently writable.

func (*PostgresDataSource) EmitRemoveRoute added in v0.0.64

func (pds *PostgresDataSource) EmitRemoveRoute(route LogRoute) error

EmitRemoveRoute always returns an error as this datasource is not currently writable.

func (*PostgresDataSource) GetAllRoutes

func (pds *PostgresDataSource) GetAllRoutes() ([]LogRoute, error)

func (*PostgresDataSource) RemoveRoute

func (pds *PostgresDataSource) RemoveRoute() chan LogRoute

func (*PostgresDataSource) Writable added in v0.0.64

func (pds *PostgresDataSource) Writable() bool

Writable returns false always as this datasource is not writable.

Jump to

Keyboard shortcuts

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