rpcEtcdApi

package
v0.0.0-...-63b2ac5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: GPL-2.0 Imports: 15 Imported by: 0

README

实现一个抽象的服务中心api, 使用etcd来做其实现层. 对外使用的是其 公共api 把具体的依赖包级api, 隔离出来. 使用这一层自己定义的api好些.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main()

func NewRpcServiceConfig

func NewRpcServiceConfig() *rpcServiceConfig

func RegisterScConfigServiceServer

func RegisterScConfigServiceServer(s *grpc.Server, srv ScConfigServiceServer)

Types

type EtcdClientImpl

type EtcdClientImpl struct {
	// contains filtered or unexported fields
}

func NewEtcdClientImpl

func NewEtcdClientImpl() (cliimpl *EtcdClientImpl, err error)

type RegisterResp

type RegisterResp struct {
	RespCode             string   `protobuf:"bytes,1,opt,name=respCode,proto3" json:"respCode,omitempty"`
	RespMsg              string   `protobuf:"bytes,2,opt,name=respMsg,proto3" json:"respMsg,omitempty"`
	Isok                 bool     `protobuf:"varint,3,opt,name=isok,proto3" json:"isok,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RegisterResp) Descriptor

func (*RegisterResp) Descriptor() ([]byte, []int)

func (*RegisterResp) GetIsok

func (m *RegisterResp) GetIsok() bool

func (*RegisterResp) GetRespCode

func (m *RegisterResp) GetRespCode() string

func (*RegisterResp) GetRespMsg

func (m *RegisterResp) GetRespMsg() string

func (*RegisterResp) ProtoMessage

func (*RegisterResp) ProtoMessage()

func (*RegisterResp) Reset

func (m *RegisterResp) Reset()

func (*RegisterResp) String

func (m *RegisterResp) String() string

func (*RegisterResp) XXX_DiscardUnknown

func (m *RegisterResp) XXX_DiscardUnknown()

func (*RegisterResp) XXX_Marshal

func (m *RegisterResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RegisterResp) XXX_Merge

func (m *RegisterResp) XXX_Merge(src proto.Message)

func (*RegisterResp) XXX_Size

func (m *RegisterResp) XXX_Size() int

func (*RegisterResp) XXX_Unmarshal

func (m *RegisterResp) XXX_Unmarshal(b []byte) error

type ScConfigServiceClient

type ScConfigServiceClient interface {
	// 注册
	Register(ctx context.Context, in *SimpleServiceInfo, opts ...grpc.CallOption) (*RegisterResp, error)
	UnRegister(ctx context.Context, in *SimpleServiceInfo, opts ...grpc.CallOption) (*RegisterResp, error)
	// 停止服务
	StopService(ctx context.Context, in *StopReq, opts ...grpc.CallOption) (*ServiceMsgResp, error)
}

ScConfigServiceClient is the client API for ScConfigService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewScConfigServiceClient

func NewScConfigServiceClient(cc *grpc.ClientConn) ScConfigServiceClient

type ScConfigServiceServer

type ScConfigServiceServer interface {
	// 注册
	Register(context.Context, *SimpleServiceInfo) (*RegisterResp, error)
	UnRegister(context.Context, *SimpleServiceInfo) (*RegisterResp, error)
	// 停止服务
	StopService(context.Context, *StopReq) (*ServiceMsgResp, error)
}

ScConfigServiceServer is the server API for ScConfigService service.

type ServiceCenter

type ServiceCenter interface {
	// contains filtered or unexported methods
}

type ServiceMsgResp

type ServiceMsgResp struct {
	Isok                 bool     `protobuf:"varint,1,opt,name=isok,proto3" json:"isok,omitempty"`
	RespCode             string   `protobuf:"bytes,2,opt,name=respCode,proto3" json:"respCode,omitempty"`
	RespMsg              string   `protobuf:"bytes,3,opt,name=respMsg,proto3" json:"respMsg,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

通用简单的 消息返回

func (*ServiceMsgResp) Descriptor

func (*ServiceMsgResp) Descriptor() ([]byte, []int)

func (*ServiceMsgResp) GetIsok

func (m *ServiceMsgResp) GetIsok() bool

func (*ServiceMsgResp) GetRespCode

func (m *ServiceMsgResp) GetRespCode() string

func (*ServiceMsgResp) GetRespMsg

func (m *ServiceMsgResp) GetRespMsg() string

func (*ServiceMsgResp) ProtoMessage

func (*ServiceMsgResp) ProtoMessage()

func (*ServiceMsgResp) Reset

func (m *ServiceMsgResp) Reset()

func (*ServiceMsgResp) String

func (m *ServiceMsgResp) String() string

func (*ServiceMsgResp) XXX_DiscardUnknown

func (m *ServiceMsgResp) XXX_DiscardUnknown()

func (*ServiceMsgResp) XXX_Marshal

func (m *ServiceMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ServiceMsgResp) XXX_Merge

func (m *ServiceMsgResp) XXX_Merge(src proto.Message)

func (*ServiceMsgResp) XXX_Size

func (m *ServiceMsgResp) XXX_Size() int

func (*ServiceMsgResp) XXX_Unmarshal

func (m *ServiceMsgResp) XXX_Unmarshal(b []byte) error

type SimpleServiceInfo

type SimpleServiceInfo struct {
	Id   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Msg  string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
	// 服务名称
	Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
	// 服务描述
	Describe string `protobuf:"bytes,5,opt,name=describe,proto3" json:"describe,omitempty"`
	Address  string `protobuf:"bytes,6,opt,name=address,proto3" json:"address,omitempty"`
	//    int类型 只有 32或者64.
	//    int32, int64
	Port                 int32    `protobuf:"varint,7,opt,name=port,proto3" json:"port,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SimpleServiceInfo) Descriptor

func (*SimpleServiceInfo) Descriptor() ([]byte, []int)

func (*SimpleServiceInfo) GetAddress

func (m *SimpleServiceInfo) GetAddress() string

func (*SimpleServiceInfo) GetCode

func (m *SimpleServiceInfo) GetCode() string

func (*SimpleServiceInfo) GetDescribe

func (m *SimpleServiceInfo) GetDescribe() string

func (*SimpleServiceInfo) GetId

func (m *SimpleServiceInfo) GetId() string

func (*SimpleServiceInfo) GetMsg

func (m *SimpleServiceInfo) GetMsg() string

func (*SimpleServiceInfo) GetName

func (m *SimpleServiceInfo) GetName() string

func (*SimpleServiceInfo) GetPort

func (m *SimpleServiceInfo) GetPort() int32

func (*SimpleServiceInfo) ProtoMessage

func (*SimpleServiceInfo) ProtoMessage()

func (*SimpleServiceInfo) Reset

func (m *SimpleServiceInfo) Reset()

func (*SimpleServiceInfo) String

func (m *SimpleServiceInfo) String() string

func (*SimpleServiceInfo) XXX_DiscardUnknown

func (m *SimpleServiceInfo) XXX_DiscardUnknown()

func (*SimpleServiceInfo) XXX_Marshal

func (m *SimpleServiceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SimpleServiceInfo) XXX_Merge

func (m *SimpleServiceInfo) XXX_Merge(src proto.Message)

func (*SimpleServiceInfo) XXX_Size

func (m *SimpleServiceInfo) XXX_Size() int

func (*SimpleServiceInfo) XXX_Unmarshal

func (m *SimpleServiceInfo) XXX_Unmarshal(b []byte) error

type StopReq

type StopReq struct {
	ServiceId            string   `protobuf:"bytes,1,opt,name=serviceId,proto3" json:"serviceId,omitempty"`
	TestMsg              string   `protobuf:"bytes,2,opt,name=testMsg,proto3" json:"testMsg,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StopReq) Descriptor

func (*StopReq) Descriptor() ([]byte, []int)

func (*StopReq) GetServiceId

func (m *StopReq) GetServiceId() string

func (*StopReq) GetTestMsg

func (m *StopReq) GetTestMsg() string

func (*StopReq) ProtoMessage

func (*StopReq) ProtoMessage()

func (*StopReq) Reset

func (m *StopReq) Reset()

func (*StopReq) String

func (m *StopReq) String() string

func (*StopReq) XXX_DiscardUnknown

func (m *StopReq) XXX_DiscardUnknown()

func (*StopReq) XXX_Marshal

func (m *StopReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StopReq) XXX_Merge

func (m *StopReq) XXX_Merge(src proto.Message)

func (*StopReq) XXX_Size

func (m *StopReq) XXX_Size() int

func (*StopReq) XXX_Unmarshal

func (m *StopReq) XXX_Unmarshal(b []byte) error

type UnimplementedScConfigServiceServer

type UnimplementedScConfigServiceServer struct {
}

UnimplementedScConfigServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedScConfigServiceServer) Register

func (*UnimplementedScConfigServiceServer) StopService

func (*UnimplementedScConfigServiceServer) UnRegister

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL