service

package
v0.12.26 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const C_EchoRequest int64 = 1904100324
View Source
const C_EchoResponse int64 = 4192619139
View Source
const C_GetRequest int64 = 3359917651
View Source
const C_GetResponse int64 = 2891601577
View Source
const C_Message1 int64 = 3131464828
View Source
const C_Message2 int64 = 598674886
View Source
const C_SampleEcho int64 = 3852587671
View Source
const C_SampleEchoDelay int64 = 1737692531
View Source
const C_SampleEchoInternal int64 = 3655883317
View Source
const C_SampleEchoTunnel int64 = 2071541407
View Source
const C_SampleGet int64 = 987350307
View Source
const C_SampleSet int64 = 569822863
View Source
const C_SetRequest int64 = 3858851777
View Source
const C_SetResponse int64 = 2994069984

Variables

View Source
var EchoRest = edge.NewRestProxy(
	func(conn rony.RestConn, ctx *edge.DispatchCtx) error {
		req := &EchoRequest{}
		err := req.UnmarshalJSON(conn.Body())
		if err != nil {
			return err
		}
		ctx.FillEnvelope(conn.ConnID(), C_SampleEcho, req)
		return nil
	},
	func(conn rony.RestConn, ctx *edge.DispatchCtx) (err error) {
		if !ctx.BufferPop(func(envelope *rony.MessageEnvelope) {
			switch envelope.Constructor {
			case C_EchoResponse:
				x := &EchoResponse{}
				_ = x.Unmarshal(envelope.Message)
				var b []byte
				b, err = x.MarshalJSON()
				if err != nil {
					return
				}
				err = conn.WriteBinary(ctx.StreamID(), b)
			case rony.C_Error:
				x := &rony.Error{}
				_ = x.Unmarshal(envelope.Message)
				err = x
			}
			err = errors.ErrUnexpectedResponse
		}) {
			err = errors.ErrInternalServer
		}

		return
	},
)
View Source
var EchoRestBinding = edge.NewRestProxy(
	func(conn rony.RestConn, ctx *edge.DispatchCtx) error {
		req := &EchoRequest{}
		req.Int = tools.StrToInt64(tools.GetString(conn.Get("value"), "0"))
		req.Timestamp = tools.StrToInt64(tools.GetString(conn.Get("ts"), "0"))
		ctx.FillEnvelope(conn.ConnID(), C_SampleEcho, req)
		return nil
	},
	func(conn rony.RestConn, ctx *edge.DispatchCtx) (err error) {
		if !ctx.BufferPop(func(envelope *rony.MessageEnvelope) {
			switch envelope.Constructor {
			case C_EchoResponse:
				x := &EchoResponse{}
				_ = x.Unmarshal(envelope.Message)
				var b []byte
				b, err = x.MarshalJSON()
				if err != nil {
					return
				}
				err = conn.WriteBinary(ctx.StreamID(), b)
				return
			case rony.C_Error:
				x := &rony.Error{}
				_ = x.Unmarshal(envelope.Message)
				err = x
			}
			err = errors.ErrUnexpectedResponse
		}) {
			err = errors.ErrInternalServer
		}

		return
	},
)
View Source
var File_service_proto protoreflect.FileDescriptor
View Source
var PoolEchoRequest = poolEchoRequest{}
View Source
var PoolEchoResponse = poolEchoResponse{}
View Source
var PoolGetRequest = poolGetRequest{}
View Source
var PoolGetResponse = poolGetResponse{}
View Source
var PoolMessage1 = poolMessage1{}
View Source
var PoolMessage2 = poolMessage2{}
View Source
var PoolSetRequest = poolSetRequest{}
View Source
var PoolSetResponse = poolSetResponse{}

Functions

func RegisterSample

func RegisterSample(h ISample, e *edge.Server, preHandlers ...edge.Handler)

func RegisterSampleCli added in v0.2.9

func RegisterSampleCli(h ISampleCli, c edgec.Client, rootCmd *cobra.Command)

func RegisterSampleWithFunc added in v0.6.4

func RegisterSampleWithFunc(h ISample, e *edge.Server, handlerFunc func(c int64) []edge.Handler)

func TunnelRequestEcho added in v0.12.30

func TunnelRequestEcho(ctx *edge.RequestCtx, replicaSet uint64, req *EchoRequest, res *EchoResponse, kvs ...*rony.KeyValue) error

func TunnelRequestEchoDelay added in v0.12.30

func TunnelRequestEchoDelay(ctx *edge.RequestCtx, replicaSet uint64, req *EchoRequest, res *EchoResponse, kvs ...*rony.KeyValue) error

func TunnelRequestEchoInternal added in v0.12.30

func TunnelRequestEchoInternal(ctx *edge.RequestCtx, replicaSet uint64, req *EchoRequest, res *EchoResponse, kvs ...*rony.KeyValue) error

func TunnelRequestEchoTunnel added in v0.12.30

func TunnelRequestEchoTunnel(ctx *edge.RequestCtx, replicaSet uint64, req *EchoRequest, res *EchoResponse, kvs ...*rony.KeyValue) error

func TunnelRequestGet added in v0.12.30

func TunnelRequestGet(ctx *edge.RequestCtx, replicaSet uint64, req *GetRequest, res *GetResponse, kvs ...*rony.KeyValue) error

func TunnelRequestSet added in v0.12.30

func TunnelRequestSet(ctx *edge.RequestCtx, replicaSet uint64, req *SetRequest, res *SetResponse, kvs ...*rony.KeyValue) error

Types

type EchoRequest

type EchoRequest struct {
	Int        int64  `protobuf:"varint,1,opt,name=Int,proto3" json:"Int,omitempty"`
	Timestamp  int64  `protobuf:"varint,3,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"`
	ReplicaSet uint64 `protobuf:"varint,4,opt,name=ReplicaSet,proto3" json:"ReplicaSet,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoRequest) Clone added in v0.12.0

func (x *EchoRequest) Clone() *EchoRequest

func (*EchoRequest) DeepCopy

func (x *EchoRequest) DeepCopy(z *EchoRequest)

func (*EchoRequest) Descriptor deprecated

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

Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead.

func (*EchoRequest) GetInt

func (x *EchoRequest) GetInt() int64

func (*EchoRequest) GetReplicaSet

func (x *EchoRequest) GetReplicaSet() uint64

func (*EchoRequest) GetTimestamp

func (x *EchoRequest) GetTimestamp() int64

func (*EchoRequest) Marshal

func (x *EchoRequest) Marshal() ([]byte, error)

func (*EchoRequest) MarshalJSON added in v0.10.3

func (x *EchoRequest) MarshalJSON() ([]byte, error)

func (*EchoRequest) ProtoMessage

func (*EchoRequest) ProtoMessage()

func (*EchoRequest) ProtoReflect

func (x *EchoRequest) ProtoReflect() protoreflect.Message

func (*EchoRequest) PushToContext

func (x *EchoRequest) PushToContext(ctx *edge.RequestCtx)

func (*EchoRequest) Reset

func (x *EchoRequest) Reset()

func (*EchoRequest) String

func (x *EchoRequest) String() string

func (*EchoRequest) Unmarshal

func (x *EchoRequest) Unmarshal(b []byte) error

func (*EchoRequest) UnmarshalJSON added in v0.10.3

func (x *EchoRequest) UnmarshalJSON(b []byte) error

type EchoResponse

type EchoResponse struct {
	Int       int64  `protobuf:"varint,1,opt,name=Int,proto3" json:"Int,omitempty"`
	Responder string `protobuf:"bytes,2,opt,name=Responder,proto3" json:"Responder,omitempty"`
	Timestamp int64  `protobuf:"varint,4,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"`
	Delay     int64  `protobuf:"varint,5,opt,name=Delay,proto3" json:"Delay,omitempty"`
	ServerID  string `protobuf:"bytes,6,opt,name=ServerID,proto3" json:"ServerID,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoResponse) Clone added in v0.12.0

func (x *EchoResponse) Clone() *EchoResponse

func (*EchoResponse) DeepCopy

func (x *EchoResponse) DeepCopy(z *EchoResponse)

func (*EchoResponse) Descriptor deprecated

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

Deprecated: Use EchoResponse.ProtoReflect.Descriptor instead.

func (*EchoResponse) GetDelay

func (x *EchoResponse) GetDelay() int64

func (*EchoResponse) GetInt

func (x *EchoResponse) GetInt() int64

func (*EchoResponse) GetResponder

func (x *EchoResponse) GetResponder() string

func (*EchoResponse) GetServerID

func (x *EchoResponse) GetServerID() string

func (*EchoResponse) GetTimestamp

func (x *EchoResponse) GetTimestamp() int64

func (*EchoResponse) Marshal

func (x *EchoResponse) Marshal() ([]byte, error)

func (*EchoResponse) MarshalJSON added in v0.10.3

func (x *EchoResponse) MarshalJSON() ([]byte, error)

func (*EchoResponse) ProtoMessage

func (*EchoResponse) ProtoMessage()

func (*EchoResponse) ProtoReflect

func (x *EchoResponse) ProtoReflect() protoreflect.Message

func (*EchoResponse) PushToContext

func (x *EchoResponse) PushToContext(ctx *edge.RequestCtx)

func (*EchoResponse) Reset

func (x *EchoResponse) Reset()

func (*EchoResponse) String

func (x *EchoResponse) String() string

func (*EchoResponse) Unmarshal

func (x *EchoResponse) Unmarshal(b []byte) error

func (*EchoResponse) UnmarshalJSON added in v0.10.3

func (x *EchoResponse) UnmarshalJSON(b []byte) error

type GetRequest added in v0.7.2

type GetRequest struct {
	Key []byte `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRequest) Clone added in v0.12.0

func (x *GetRequest) Clone() *GetRequest

func (*GetRequest) DeepCopy added in v0.7.2

func (x *GetRequest) DeepCopy(z *GetRequest)

func (*GetRequest) Descriptor deprecated added in v0.7.2

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetKey added in v0.7.2

func (x *GetRequest) GetKey() []byte

func (*GetRequest) Marshal added in v0.7.2

func (x *GetRequest) Marshal() ([]byte, error)

func (*GetRequest) MarshalJSON added in v0.10.3

func (x *GetRequest) MarshalJSON() ([]byte, error)

func (*GetRequest) ProtoMessage added in v0.7.2

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect added in v0.7.2

func (x *GetRequest) ProtoReflect() protoreflect.Message

func (*GetRequest) PushToContext added in v0.7.2

func (x *GetRequest) PushToContext(ctx *edge.RequestCtx)

func (*GetRequest) Reset added in v0.7.2

func (x *GetRequest) Reset()

func (*GetRequest) String added in v0.7.2

func (x *GetRequest) String() string

func (*GetRequest) Unmarshal added in v0.7.2

func (x *GetRequest) Unmarshal(b []byte) error

func (*GetRequest) UnmarshalJSON added in v0.10.3

func (x *GetRequest) UnmarshalJSON(b []byte) error

type GetResponse added in v0.7.2

type GetResponse struct {
	Key   []byte `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=Value,proto3" json:"Value,omitempty"`
	// contains filtered or unexported fields
}

func (*GetResponse) Clone added in v0.12.0

func (x *GetResponse) Clone() *GetResponse

func (*GetResponse) DeepCopy added in v0.7.2

func (x *GetResponse) DeepCopy(z *GetResponse)

func (*GetResponse) Descriptor deprecated added in v0.7.2

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

Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.

func (*GetResponse) GetKey added in v0.7.2

func (x *GetResponse) GetKey() []byte

func (*GetResponse) GetValue added in v0.7.2

func (x *GetResponse) GetValue() []byte

func (*GetResponse) Marshal added in v0.7.2

func (x *GetResponse) Marshal() ([]byte, error)

func (*GetResponse) MarshalJSON added in v0.10.3

func (x *GetResponse) MarshalJSON() ([]byte, error)

func (*GetResponse) ProtoMessage added in v0.7.2

func (*GetResponse) ProtoMessage()

func (*GetResponse) ProtoReflect added in v0.7.2

func (x *GetResponse) ProtoReflect() protoreflect.Message

func (*GetResponse) PushToContext added in v0.7.2

func (x *GetResponse) PushToContext(ctx *edge.RequestCtx)

func (*GetResponse) Reset added in v0.7.2

func (x *GetResponse) Reset()

func (*GetResponse) String added in v0.7.2

func (x *GetResponse) String() string

func (*GetResponse) Unmarshal added in v0.7.2

func (x *GetResponse) Unmarshal(b []byte) error

func (*GetResponse) UnmarshalJSON added in v0.10.3

func (x *GetResponse) UnmarshalJSON(b []byte) error

type ISample

type ISample interface {
	Echo(ctx *edge.RequestCtx, req *EchoRequest, res *EchoResponse)
	Set(ctx *edge.RequestCtx, req *SetRequest, res *SetResponse)
	Get(ctx *edge.RequestCtx, req *GetRequest, res *GetResponse)
	EchoTunnel(ctx *edge.RequestCtx, req *EchoRequest, res *EchoResponse)
	EchoInternal(ctx *edge.RequestCtx, req *EchoRequest, res *EchoResponse)
	EchoDelay(ctx *edge.RequestCtx, req *EchoRequest, res *EchoResponse)
}

type ISampleCli added in v0.2.9

type ISampleCli interface {
	Echo(cli *SampleClient, cmd *cobra.Command, args []string) error
	Set(cli *SampleClient, cmd *cobra.Command, args []string) error
	Get(cli *SampleClient, cmd *cobra.Command, args []string) error
	EchoTunnel(cli *SampleClient, cmd *cobra.Command, args []string) error
	EchoDelay(cli *SampleClient, cmd *cobra.Command, args []string) error
}

type Message1

type Message1 struct {
	Param1 int64       `protobuf:"varint,1,opt,name=Param1,proto3" json:"Param1,omitempty"`
	Param2 string      `protobuf:"bytes,2,opt,name=Param2,proto3" json:"Param2,omitempty"`
	M2     *Message2   `protobuf:"bytes,3,opt,name=M2,proto3" json:"M2,omitempty"`
	M2S    []*Message2 `protobuf:"bytes,4,rep,name=M2S,proto3" json:"M2S,omitempty"`
	// contains filtered or unexported fields
}

func (*Message1) Clone added in v0.12.0

func (x *Message1) Clone() *Message1

func (*Message1) DeepCopy

func (x *Message1) DeepCopy(z *Message1)

func (*Message1) Descriptor deprecated

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

Deprecated: Use Message1.ProtoReflect.Descriptor instead.

func (*Message1) GetM2

func (x *Message1) GetM2() *Message2

func (*Message1) GetM2S

func (x *Message1) GetM2S() []*Message2

func (*Message1) GetParam1

func (x *Message1) GetParam1() int64

func (*Message1) GetParam2

func (x *Message1) GetParam2() string

func (*Message1) Marshal

func (x *Message1) Marshal() ([]byte, error)

func (*Message1) MarshalJSON added in v0.10.3

func (x *Message1) MarshalJSON() ([]byte, error)

func (*Message1) ProtoMessage

func (*Message1) ProtoMessage()

func (*Message1) ProtoReflect

func (x *Message1) ProtoReflect() protoreflect.Message

func (*Message1) PushToContext

func (x *Message1) PushToContext(ctx *edge.RequestCtx)

func (*Message1) Reset

func (x *Message1) Reset()

func (*Message1) String

func (x *Message1) String() string

func (*Message1) Unmarshal

func (x *Message1) Unmarshal(b []byte) error

func (*Message1) UnmarshalJSON added in v0.10.3

func (x *Message1) UnmarshalJSON(b []byte) error

type Message2

type Message2 struct {
	Param1 uint32    `protobuf:"fixed32,1,opt,name=Param1,proto3" json:"Param1,omitempty"`
	P2     []byte    `protobuf:"bytes,2,opt,name=P2,proto3" json:"P2,omitempty"`
	P3     []int32   `protobuf:"varint,3,rep,packed,name=P3,proto3" json:"P3,omitempty"`
	M1     *Message1 `protobuf:"bytes,4,opt,name=M1,proto3" json:"M1,omitempty"`
	// contains filtered or unexported fields
}

func (*Message2) Clone added in v0.12.0

func (x *Message2) Clone() *Message2

func (*Message2) DeepCopy

func (x *Message2) DeepCopy(z *Message2)

func (*Message2) Descriptor deprecated

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

Deprecated: Use Message2.ProtoReflect.Descriptor instead.

func (*Message2) GetM1

func (x *Message2) GetM1() *Message1

func (*Message2) GetP2

func (x *Message2) GetP2() []byte

func (*Message2) GetP3

func (x *Message2) GetP3() []int32

func (*Message2) GetParam1

func (x *Message2) GetParam1() uint32

func (*Message2) Marshal

func (x *Message2) Marshal() ([]byte, error)

func (*Message2) MarshalJSON added in v0.10.3

func (x *Message2) MarshalJSON() ([]byte, error)

func (*Message2) ProtoMessage

func (*Message2) ProtoMessage()

func (*Message2) ProtoReflect

func (x *Message2) ProtoReflect() protoreflect.Message

func (*Message2) PushToContext

func (x *Message2) PushToContext(ctx *edge.RequestCtx)

func (*Message2) Reset

func (x *Message2) Reset()

func (*Message2) String

func (x *Message2) String() string

func (*Message2) Unmarshal

func (x *Message2) Unmarshal(b []byte) error

func (*Message2) UnmarshalJSON added in v0.10.3

func (x *Message2) UnmarshalJSON(b []byte) error

type Sample added in v0.10.3

type Sample struct {
	ServerID string
}

Sample implements ISample interface.

func (*Sample) Echo added in v0.10.3

func (h *Sample) Echo(ctx *edge.RequestCtx, req *EchoRequest, res *EchoResponse)

func (*Sample) EchoDelay added in v0.10.3

func (h *Sample) EchoDelay(ctx *edge.RequestCtx, req *EchoRequest, res *EchoResponse)

func (*Sample) EchoInternal added in v0.10.3

func (h *Sample) EchoInternal(ctx *edge.RequestCtx, req *EchoRequest, res *EchoResponse)

func (*Sample) EchoTunnel added in v0.10.3

func (h *Sample) EchoTunnel(ctx *edge.RequestCtx, req *EchoRequest, res *EchoResponse)

func (*Sample) Get added in v0.10.3

func (h *Sample) Get(ctx *edge.RequestCtx, req *GetRequest, res *GetResponse)

func (*Sample) Set added in v0.10.3

func (h *Sample) Set(ctx *edge.RequestCtx, req *SetRequest, res *SetResponse)

type SampleClient

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

func NewSampleClient

func NewSampleClient(ec edgec.Client) *SampleClient

func (*SampleClient) Echo

func (c *SampleClient) Echo(req *EchoRequest, kvs ...*rony.KeyValue) (*EchoResponse, error)

func (*SampleClient) EchoDelay

func (c *SampleClient) EchoDelay(req *EchoRequest, kvs ...*rony.KeyValue) (*EchoResponse, error)

func (*SampleClient) EchoTunnel

func (c *SampleClient) EchoTunnel(req *EchoRequest, kvs ...*rony.KeyValue) (*EchoResponse, error)

func (*SampleClient) Get added in v0.7.2

func (c *SampleClient) Get(req *GetRequest, kvs ...*rony.KeyValue) (*GetResponse, error)

func (*SampleClient) Set added in v0.7.2

func (c *SampleClient) Set(req *SetRequest, kvs ...*rony.KeyValue) (*SetResponse, error)

type SetRequest added in v0.7.2

type SetRequest struct {
	Key   []byte `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=Value,proto3" json:"Value,omitempty"`
	// contains filtered or unexported fields
}

func (*SetRequest) Clone added in v0.12.0

func (x *SetRequest) Clone() *SetRequest

func (*SetRequest) DeepCopy added in v0.7.2

func (x *SetRequest) DeepCopy(z *SetRequest)

func (*SetRequest) Descriptor deprecated added in v0.7.2

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

Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.

func (*SetRequest) GetKey added in v0.7.2

func (x *SetRequest) GetKey() []byte

func (*SetRequest) GetValue added in v0.7.2

func (x *SetRequest) GetValue() []byte

func (*SetRequest) Marshal added in v0.7.2

func (x *SetRequest) Marshal() ([]byte, error)

func (*SetRequest) MarshalJSON added in v0.10.3

func (x *SetRequest) MarshalJSON() ([]byte, error)

func (*SetRequest) ProtoMessage added in v0.7.2

func (*SetRequest) ProtoMessage()

func (*SetRequest) ProtoReflect added in v0.7.2

func (x *SetRequest) ProtoReflect() protoreflect.Message

func (*SetRequest) PushToContext added in v0.7.2

func (x *SetRequest) PushToContext(ctx *edge.RequestCtx)

func (*SetRequest) Reset added in v0.7.2

func (x *SetRequest) Reset()

func (*SetRequest) String added in v0.7.2

func (x *SetRequest) String() string

func (*SetRequest) Unmarshal added in v0.7.2

func (x *SetRequest) Unmarshal(b []byte) error

func (*SetRequest) UnmarshalJSON added in v0.10.3

func (x *SetRequest) UnmarshalJSON(b []byte) error

type SetResponse added in v0.7.2

type SetResponse struct {
	OK bool `protobuf:"varint,1,opt,name=OK,proto3" json:"OK,omitempty"`
	// contains filtered or unexported fields
}

func (*SetResponse) Clone added in v0.12.0

func (x *SetResponse) Clone() *SetResponse

func (*SetResponse) DeepCopy added in v0.7.2

func (x *SetResponse) DeepCopy(z *SetResponse)

func (*SetResponse) Descriptor deprecated added in v0.7.2

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

Deprecated: Use SetResponse.ProtoReflect.Descriptor instead.

func (*SetResponse) GetOK added in v0.7.2

func (x *SetResponse) GetOK() bool

func (*SetResponse) Marshal added in v0.7.2

func (x *SetResponse) Marshal() ([]byte, error)

func (*SetResponse) MarshalJSON added in v0.10.3

func (x *SetResponse) MarshalJSON() ([]byte, error)

func (*SetResponse) ProtoMessage added in v0.7.2

func (*SetResponse) ProtoMessage()

func (*SetResponse) ProtoReflect added in v0.7.2

func (x *SetResponse) ProtoReflect() protoreflect.Message

func (*SetResponse) PushToContext added in v0.7.2

func (x *SetResponse) PushToContext(ctx *edge.RequestCtx)

func (*SetResponse) Reset added in v0.7.2

func (x *SetResponse) Reset()

func (*SetResponse) String added in v0.7.2

func (x *SetResponse) String() string

func (*SetResponse) Unmarshal added in v0.7.2

func (x *SetResponse) Unmarshal(b []byte) error

func (*SetResponse) UnmarshalJSON added in v0.10.3

func (x *SetResponse) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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