config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package config is used to generate filter by factory.

Index

Constants

View Source
const (
	BitmapTypeInMemory       BitmapType  = "in-memory"
	BitmapTypeRedis          BitmapType  = "redis"
	RotatorModeDefault       RotatorMode = "default"
	RotatorModeTruncatedTime RotatorMode = "truncated-time"
)

Variables

View Source
var (
	ErrInvalidBitmapType  = errors.New("invalid bitmap type")
	ErrInvalidRotatorMode = errors.New("invalid rotator mode")
)

Functions

This section is empty.

Types

type BitmapConfig

type BitmapConfig struct {
	Type BitmapType
}

func (BitmapConfig) Validate

func (b BitmapConfig) Validate() error

type BitmapType

type BitmapType string

func (BitmapType) Validate

func (b BitmapType) Validate() error

type FactoryConfig

type FactoryConfig struct {
	FilterConfig  FilterConfig
	RedisConfig   RedisConfig
	RotatorConfig RotatorConfig
}

func NewDefaultFactoryConfig

func NewDefaultFactoryConfig() FactoryConfig

func (FactoryConfig) Validate

func (c FactoryConfig) Validate() error

type FilterConfig

type FilterConfig struct {
	BitmapConfig BitmapConfig
	// M is the number of bit in bloom filter.
	M uint64
	// K is the number of hash function.
	K uint64
}

func (FilterConfig) Validate

func (c FilterConfig) Validate() error

type RedisConfig

type RedisConfig struct {
	Addr    string
	Timeout time.Duration
	Key     string
}

func (RedisConfig) Validate

func (c RedisConfig) Validate() error

type RotatorConfig

type RotatorConfig struct {
	Enable bool
	Mode   RotatorMode
	Freq   time.Duration
}

func (RotatorConfig) Validate

func (c RotatorConfig) Validate() error

type RotatorMode added in v0.3.0

type RotatorMode string

func (RotatorMode) Validate added in v0.3.0

func (r RotatorMode) Validate() error

Jump to

Keyboard shortcuts

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