config

package
v0.0.0-...-433abdc Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvGomegaConfigPath = "GOMEGA_CONFIG_PATH"
	GomegaConfigName    = "gomega_config.json"
)
View Source
const (
	MaxDataSize = 1024 * 1024
	MaxFileSize = 1024 * 1024 * 1024

	DefaultQueueMaxSize uint64 = 1024
)
View Source
const (
	IdxFileSuffix  = ".idx"
	DataFileSuffix = ".dat"
)
View Source
const (
	DefaultMaxTimeout          = 60
	DefaultMaxRetryCount       = 3
	DefaultRetryIntervalMs     = 5
	DefaultItemLifetimeInQueue = 600
)

Variables

This section is empty.

Functions

func FlushConfig

func FlushConfig() error

FlushConfig flushes the config to file.

func GetFileRotatorSize

func GetFileRotatorSize() int64

func GetGRPCServerNetworkAndAddress

func GetGRPCServerNetworkAndAddress() (string, string)

func GetMaxMessageSize

func GetMaxMessageSize() int

func GetRootPath

func GetRootPath() string

func InitConfig

func InitConfig() error

func SetBrokerCfg

func SetBrokerCfg(topic string, brokerCfg *BrokerCfg)

Types

type BrokerCfg

type BrokerCfg struct {
	QueueMaxSize   uint64
	PubCfg         *PubCfg
	GroupSubCfgMap map[string]*SubCfg
}

func GetBrokerCfg

func GetBrokerCfg(topic string) (*BrokerCfg, bool)

func (*BrokerCfg) GetGroupSubCfg

func (b *BrokerCfg) GetGroupSubCfg(group string) (*SubCfg, bool)

func (*BrokerCfg) SetGroupSubCfg

func (b *BrokerCfg) SetGroupSubCfg(group string, cfg *SubCfg)

type Config

type Config struct {
	GRPCServerNetwork string `json:"grpc_server_network" yaml:"grpc_server_network"`
	GRPCServerAddress string `json:"grpc_server_address" yaml:"grpc_server_address"`

	RootPath        string                `json:"root_path" yaml:"root_path"`
	MaxMessageSize  int                   `json:"max_message_size" yaml:"max_message_size"`
	FileRotatorSize int64                 `json:"file_rotator_size" yaml:"file_rotator_size"`
	BrokerCfgMap    map[string]*BrokerCfg `json:"broker_cfg_map" yaml:"broker_cfg_map"`
}

func NewDefaultConfig

func NewDefaultConfig() *Config

type Option

type Option func(c *Config)

func WithLogger

func WithLogger(logger log.Logger) Option

type PubCfg

type PubCfg struct {
	Topic            string
	LastSequence     uint64
	LastFileSequence uint64
}

type SubCfg

type SubCfg struct {
	Topic          string
	Group          string
	Version        uint32
	LastSequence   uint64
	IsHashDispatch bool
}

Jump to

Keyboard shortcuts

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