conf_connector

package
v0.0.0-...-d5b0b98 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeNone   = int32(0)
	EventTypeUpdate = int32(1)
	EventTypeAdd    = int32(2)
	EventTypeDelete = int32(3)
	EventTypeAll    = int32(4)
)
View Source
const (
	ConfigProcessorGroupName = "/evhub/processor/"
)
View Source
const (
	ConfigProducerGroupName = "/evhub/producer/"
)

Variables

This section is empty.

Functions

func KeyProcessorConf

func KeyProcessorConf(dispatcherID string) string

KeyProcessorConf returns the key of the processor group

func KeyProducerConf

func KeyProducerConf(appID, topicID string) string

KeyProducerConf returns the key of producer group

Types

type ConfConnector

type ConfConnector interface {
	GetAllConfInfo() ([]interface{}, error)
	SetWatch(func(c interface{}, eventType int32) error) error
	SetConfInfo(key string, confInfo interface{}) error
	GetConfInfo(key string) ([]byte, error)
}

ConfConnector is the interface for connecting configuration platform

func NewConfConnector

func NewConfConnector(c ConfConnectorConfig, configGroupName string) (ConfConnector, error)

NewConfConnector creates a new connector configuration

type ConfConnectorConfig

type ConfConnectorConfig struct {
	ConfType   ConfigType
	EtcdConfig EtcdConfig
}

ConfConnectorConfig is connector configuration

type ConfigType

type ConfigType string

ConfigType is the type of the configuration

const (
	ConfigTypeEtcd ConfigType = "etcd"
)

type EtcdConf

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

EtcdConf is type of configuration

func NewEtcd

func NewEtcd(c EtcdConfig, configGroupName string) (*EtcdConf, error)

NewEtcd creates a new Etcd configuration

func (*EtcdConf) GetAllConfInfo

func (s *EtcdConf) GetAllConfInfo() ([]interface{}, error)

GetAllConfInfo returns all configuration information

func (*EtcdConf) GetConfInfo

func (s *EtcdConf) GetConfInfo(key string) ([]byte, error)

GetConfInfo is used to get the configuration information

func (*EtcdConf) SetConfInfo

func (s *EtcdConf) SetConfInfo(key string, confInfo interface{}) error

SetConfInfo is used to set the configuration information

func (*EtcdConf) SetWatch

func (s *EtcdConf) SetWatch(watch func(c interface{}, eventType int32) error) error

SetWatch is used to watch the configuration

type EtcdConfig

type EtcdConfig struct {
	EtcdEndpoints   []string
	EtcdDialTimeout time.Duration
}

EtcdConfig is etcd configuration

type FlowControlStrategy

type FlowControlStrategy struct {
	StrategyType string `json:"strategy_type"`
	QPS          int    `json:"qps"`
}

FlowControlStrategy is the strategy of flow control

type ProcessorConf

type ProcessorConf struct {
	ConfConnector ConfConnector
}

ProcessorConf is processor configuration

func (*ProcessorConf) GetAllConfInfo

func (s *ProcessorConf) GetAllConfInfo() ([]*ProcessorConfInfo, error)

GetAllConfInfo returns all configuration information for all topics

func (*ProcessorConf) GetConfInfo

func (s *ProcessorConf) GetConfInfo(dispatcherID string) (*ProcessorConfInfo, error)

GetConfInfo is used to get the configuration information for a given dispatcherID

func (*ProcessorConf) SetConfInfo

func (s *ProcessorConf) SetConfInfo(dispatcherID string, confInfo *ProcessorConfInfo) error

SetConfInfo is used to set the configuration information for a given processor

func (*ProcessorConf) SetWatch

func (s *ProcessorConf) SetWatch(watch func(c *ProcessorConfInfo, eventType int32) error) error

SetWatch is used to watch the configuration

type ProcessorConfConnector

type ProcessorConfConnector interface {
	GetAllConfInfo() ([]*ProcessorConfInfo, error)
	SetWatch(func(c *ProcessorConfInfo, eventType int32) error) error
	SetConfInfo(dispatcherID string, confInfo *ProcessorConfInfo) error
	GetConfInfo(dispatcherID string) (*ProcessorConfInfo, error)
}

ProcessorConfConnector is the interface for a connector of processor configuration

func NewProcessorConfConnector

func NewProcessorConfConnector(c ConfConnectorConfig) (ProcessorConfConnector, error)

NewProcessorConfConnector creates a new processor configuration connector

type ProcessorConfInfo

type ProcessorConfInfo struct {
	AppID               string              `json:"app_id"`
	TopicID             string              `json:"topic_id"`
	ProtocolType        string              `json:"protocol_type"`
	Addr                string              `json:"addr"`
	DispatcherID        string              `json:"dispatcher_id"`
	IsFlowControl       bool                `json:"is_flow_control"`
	FlowControlStrategy FlowControlStrategy `json:"flow_control_strategy"`
	IsRetry             bool                `json:"is_retry"`
	RetryStrategy       RetryStrategy       `json:"retry_strategy"`
	Timeout             int64               `json:"timeout"`
	IsStop              bool                `json:"is_stop"`
	FilterTag           map[string]bool     `json:"filter_tag"`
	DelayProcessKey     string              `json:"delay_process_key"`
}

ProcessorConfInfo is the configuration information for a processor

type ProducerConf

type ProducerConf struct {
	// ConfConnector is the connector of producer configuration
	ConfConnector ConfConnector
}

ProducerConf is producer configuration

func (*ProducerConf) GetAllConfInfo

func (s *ProducerConf) GetAllConfInfo() ([]*ProducerConfInfo, error)

GetAllConfInfo returns all configuration information for all topics

func (*ProducerConf) GetConfInfo

func (s *ProducerConf) GetConfInfo(appID, topicID string) (*ProducerConfInfo, error)

GetConfInfo is used to get the configuration information for a given appID, topicID

func (*ProducerConf) SetConfInfo

func (s *ProducerConf) SetConfInfo(appID, topicID string, confInfo *ProducerConfInfo) error

SetConfInfo is used to set the configuration information for a given producer

func (*ProducerConf) SetWatch

func (s *ProducerConf) SetWatch(watch func(c *ProducerConfInfo, eventType int32) error) error

SetWatch is used to watch the configuration

type ProducerConfConnector

type ProducerConfConnector interface {
	GetAllConfInfo() ([]*ProducerConfInfo, error)
	SetWatch(func(c *ProducerConfInfo, eventType int32) error) error
	SetConfInfo(appID, topicID string, confInfo *ProducerConfInfo) error
	GetConfInfo(appID, topicID string) (*ProducerConfInfo, error)
}

ProducerConfConnector is the interface for a connector of producer configuration

func NewProducerConfConnector

func NewProducerConfConnector(c ConfConnectorConfig) (ProducerConfConnector, error)

NewProducerConfConnector creates a new producer configuration connector

type ProducerConfInfo

type ProducerConfInfo struct {
	AppID              string `json:"app_id"`
	TopicID            string `json:"topic_id"`
	QPS                int64  `json:"qps"`
	MsgSize            int64  `json:"msg_size"`
	TotalMsg           int64  `json:"total_msg"`
	StoragePeriod      int64  `json:"storage_period"`
	TxProtocolType     int    `json:"tx_protocol_type"`
	TxAddress          string `json:"tx_address"`
	TxTimeout          int64  `json:"tx_timeout"`
	TxCallbackInterval int64  `json:"tx_callback_interval"`
}

ProducerConfInfo is the configuration information for a producer

type RetryStrategy

type RetryStrategy struct {
	StrategyType  string `json:"strategy_type"`
	RetryInterval int64  `json:"retry_interval"`
	RetryCount    int    `json:"retry_count"`
}

RetryStrategy is the strategy of retry

Jump to

Keyboard shortcuts

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