|
|
- // Code generated by protoc-gen-go.
- // source: mastermsg.proto
- // DO NOT EDIT!
-
- /*
- Package mastermsg is a generated protocol buffer package.
-
- It is generated from these files:
- mastermsg.proto
-
- It has these top-level messages:
- EventRequest
- EventResponse
- */
- package mastermsg
-
- import proto "github.com/chai2010/protorpc/proto"
- import math "math"
-
- import "io"
- import "log"
- import "net"
- import "net/rpc"
- import "time"
- import protorpc "github.com/chai2010/protorpc"
-
- // Reference imports to suppress errors if they are not otherwise used.
- var _ = proto.Marshal
- var _ = math.Inf
-
- // 算术运算请求结构
- type EventRequest struct {
- SiteId *string `protobuf:"bytes,1,opt,name=site_id" json:"site_id,omitempty"`
- Domainname *string `protobuf:"bytes,2,opt,name=domainname" json:"domainname,omitempty"`
- Type *string `protobuf:"bytes,3,opt,name=type" json:"type,omitempty"`
- Memo *string `protobuf:"bytes,4,opt,name=memo" json:"memo,omitempty"`
- Data *string `protobuf:"bytes,5,opt,name=data" json:"data,omitempty"`
- XXX_unrecognized []byte `json:"-"`
- }
-
- func (m *EventRequest) Reset() { *m = EventRequest{} }
- func (m *EventRequest) String() string { return proto.CompactTextString(m) }
- func (*EventRequest) ProtoMessage() {}
-
- func (m *EventRequest) GetSiteId() string {
- if m != nil && m.SiteId != nil {
- return *m.SiteId
- }
- return ""
- }
-
- func (m *EventRequest) GetDomainname() string {
- if m != nil && m.Domainname != nil {
- return *m.Domainname
- }
- return ""
- }
-
- func (m *EventRequest) GetType() string {
- if m != nil && m.Type != nil {
- return *m.Type
- }
- return ""
- }
-
- func (m *EventRequest) GetMemo() string {
- if m != nil && m.Memo != nil {
- return *m.Memo
- }
- return ""
- }
-
- func (m *EventRequest) GetData() string {
- if m != nil && m.Data != nil {
- return *m.Data
- }
- return ""
- }
-
- // 算术运算响应结构
- type EventResponse struct {
- EventId *string `protobuf:"bytes,1,opt,name=event_id" json:"event_id,omitempty"`
- XXX_unrecognized []byte `json:"-"`
- }
-
- func (m *EventResponse) Reset() { *m = EventResponse{} }
- func (m *EventResponse) String() string { return proto.CompactTextString(m) }
- func (*EventResponse) ProtoMessage() {}
-
- func (m *EventResponse) GetEventId() string {
- if m != nil && m.EventId != nil {
- return *m.EventId
- }
- return ""
- }
-
- func init() {
- }
-
- type MsgService interface {
- SendEvent(in *EventRequest, out *EventResponse) error
- }
-
- // AcceptMsgServiceClient accepts connections on the listener and serves requests
- // for each incoming connection. Accept blocks; the caller typically
- // invokes it in a go statement.
- func AcceptMsgServiceClient(lis net.Listener, x MsgService) {
- srv := rpc.NewServer()
- if err := srv.RegisterName("MsgService", x); err != nil {
- log.Fatal(err)
- }
-
- for {
- conn, err := lis.Accept()
- if err != nil {
- log.Fatalf("lis.Accept(): %v\n", err)
- }
- go srv.ServeCodec(protorpc.NewServerCodec(conn))
- }
- }
-
- // RegisterMsgService publish the given MsgService implementation on the server.
- func RegisterMsgService(srv *rpc.Server, x MsgService) error {
- if err := srv.RegisterName("MsgService", x); err != nil {
- return err
- }
- return nil
- }
-
- // NewMsgServiceServer returns a new MsgService Server.
- func NewMsgServiceServer(x MsgService) *rpc.Server {
- srv := rpc.NewServer()
- if err := srv.RegisterName("MsgService", x); err != nil {
- log.Fatal(err)
- }
- return srv
- }
-
- // ListenAndServeMsgService listen announces on the local network address laddr
- // and serves the given MsgService implementation.
- func ListenAndServeMsgService(network, addr string, x MsgService) error {
- lis, err := net.Listen(network, addr)
- if err != nil {
- return err
- }
- defer lis.Close()
-
- srv := rpc.NewServer()
- if err := srv.RegisterName("MsgService", x); err != nil {
- return err
- }
-
- for {
- conn, err := lis.Accept()
- if err != nil {
- log.Fatalf("lis.Accept(): %v\n", err)
- }
- go srv.ServeCodec(protorpc.NewServerCodec(conn))
- }
- }
-
- type MsgServiceClient struct {
- *rpc.Client
- }
-
- // NewMsgServiceClient returns a MsgService rpc.Client and stub to handle
- // requests to the set of MsgService at the other end of the connection.
- func NewMsgServiceClient(conn io.ReadWriteCloser) (*MsgServiceClient, *rpc.Client) {
- c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
- return &MsgServiceClient{c}, c
- }
-
- func (c *MsgServiceClient) SendEvent(in *EventRequest, out *EventResponse) error {
- return c.Call("MsgService.SendEvent", in, out)
- }
-
- // DialMsgService connects to an MsgService at the specified network address.
- func DialMsgService(network, addr string) (*MsgServiceClient, *rpc.Client, error) {
- c, err := protorpc.Dial(network, addr)
- if err != nil {
- return nil, nil, err
- }
- return &MsgServiceClient{c}, c, nil
- }
-
- // DialMsgServiceTimeout connects to an MsgService at the specified network address.
- func DialMsgServiceTimeout(network, addr string,
- timeout time.Duration) (*MsgServiceClient, *rpc.Client, error) {
- c, err := protorpc.DialTimeout(network, addr, timeout)
- if err != nil {
- return nil, nil, err
- }
- return &MsgServiceClient{c}, c, nil
- }
|