Back to

Package precreator

Latest Go to latest

The latest major version is .

Published: Aug 20, 2019 | License: MIT | Module:


Package precreator provides the shard precreation service.



const (
	// DefaultCheckInterval is the shard precreation check time if none is specified.
	DefaultCheckInterval = 10 * time.Minute

	// DefaultAdvancePeriod is the default period ahead of the endtime of a shard group
	// that its successor group is created.
	DefaultAdvancePeriod = 30 * time.Minute

type Config

type Config struct {
	Enabled       bool          `toml:"enabled"`
	CheckInterval toml.Duration `toml:"check-interval"`
	AdvancePeriod toml.Duration `toml:"advance-period"`

Config represents the configuration for shard precreation.

func NewConfig

func NewConfig() Config

NewConfig returns a new Config with defaults.

func (Config) Diagnostics

func (c Config) Diagnostics() (*diagnostics.Diagnostics, error)

Diagnostics returns a diagnostics representation of a subset of the Config.

func (Config) Validate

func (c Config) Validate() error

Validate returns an error if the Config is invalid.

type Service

type Service struct {
	Logger *zap.Logger

	MetaClient interface {
		PrecreateShardGroups(now, cutoff time.Time) error
	// contains filtered or unexported fields

Service manages the shard precreation service.

func NewService

func NewService(c Config) *Service

NewService returns an instance of the precreation service.

func (*Service) Close

func (s *Service) Close() error

Close stops the precreation service.

func (*Service) Open

func (s *Service) Open() error

Open starts the precreation service.

func (*Service) WithLogger

func (s *Service) WithLogger(log *zap.Logger)

WithLogger sets the logger for the service.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier