Documentation ¶
Index ¶
- Constants
- Variables
- func Call(ctx context.Context, method string, args, reply interface{}) (err error)
- func CallIn100ms(ctx context.Context, method string, args, reply interface{}) (err error)
- func CallIn200ms(ctx context.Context, method string, args, reply interface{}) (err error)
- func CallIn500ms(ctx context.Context, method string, args, reply interface{}) (err error)
- func CallWithOption(ctx context.Context, conn *grpc.ClientConn, method string, ...) (err error)
- func CallWithServerName(ctx context.Context, serverName, method string, args, reply interface{}) (err error)
- func CallWithServerNameTimeout(ctx context.Context, serverName, method string, args, reply interface{}, ...) (err error)
- func CallWithTimeout(ctx context.Context, method string, args, reply interface{}, t time.Duration) (err error)
- func GetConn(name string) *grpc.ClientConn
- func GetEtcdClient() *qetcd.Op
- func GetListenerKey(serverName string) string
- func GetRegisterKey(key string) string
- func GetRegisterServerNames() []string
- func GetRegisterValue() string
- func Init(c *Config) error
- type Config
- type GrpcClient
- type NoArgs
- func (*NoArgs) Descriptor() ([]byte, []int)
- func (m *NoArgs) Marshal() (dAtA []byte, err error)
- func (m *NoArgs) MarshalTo(dAtA []byte) (int, error)
- func (m *NoArgs) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*NoArgs) ProtoMessage()
- func (m *NoArgs) Reset()
- func (m *NoArgs) Size() (n int)
- func (m *NoArgs) String() string
- func (m *NoArgs) Unmarshal(dAtA []byte) error
- func (m *NoArgs) XXX_DiscardUnknown()
- func (m *NoArgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NoArgs) XXX_Merge(src proto.Message)
- func (m *NoArgs) XXX_Size() int
- func (m *NoArgs) XXX_Unmarshal(b []byte) error
- type Op
- type RegisterModel
Constants ¶
View Source
const (
DefaultSchema = "default"
)
View Source
const (
MetaKey = "meta"
)
Variables ¶
View Source
var ( ErrNoSuchGrpcClient = errors.New("no such grpc client") ErrConf = errors.New("conf error") )
Functions ¶
func CallIn100ms ¶
100ms超时
func CallIn200ms ¶
func CallIn500ms ¶
func CallWithOption ¶
func CallWithOption(ctx context.Context, conn *grpc.ClientConn, method string, args, reply interface{}, opts ...grpc.CallOption) (err error)
method->/rpc.Rpc/Ping
func CallWithServerName ¶
func CallWithTimeout ¶
func GetEtcdClient ¶
func GetListenerKey ¶
func GetRegisterKey ¶
func GetRegisterServerNames ¶
func GetRegisterServerNames() []string
func GetRegisterValue ¶
func GetRegisterValue() string
Types ¶
type Config ¶
type Config struct { // etcd的地址 必须要 Endpoints []string `toml:"endpoints" json:"endpoints"` // etcd的服务的前缀,需要通过prefix来区别正式测试等等环境 必须要 Prefix string `toml:"prefix" json:"prefix"` // 注册部分 // 服务名称,固定为 aa.Aa ,grpc的服务名称,如果服务多个,可以用 | 来分割 ServerName string `toml:"serverName" json:"server_name"` // 你注册的服务地址,可以是外网地址,也可以是内网地址 Addr string `toml:"addr" json:"addr"` // 额外存储的部分 Ext string `toml:"ext" json:"ext"` Schema string `toml:"schema" json:"schema"` // 监听部分 // 想要监听的服务地址 // 用grpc做lb WatchServers []string `toml:"watchServers" json:"watch_servers"` // 这种就是默认全监听,收到之后,相当于每个服务,会单独的去监听 // 适合长连接的类型,不需要lb的这种 WatchPrefix []string `toml:"watchPrefix" json:"watch_prefix"` // 是否阻塞启动 Block bool `toml:"block"` }
etcd的配置
type GrpcClient ¶
type GrpcClient struct {
// contains filtered or unexported fields
}
type NoArgs ¶
type NoArgs struct { }
func (*NoArgs) Descriptor ¶
func (*NoArgs) MarshalToSizedBuffer ¶
func (*NoArgs) ProtoMessage ¶
func (*NoArgs) ProtoMessage()
func (*NoArgs) XXX_DiscardUnknown ¶
func (m *NoArgs) XXX_DiscardUnknown()
func (*NoArgs) XXX_Marshal ¶
func (*NoArgs) XXX_Unmarshal ¶
type Op ¶
type Op struct { // 配置文件 C *Config // 本地的地址 LocalIp string // contains filtered or unexported fields }
var (
O *Op
)
func (*Op) AddGrpcClient ¶
func (o *Op) AddGrpcClient(serverName string, target *RegisterModel, w *watcher) error
func (*Op) DeleteGrpcClient ¶
type RegisterModel ¶
type RegisterModel struct { Name string `json:"name,omitempty"` CreatedAt string `json:"created_at,omitempty"` Addr string `json:"addr,omitempty"` Hostname string `json:"hostname,omitempty"` Ext string `json:"ext,omitempty"` }
func ExtractRegisterModel ¶
func ExtractRegisterModel(val string) *RegisterModel
func GetPrefixAddrsRegisterModel ¶
func GetPrefixAddrsRegisterModel(serviceName string) []*RegisterModel
Source Files ¶
Click to show internal directories.
Click to hide internal directories.