server

package
v0.0.0-...-0490640 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartServer

func StartServer(ctx context.Context, config Config) error

StartServer starts the data lifecycle server

Types

type Config

type Config struct {
	ListenAddress     string                           `toml:"listen_address"`
	Port              uint16                           `toml:"port"`
	LogLevel          string                           `toml:"log_level"`
	DailyRunAt        *ValidatedTimeOfDay              `toml:"daily_run_at"`
	ManagedServices   map[string]storage.ServiceConfig `toml:"managed"`
	DataLifeCycleInfo *DataLifeCycleConfig             `toml:"data-lifecycle"`
	certs.TLSConfig   `toml:"tls"`
}

Config describes the configuration for the Data Lifecycle Service

func ConfigFromToml

func ConfigFromToml(configPath string) (Config, error)

ConfigFromToml loads a configuration file from a toml file

type DailyTriggerServer

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

DailyTriggerServer is a server that runs Data Lifecycle methods once a day

func NewDailyTriggerServer

func NewDailyTriggerServer(dls *Server, atTimeUtc *ValidatedTimeOfDay) *DailyTriggerServer

NewDailyTriggerServer returns a DailyTriggerServer that runs at atTimeUtc daily

func (*DailyTriggerServer) Start

func (s *DailyTriggerServer) Start()

Start starts the server.

func (*DailyTriggerServer) Stop

func (s *DailyTriggerServer) Stop()

Stop stops the server

type DataLifeCycleConfig

type DataLifeCycleConfig struct {
	// PurgeOlderThanDays describes how long we keep time series data. Anything
	// older than this is allowed to be regularly removed.
	PurgeOlderThanDays int32 `toml:"purge_older_than_days"`
}

DataLifeCycleConfig describes the configuration needed to manage this services data

type Server

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

Server is the Data Lifecycle Server. It is responsible for calling data lifecycle manageable methods such as Purge on other services (and itself).

func NewServer

func NewServer(version string,
	serviceConfigStore storage.ServiceConfigStore,
	dataLifecycleConfig *DataLifeCycleConfig,
	connFactory *secureconn.Factory) *Server

NewServer returns a new Data Lifecycle Server

func (*Server) Purge

func (server *Server) Purge(ctx context.Context, request *api.PurgeRequest) (*api.PurgeResponse, error)

Purge returns success as there is no stored data for this service yet.

func (*Server) TriggerPurge

func (server *Server) TriggerPurge(ctx context.Context,
	request *api.TriggerPurgeRequest) (*api.TriggerPurgeResponse, error)

TriggerPurge triggers a purge to happen on configured services

func (*Server) Version

func (server *Server) Version(ctx context.Context, request *api.VersionRequest) (*api.VersionResponse, error)

Version returns the Version of the Data Lifecycle Service

type ValidatedTimeOfDay

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

ValidatedTimeOfDay time is a valid time of day

func DefaultTimeOfDay

func DefaultTimeOfDay() *ValidatedTimeOfDay

DefaultTimeOfDay returns a ValidatedTimeOfDay with midnight

func (*ValidatedTimeOfDay) Hour

func (tod *ValidatedTimeOfDay) Hour() int

Hour returns the hour

func (*ValidatedTimeOfDay) Min

func (tod *ValidatedTimeOfDay) Min() int

Min returns the minute

func (*ValidatedTimeOfDay) Sec

func (tod *ValidatedTimeOfDay) Sec() int

Sec returns the second

func (*ValidatedTimeOfDay) UnmarshalText

func (tod *ValidatedTimeOfDay) UnmarshalText(text []byte) error

UnmarshalText unmarshals a text in the format hh:mm:ss to a ValidatedTimeOfDay. Hour must be less than 24 and greater than 0 Min must be less then 60 and greater than 0 Sec must be less than 60 and greater than 0 Failing any of the above validation criteria returns an error

Jump to

Keyboard shortcuts

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