Documentation ¶
Index ¶
- Constants
- func AvailableLoad() uint32
- type IServer
- type Normal
- func (p *Normal) Exit()
- func (p *Normal) HandleBus()
- func (p *Normal) Info() string
- func (p *Normal) IsRunning() bool
- func (p *Normal) IsStopping() bool
- func (p *Normal) OnInit(ctx context.Context, opts ...*Options) error
- func (p *Normal) OnLoadBench(_ context.Context, opts ...*Options) error
- func (p *Normal) OnPreStop(_ context.Context) error
- func (p *Normal) OnRun(_ context.Context) error
- func (p *Normal) OnStart(_ context.Context) error
- func (p *Normal) OnStop(_ context.Context) error
- func (p *Normal) SetStopping()
- type NormalTimerSecond
- type OnDefaultHandler
- type Options
- func (p *Options) WithDefaultHandler(defaultHandler OnDefaultHandler) *Options
- func (p *Options) WithEtcdHandler(etcdHandler libetcd.OnFunc) *Options
- func (p *Options) WithSubBench(subBench pkgsubbench.ISubBench) *Options
- func (p *Options) WithTimerEachDay(timerEachDay *NormalTimerSecond) *Options
- func (p *Options) WithTimerEachSecond(timerEachSecond *NormalTimerSecond) *Options
Constants ¶
View Source
const ( StatusRunning status = 0 // 运行中 StatusStopping status = 1 // 关闭中 )
View Source
const InfoTimeOutSec = 10
InfoTimeOutSec 信息 超时时间 秒
View Source
const NameBlog string = "blog" //博客
View Source
const NameCleansing string = "cleansing" //清洗
View Source
const NameFriend string = "friend" //好友
View Source
const NameGate string = "gate" //网关
View Source
const NameInteraction string = "interaction" //交互
View Source
const NameLogin string = "login" //登录
View Source
const NameNotification string = "notification" //通知
View Source
const NameRecommendation string = "recommendation" //推荐
View Source
const NameRobot string = "robot" //机器人
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IServer ¶
type IServer interface { OnLoadBench(ctx context.Context, opts ...*Options) error //加载bench.json配置文件 OnInit(ctx context.Context, opts ...*Options) error //初始化服务资源 OnStart(ctx context.Context) error //启动 OnRun(ctx context.Context) error //运行 OnPreStop(ctx context.Context) error //停止前的处理 OnStop(ctx context.Context) error //停止 }
type Normal ¶
type Normal struct { Options *Options ProgramPath string // 程序路径 ProgramName string // 程序名称 ZoneID uint32 // 区域ID ServiceName string // 服务 ServiceID uint32 // 服务ID BenchMgr *libbench.Mgr TimeMgr *libtime.Mgr TimerMgr *libtimer.Mgr LogMgr *liblog.Mgr EtcdMgr *libetcd.Mgr GrpcServer *grpc.Server // contains filtered or unexported fields }
func (*Normal) HandleBus ¶
func (p *Normal) HandleBus()
HandleBus 处理总线 todo [重要] issue 在处理 event 时候, 向 eventChan 中插入 事件,注意超出eventChan的上限会阻塞.
func (*Normal) OnLoadBench ¶
type NormalTimerSecond ¶
type OnDefaultHandler ¶
type OnDefaultHandler func(v interface{}) error
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options contains Options to configure a server instance. Each option can be set through setter functions. See documentation for each setter function for an explanation of the option.
func (*Options) WithDefaultHandler ¶
func (p *Options) WithDefaultHandler(defaultHandler OnDefaultHandler) *Options
func (*Options) WithEtcdHandler ¶
func (*Options) WithSubBench ¶
func (p *Options) WithSubBench(subBench pkgsubbench.ISubBench) *Options
func (*Options) WithTimerEachDay ¶
func (p *Options) WithTimerEachDay(timerEachDay *NormalTimerSecond) *Options
func (*Options) WithTimerEachSecond ¶
func (p *Options) WithTimerEachSecond(timerEachSecond *NormalTimerSecond) *Options
Click to show internal directories.
Click to hide internal directories.