Documentation
¶
Index ¶
- Variables
- func AssembleApUrl(pro string, host string, path string) string
- type AlpaceMsg
- type App
- type BtLimit
- type Cache
- func (r *Cache) Exists(key string) (bool, error)
- func (r *Cache) GetInt64(key string) (int64, error)
- func (r *Cache) SAdd(key string, value string) error
- func (r *Cache) SGet(key string) ([]interface{}, error)
- func (r *Cache) SetInt64(key string, value int64) error
- func (r *Cache) Srem(key string, value string) error
- type CfgHandle
- type Consumer
- func (cs *Consumer) Close() error
- func (cs *Consumer) CommitOffsets() error
- func (cs *Consumer) Errors() <-chan error
- func (cs *Consumer) MarkOffset(topic string, partition int32, offset int64, groupId string)
- func (cs *Consumer) Notifications() <-chan *sarama_cluster.Notification
- func (cs *Consumer) Recv() <-chan *sarama.ConsumerMessage
- func (cs *Consumer) ResetOffset(topic string, partition int32, offset int64, groupId string)
- func (cs *Consumer) Subscriptions() map[string][]int32
- type CurrMap
- type Fields
- type GPullerConfig
- type GPusherCmd
- type GPusherConfig
- type KaClient
- type Kmessage
- type Logger
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Init(timeForm time.Duration)
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) WithFields(fields map[string]interface{}) *logrus.Entry
- type MessageHandle
- type MsgHandle
- type Producer
- type PullConfig
- type Puller
- type PushConfig
- type Pusher
- type RandomSelect
- type RoundRobin
- type ServerSelector
- type TimeWheel
- type Tmsg
- type Zk
- func (z *Zk) Create(path string, data []byte, nodeType int32, acl []zk.ACL) error
- func (z *Zk) Delete(path string, version int32) error
- func (z *Zk) Exists(path string) (bool, error)
- func (z *Zk) Get(path string) ([]byte, *zk.Stat, error)
- func (z *Zk) GetChildren(path string) ([]string, error)
- func (z *Zk) Set(path string, data []byte, version int32) error
- func (z *Zk) WorldACL() []zk.ACL
Constants ¶
This section is empty.
Variables ¶
var ErrNil = redis.ErrNil
var ZkErrExists = "zk: node already exists"
Functions ¶
Types ¶
type BtLimit ¶ added in v1.0.1
type BtLimit struct {
// contains filtered or unexported fields
}
func NewRateLimit ¶ added in v1.0.1
type CfgHandle ¶ added in v1.0.1
type CfgHandle struct {
// contains filtered or unexported fields
}
func NewCfgHandle ¶ added in v1.0.1
func (*CfgHandle) InitAppCfg ¶ added in v1.0.1
func (*CfgHandle) InitGPullerCfg ¶ added in v1.0.1
func (c *CfgHandle) InitGPullerCfg(cfgFile string) *GPullerConfig
func (*CfgHandle) InitGPusherCfg ¶ added in v1.0.1
func (c *CfgHandle) InitGPusherCfg(cfgFile string) *GPusherConfig
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
func InitConsumer ¶
func InitConsumer(topic string, gname string, conf *PullConfig) (*Consumer, error)
func (*Consumer) CommitOffsets ¶
func (*Consumer) MarkOffset ¶
func (*Consumer) Notifications ¶
func (cs *Consumer) Notifications() <-chan *sarama_cluster.Notification
func (*Consumer) Recv ¶
func (cs *Consumer) Recv() <-chan *sarama.ConsumerMessage
func (*Consumer) ResetOffset ¶
func (*Consumer) Subscriptions ¶
type GPullerConfig ¶
type GPullerConfig struct { Kafka []string `yaml:"kafka"` Zookeeper []string `yaml:"zookeeper"` Redis string `yaml:"redis"` ZkRetryTimes int32 `yaml:"zk_retry_times"` MsgCmtMode int8 `yaml:"msg_commit_mode"` MsgDelayAble int8 `yaml:"msg_delay_able"` OffsetCtTime int32 `yaml:"offset_ct_time"` TimeWheelSize int32 `yaml:"time_wheel_size"` Wnd int32 `yaml:"wnd"` GroupName string `yaml:"group_name"` Topic string `yaml:"topic"` Cmode int8 `yaml:"msg_consum_mode"` Gpath string `yaml:"gpath"` Alist []string `yaml:"services"` LoadBMode int8 `yaml:"load_balance_mode"` }
type GPusherCmd ¶
type GPusherConfig ¶
type GPusherConfig struct { Kafka []string `yaml:"kafka"` Topic string `yaml:"topic"` RateLimit int64 `yaml:"rate_limit"` Cmds []GPusherCmd `yaml:"cmds"` }
type KaClient ¶ added in v1.0.1
type KaClient struct {
// contains filtered or unexported fields
}
func NewKaClient ¶ added in v1.0.1
type MessageHandle ¶ added in v1.0.1
Message core interface processing, through which the final consumption of messages, business logic, service address and message body Kmessage will be accepted
type MsgHandle ¶ added in v1.0.1
type MsgHandle struct {
// contains filtered or unexported fields
}
func NewMsgHandle ¶ added in v1.0.1
Message processing, if the returned status is not equal to 200 or the returned errno is not equal to 0, it will be marked as a message processing failure
type Producer ¶
type Producer struct {
Asp sarama.AsyncProducer
}
func InitProducer ¶
func InitProducer(conf *PushConfig) (*Producer, error)
func (*Producer) Errors ¶
func (asp *Producer) Errors() <-chan *sarama.ProducerError
func (*Producer) Send ¶
func (asp *Producer) Send() chan<- *sarama.ProducerMessage
func (*Producer) Successes ¶
func (asp *Producer) Successes() <-chan *sarama.ProducerMessage
type PullConfig ¶
type PullConfig struct { sarama_cluster.Config // contains filtered or unexported fields }
func NewPullerConfig ¶
func NewPullerConfig(gcf *GPullerConfig) *PullConfig
type Puller ¶
type Puller struct {
// contains filtered or unexported fields
}
func (*Puller) GetLogger ¶ added in v1.0.1
If the default service selector and message processing do not meet your needs, you can implement your own way to meet your needs
func (*Puller) SetMessageHandle ¶ added in v1.0.1
func (p *Puller) SetMessageHandle(mhdle MessageHandle)
func (*Puller) SetServerSelect ¶ added in v1.0.1
func (p *Puller) SetServerSelect(ss ServerSelector)
type PushConfig ¶
func NewPusherConfig ¶
func NewPusherConfig(cf *GPusherConfig) *PushConfig
type Pusher ¶
type Pusher struct {
// contains filtered or unexported fields
}
func InitPusher ¶
func NewPusher ¶
func NewPusher(lg *Logger, pcfg *GPusherConfig) *Pusher
type RandomSelect ¶ added in v1.0.1
type RandomSelect struct { }
Randomly select a service to return, sometimes its randomness is not always correct
func NewRandomSelect ¶ added in v1.0.1
func NewRandomSelect() *RandomSelect
func (*RandomSelect) GetAppUrl ¶ added in v1.0.1
func (r *RandomSelect) GetAppUrl(ap App) string
type RoundRobin ¶ added in v1.0.1
type RoundRobin struct {
// contains filtered or unexported fields
}
Sequentially polling and returning services to ensure that every service has been called, but it cannot remove abnormal services
func NewRoundRobin ¶ added in v1.0.1
func NewRoundRobin(aplist map[string]App) *RoundRobin
func (*RoundRobin) GetAppUrl ¶ added in v1.0.1
func (r *RoundRobin) GetAppUrl(ap App) string
type ServerSelector ¶ added in v1.0.1
Service load balancing strategy is implemented, select service and return, App structure will be returned
type TimeWheel ¶
type TimeWheel struct {
// contains filtered or unexported fields
}