pbgate

package
v0.0.0-...-d47803c Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthGate        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGate          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGate = fmt.Errorf("proto: unexpected end of group")
)
View Source
var Cmd_name = map[int32]string{
	0: "SerializeNone",
	1: "JSON",
	2: "ProtoBuffer",
}
View Source
var Cmd_value = map[string]int32{
	"SerializeNone": 0,
	"JSON":          1,
	"ProtoBuffer":   2,
}
View Source
var SendMsgDataReplyCodeType_name = map[int32]string{
	0:   "Code_None",
	200: "Success",
}
View Source
var SendMsgDataReplyCodeType_value = map[string]int32{
	"Code_None": 0,
	"Success":   200,
}
View Source
var SendMsgDataToType_name = map[int32]string{
	0: "To_None",
	1: "To_Conn",
	2: "To_All",
}
View Source
var SendMsgDataToType_value = map[string]int32{
	"To_None": 0,
	"To_Conn": 1,
	"To_All":  2,
}

Functions

func NewXClientForGate

func NewXClientForGate(addr string) (client.XClient, error)

NewXClientForGate creates a XClient. You can configure this client with more options such as etcd registry, serialize type, select algorithm and fail mode.

func ServeForGate

func ServeForGate(addr string) error

ServeForGate starts a server only registers one service. You can register more services and only start one server. It blocks until the application exits.

Types

type Cmd

type Cmd int32
const (
	Cmd_SerializeNone Cmd = 0
	Cmd_JSON          Cmd = 1
	Cmd_ProtoBuffer   Cmd = 2
)

func (Cmd) EnumDescriptor

func (Cmd) EnumDescriptor() ([]byte, []int)

func (Cmd) String

func (x Cmd) String() string

type GateAble

type GateAble interface {

	// SendMsg is server rpc method as defined
	SendMsg(ctx context.Context, args *SendMsgData, reply *SendMsgDataReply) (err error)
}

================== interface skeleton ===================

type GateClient

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

================== client stub =================== Gate is a client wrapped XClient.

func NewGateClient

func NewGateClient(xclient client.XClient) *GateClient

NewGateClient wraps a XClient as GateClient. You can pass a shared XClient object created by NewXClientForGate.

func (*GateClient) SendMsg

func (c *GateClient) SendMsg(ctx context.Context, args *SendMsgData) (reply *SendMsgDataReply, err error)

SendMsg is client rpc method as defined

type GateImpl

type GateImpl struct{}

================== server skeleton ===================

func (*GateImpl) SendMsg

func (s *GateImpl) SendMsg(ctx context.Context, args *SendMsgData, reply *SendMsgDataReply) (err error)

SendMsg is server rpc method as defined

type GateOneClient

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

================== oneclient stub =================== GateOneClient is a client wrapped oneClient.

func NewGateOneClient

func NewGateOneClient(oneclient *client.OneClient) *GateOneClient

NewGateOneClient wraps a OneClient as GateOneClient. You can pass a shared OneClient object created by NewOneClientForGate.

func (*GateOneClient) SendMsg

func (c *GateOneClient) SendMsg(ctx context.Context, args *SendMsgData) (reply *SendMsgDataReply, err error)

SendMsg is client rpc method as defined

type SendMsgData

type SendMsgData struct {
	To                   int64             `protobuf:"varint,1,opt,name=to,proto3" json:"to,omitempty"`
	Type                 SendMsgDataToType `protobuf:"varint,2,opt,name=type,proto3,enum=pbgate.SendMsgDataToType" json:"type,omitempty"`
	DataJson             []byte            `protobuf:"bytes,4,opt,name=dataJson,proto3" json:"dataJson,omitempty"`
	DataProto            []byte            `protobuf:"bytes,5,opt,name=dataProto,proto3" json:"dataProto,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*SendMsgData) Descriptor

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

func (*SendMsgData) GetDataJson

func (m *SendMsgData) GetDataJson() []byte

func (*SendMsgData) GetDataProto

func (m *SendMsgData) GetDataProto() []byte

func (*SendMsgData) GetTo

func (m *SendMsgData) GetTo() int64

func (*SendMsgData) GetType

func (m *SendMsgData) GetType() SendMsgDataToType

func (*SendMsgData) Marshal

func (m *SendMsgData) Marshal() (dAtA []byte, err error)

func (*SendMsgData) MarshalTo

func (m *SendMsgData) MarshalTo(dAtA []byte) (int, error)

func (*SendMsgData) MarshalToSizedBuffer

func (m *SendMsgData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SendMsgData) ProtoMessage

func (*SendMsgData) ProtoMessage()

func (*SendMsgData) Reset

func (m *SendMsgData) Reset()

func (*SendMsgData) Size

func (m *SendMsgData) Size() (n int)

func (*SendMsgData) String

func (m *SendMsgData) String() string

func (*SendMsgData) Unmarshal

func (m *SendMsgData) Unmarshal(dAtA []byte) error

func (*SendMsgData) XXX_DiscardUnknown

func (m *SendMsgData) XXX_DiscardUnknown()

func (*SendMsgData) XXX_Marshal

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

func (*SendMsgData) XXX_Merge

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

func (*SendMsgData) XXX_Size

func (m *SendMsgData) XXX_Size() int

func (*SendMsgData) XXX_Unmarshal

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

type SendMsgDataReply

type SendMsgDataReply struct {
	Code                 SendMsgDataReplyCodeType `protobuf:"varint,1,opt,name=code,proto3,enum=pbgate.SendMsgDataReplyCodeType" json:"code,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                 `json:"-"`
	XXX_unrecognized     []byte                   `json:"-"`
	XXX_sizecache        int32                    `json:"-"`
}

func (*SendMsgDataReply) Descriptor

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

func (*SendMsgDataReply) GetCode

func (*SendMsgDataReply) Marshal

func (m *SendMsgDataReply) Marshal() (dAtA []byte, err error)

func (*SendMsgDataReply) MarshalTo

func (m *SendMsgDataReply) MarshalTo(dAtA []byte) (int, error)

func (*SendMsgDataReply) MarshalToSizedBuffer

func (m *SendMsgDataReply) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SendMsgDataReply) ProtoMessage

func (*SendMsgDataReply) ProtoMessage()

func (*SendMsgDataReply) Reset

func (m *SendMsgDataReply) Reset()

func (*SendMsgDataReply) Size

func (m *SendMsgDataReply) Size() (n int)

func (*SendMsgDataReply) String

func (m *SendMsgDataReply) String() string

func (*SendMsgDataReply) Unmarshal

func (m *SendMsgDataReply) Unmarshal(dAtA []byte) error

func (*SendMsgDataReply) XXX_DiscardUnknown

func (m *SendMsgDataReply) XXX_DiscardUnknown()

func (*SendMsgDataReply) XXX_Marshal

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

func (*SendMsgDataReply) XXX_Merge

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

func (*SendMsgDataReply) XXX_Size

func (m *SendMsgDataReply) XXX_Size() int

func (*SendMsgDataReply) XXX_Unmarshal

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

type SendMsgDataReplyCodeType

type SendMsgDataReplyCodeType int32
const (
	SendMsgDataReply_Code_None SendMsgDataReplyCodeType = 0
	SendMsgDataReply_Success   SendMsgDataReplyCodeType = 200
)

func (SendMsgDataReplyCodeType) EnumDescriptor

func (SendMsgDataReplyCodeType) EnumDescriptor() ([]byte, []int)

func (SendMsgDataReplyCodeType) String

func (x SendMsgDataReplyCodeType) String() string

type SendMsgDataToType

type SendMsgDataToType int32
const (
	SendMsgData_To_None SendMsgDataToType = 0
	SendMsgData_To_Conn SendMsgDataToType = 1
	SendMsgData_To_All  SendMsgDataToType = 2
)

func (SendMsgDataToType) EnumDescriptor

func (SendMsgDataToType) EnumDescriptor() ([]byte, []int)

func (SendMsgDataToType) String

func (x SendMsgDataToType) String() string

Jump to

Keyboard shortcuts

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