Documentation ¶
Index ¶
- type Callback
- type Option
- func Address(addr string) Option
- func Advertise(addr string) Option
- func AfterStart(cb Callback) Option
- func AfterStop(cb Callback) Option
- func BeforeStart(cb Callback) Option
- func BeforeStop(cb Callback) Option
- func Client(c arpc.Client) Option
- func Context(c context.Context) Option
- func Executor(e exec.Executor) Option
- func Filter(f ...anet.Filter) Option
- func Proxy(proxy string) Option
- func Server(s arpc.Server) Option
- func ServiceID(id string) Option
- type Options
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { Context context.Context BeforeStart []Callback AfterStart []Callback BeforeStop []Callback AfterStop []Callback Broker broker.Broker Server arpc.Server Client arpc.Client Router arpc.Router Selector selector.Selector Exec exec.Executor Filters []anet.Filter Name string Id string Address string Advertise string Proxy string }
系统默认提供了一些默认设置,如果需要扩展,自定义,可通过以下方式 一:手动设置Server和Client,这种方式最繁琐,所有的配置项都需要自己设置,注意:如果使用这种方式,系统将会忽略默认配置,完全由用户托管 二:
1:每个使用到的组件都提供了SetDefault选项用于全局替换组件,只需要初始化的地方设置一下即可,比如registry,selector,anet等 2:有一些会经常用到的参数可直接在Options中设置,用于初始化Server和Client,如Proxy
type Service ¶
type Service interface { Name() string Run() error Exit() Register(callback interface{}, opts ...arpc.MiscOption) error Send(service string, req interface{}, opts ...arpc.MiscOption) error Call(service string, req interface{}, rsp interface{}, opts ...arpc.MiscOption) error }
Service 聚合各个微服务组件,方便外部调用
Directories ¶
Path | Synopsis |
---|---|
asynchronous network,support tcp,kcp,websocket, etc.
|
asynchronous network,support tcp,kcp,websocket, etc. |
apm
|
|
protoc
protobuf codec
|
protobuf codec |
protoc/proto
proto protobuf编解码的简单实现,限制是仅仅支持工具生成协议,好处是不依赖官方库,而且代码量也少
|
proto protobuf编解码的简单实现,限制是仅仅支持工具生成协议,好处是不依赖官方库,而且代码量也少 |
driver
定义数据库操作接口
|
定义数据库操作接口 |
sync
|
|
util
|
|
bytex
from: https://github.com/labstack/gommon
|
from: https://github.com/labstack/gommon |
container/inlist
Package inlist implements an intrusive doubly linked list.
|
Package inlist implements an intrusive doubly linked list. |
dsn
Package dburl provides a standard, URL style mechanism for parsing and opening SQL database connection strings for Go.
|
Package dburl provides a standard, URL style mechanism for parsing and opening SQL database connection strings for Go. |
fsnotify
Package fsnotify provides a platform-independent interface for file system notifications.
|
Package fsnotify provides a platform-independent interface for file system notifications. |
mergo
Package mergo merges same-type structs and maps by setting default values in zero-value fields.
|
Package mergo merges same-type structs and maps by setting default values in zero-value fields. |
strx
Package strcase converts strings to various cases.
|
Package strcase converts strings to various cases. |
Click to show internal directories.
Click to hide internal directories.