Documentation
¶
Index ¶
- func NewNodeClient(registry *cluster.Registry, nodeID ulid.ULID) (nh.NodeClient, error)
- type Component
- type GatewayConfig
- type Node
- func (n *Node) AddComponent(c ...Component)
- func (n *Node) ChangeState(state cluster.NodeState) (err error)
- func (n *Node) Entry() cluster.NodeEntry
- func (n *Node) GetComponents() []Component
- func (n *Node) ID() ulid.ULID
- func (n *Node) Serve(ctx context.Context) error
- func (n *Node) Shutdown()
- func (n *Node) State() cluster.NodeState
- type NodeOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNodeClient ¶
NewNodeClient 节点管理服务客户端
Types ¶
type Component ¶
type Component interface {
// Name 组件名称,仅用于显示
Name() string
// Start方法注意不要阻塞程序执行
Start(ctx context.Context) error
Stop(ctx context.Context)
}
Component 组件
type GatewayConfig ¶
type GatewayConfig struct {
NodeOptions []NodeOption
Options []gateway.Option
GRPCListen string
GRPCListener net.Listener
GRPCServerOption []grpc.ServerOption
MetricsListen string
}
GatewayConfig 网关配置
type Node ¶
Node 节点,一个节点上可以运行多个网络服务
func NewGatewayNode ¶
func NewGatewayNode(registry *cluster.Registry, config GatewayConfig) *Node
NewGatewayNode 构造一个网关节点
func NewNode ¶
func NewNode(name string, registry *cluster.Registry, option ...NodeOption) *Node
NewNode 构造函数
func (*Node) ChangeState ¶
ChangeState 改变节点状态
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
protoc-gen-go-nodehub
module
|
|
|
component
|
|
|
example
module
|
|
|
internal
|
|
|
proto
|
|
Click to show internal directories.
Click to hide internal directories.