retention - ActiveState ActiveGo 1.8

Package retention

import ""

Overview ▾

Package retention provides the retention policy enforcement service.

type Config

Config represents the configuration for the retention service.

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

func NewConfig

func NewConfig() Config

NewConfig returns an instance of Config with defaults.

func (Config) Validate

func (c Config) Validate() error

Validate returns an error if the Config is invalid.

type Service

Service represents the retention policy enforcement service.

type Service struct {
    MetaClient interface {
        Databases() []meta.DatabaseInfo
        DeleteShardGroup(database, policy string, id uint64) error
        PruneShardGroups() error
    TSDBStore interface {
        ShardIDs() []uint64
        DeleteShard(shardID uint64) error
    // contains filtered or unexported fields

func NewService

func NewService(c Config) *Service

NewService returns a configured retention policy enforcement service.

func (*Service) Close

func (s *Service) Close() error

Close stops retention policy enforcement.

func (*Service) Open

func (s *Service) Open() error

Open starts retention policy enforcement.

func (*Service) WithLogger

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

WithLogger sets the logger on the service.