rony

package module
v0.12.29 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: 17 Imported by: 23

README

Rony (Fast and Scalable RPC Framework)

GitHub release (latest SemVer including pre-releases)

About

Rony lets you create a clustered aware service easily. Checkout Wiki

Performance

Rony is very fast and with very low overhead. In a non-raft environment it adds < 25us latency, and in raft-enabled scenario around 1ms latency.

Rony has negligible memory footprint by reusing buffers and pooling.

BenchmarkEdgeServerMessageSerial
BenchmarkEdgeServerMessageSerial-16                       901370              1195 ns/op              87 B/op          2 allocs/op
BenchmarkEdgeServerMessageParallel
BenchmarkEdgeServerMessageParallel-16                    4521645               272 ns/op              83 B/op          2 allocs/op
BenchmarkEdgeServerWithRaftMessageSerial
BenchmarkEdgeServerWithRaftMessageSerial-16                 9541            132065 ns/op            5034 B/op        116 allocs/op
BenchmarkEdgeServerWithRaftMessageParallel
BenchmarkEdgeServerWithRaftMessageParallel-16             124658              8438 ns/op            4462 B/op         51 allocs/op

BenchmarkServerWithWebsocket-16            46514             25138 ns/op             691 B/op         19 allocs/op

Easy Setup for advanced scenarios
package main

import (
	"github.com/ronaksoft/rony"
	"github.com/ronaksoft/rony/edge"
	"os"
)

func main() {
	serverID := "UniqueServerID"
	edgeServer := edge.NewServer(serverID,
		edge.WithTcpGateway(edge.TcpGatewayConfig{
			Concurrency:   1000,
			MaxIdleTime:   0,
			ListenAddress: "0.0.0.0:80",
			ExternalAddrs: []string{"127.0.0.1:80"}, // ExternalAddr could be used when the server is behind proxy or nats
		}),
		edge.WithUdpTunnel(edge.UdpTunnelConfig{
			ListenAddress: "0.0.0.0:8080",
			MaxBodySize:   0,
			ExternalAddrs: nil,
		}),
		edge.WithGossipCluster(edge.GossipClusterConfig{
			Bootstrap:  true,
			ReplicaSet: 1,
			GossipPort: 7091,
		}),
	)

	service.RegisterSampleService(&service.SampleService{}, edgeServer)
	edgeServer.Start()

	edgeServer.ShutdownWithSignal(os.Kill)
}

This code does not run, please check example directory for working examples


Shoulders

Rony is made of big and popular packages. Without these great libraries building Rony was not possible.

Contribution

We need to make a clear and understandable documentation for Rony, so any help would be appreciated. We also appreciate benchmarking Rony against other platforms for common scenarios and will be cited.

TODOs
  • Auto-generate REST handlers
  • Auto-generate test units
  • Implement scenario tests using edgetest framework
  • Write Examples and Tutorials

Documentation

Index

Constants

View Source
const (
	MethodWild    = "*"
	MethodGet     = "GET"     // RFC 7231, 4.3.1
	MethodHead    = "HEAD"    // RFC 7231, 4.3.2
	MethodPost    = "POST"    // RFC 7231, 4.3.3
	MethodPut     = "PUT"     // RFC 7231, 4.3.4
	MethodPatch   = "PATCH"   // RFC 5789
	MethodDelete  = "DELETE"  // RFC 7231, 4.3.5
	MethodConnect = "CONNECT" // RFC 7231, 4.3.6
	MethodOptions = "OPTIONS" // RFC 7231, 4.3.7
	MethodTrace   = "TRACE"   // RFC 7231, 4.3.8
)

HTTP methods were copied from net/http.

View Source
const C_Edge int64 = 3576986712
View Source
const C_Edges int64 = 2120950449
View Source
const C_Error int64 = 2619118453
View Source
const C_GetAllNodes int64 = 3267106379
View Source
const C_GetNodes int64 = 362407405
View Source
const C_HttpBody int64 = 3032622721
View Source
const C_KeyValue int64 = 4276272820
View Source
const C_MessageContainer int64 = 1972016308
View Source
const C_MessageEnvelope int64 = 535232465
View Source
const C_Redirect int64 = 981138557

Variables

View Source
var (
	RedirectReason_name = map[int32]string{
		0: "ReplicaSetSession",
		1: "ReplicaSetRequest",
		3: "Reserved1",
		4: "Reserved2",
		5: "Reserved3",
		6: "Reserved4",
	}
	RedirectReason_value = map[string]int32{
		"ReplicaSetSession": 0,
		"ReplicaSetRequest": 1,
		"Reserved1":         3,
		"Reserved2":         4,
		"Reserved3":         5,
		"Reserved4":         6,
	}
)

Enum value maps for RedirectReason.

View Source
var (
	// rony_cobra_cmd generates the boiler plate code for client stub of rpc methods, using cobra package.
	//
	// optional bool rony_cobra_cmd = 50001;
	E_RonyCobraCmd = &file_options_proto_extTypes[0]
	// rony_cobra_cmd_protocol defines what protocol should client use to communicate with server.
	// POSSIBLE VALUES: "ws", "http"
	//
	// optional string rony_cobra_cmd_protocol = 50002;
	E_RonyCobraCmdProtocol = &file_options_proto_extTypes[1]
	// rony_no_client if is set then no client code will be generated. This flag is for internal usage.
	// DO NOT USE IT.
	//
	// optional bool rony_no_client = 50003;
	E_RonyNoClient = &file_options_proto_extTypes[2]
)

Extension fields to descriptorpb.ServiceOptions.

View Source
var (
	// rony_internal marks this method internal, hence only edges could execute this rpc through tunnel messages. In other words,
	// this command is not exposed to external clients connected through th gateway.
	//
	// optional bool rony_internal = 50002;
	E_RonyInternal = &file_options_proto_extTypes[3]
	// optional RestOpt rony_rest = 50003;
	E_RonyRest = &file_options_proto_extTypes[4]
)

Extension fields to descriptorpb.MethodOptions.

View Source
var (
	// rony_local_repo generates the code for local repository
	// POSSIBLE VALUES: store
	//
	// optional string rony_local_repo = 50001;
	E_RonyLocalRepo = &file_options_proto_extTypes[5]
	// rony_remote_repo generates the code for remote repository
	// POSSIBLE VALUES: cql
	//
	// optional string rony_remote_repo = 50002;
	E_RonyRemoteRepo = &file_options_proto_extTypes[6]
	// rony_singleton marks this message as a singleton.
	// NOTE: a message could either have 'rony_aggregate' ro 'rony_singleton' options at a same time. Setting both
	// cause unpredictable results.
	//
	// optional bool rony_singleton = 50003;
	E_RonySingleton = &file_options_proto_extTypes[7]
	// rony_table creates a virtual table presentation to hold instances of this message, like rows in a table
	// PRIMARY KEY FORMAT: ( (partitionKey1, partitionKey2, ...), clusteringKey1, clusteringKey2, ...)
	//
	// optional PrimaryKeyOpt rony_table = 50024;
	E_RonyTable = &file_options_proto_extTypes[8]
	// rony_view creates a materialized view of the aggregate based on the primary key.
	// PRIMARY KEY FORMAT: ( (partitionKey1, partitionKey2, ...), clusteringKey1, clusteringKey2, ...)
	// NOTE: The primary key of the view must contains all the primary key items of the table. They don't need to
	//           follow the same order as table. for example the following is correct:
	//                  rony_aggregate_table = ((a, b), c)
	//                  rony_aggregate_view = ((c, a),  d, b)
	//
	// repeated PrimaryKeyOpt rony_view = 50025;
	E_RonyView = &file_options_proto_extTypes[9]
)

Extension fields to descriptorpb.MessageOptions.

View Source
var (
	// rony_index marks this field as an indexed field. Some queries will be generated for this indexed field.
	//
	// optional bool rony_index = 50001;
	E_RonyIndex = &file_options_proto_extTypes[10]
)

Extension fields to descriptorpb.FieldOptions.

View Source
var File_options_proto protoreflect.FileDescriptor
View Source
var PoolEdge = poolEdge{}
View Source
var PoolEdges = poolEdges{}
View Source
var PoolError = poolError{}
View Source
var PoolGetAllNodes = poolGetAllNodes{}
View Source
var PoolGetNodes = poolGetNodes{}
View Source
var PoolHttpBody = poolHttpBody{}
View Source
var PoolKeyValue = poolKeyValue{}
View Source
var PoolMessageContainer = poolMessageContainer{}
View Source
var PoolMessageEnvelope = poolMessageEnvelope{}
View Source
var PoolRedirect = poolRedirect{}

Functions

func RegisterPrometheus added in v0.5.8

func RegisterPrometheus(registerer prometheus.Registerer)

func SetLogLevel

func SetLogLevel(l LogLevel)

SetLogLevel is used for debugging purpose

Types

type Cluster added in v0.8.6

type Cluster interface {
	Start() error
	Shutdown()
	Join(addr ...string) (int, error)
	Leave() error
	Members() []ClusterMember
	MembersByReplicaSet(replicaSets ...uint64) []ClusterMember
	MemberByID(string) ClusterMember
	MemberByHash(uint64) ClusterMember
	ReplicaSet() uint64
	ServerID() string
	TotalReplicas() int
	Addr() string
	SetGatewayAddrs(hostPorts []string) error
	SetTunnelAddrs(hostPorts []string) error
	Subscribe(d ClusterDelegate)
}

type ClusterDelegate added in v0.9.0

type ClusterDelegate interface {
	OnJoin(hash uint64)
	OnLeave(hash uint64)
}

type ClusterMember added in v0.9.0

type ClusterMember interface {
	Proto(info *Edge) *Edge
	ServerID() string
	ReplicaSet() uint64
	GatewayAddr() []string
	TunnelAddr() []string
	Dial() (net.Conn, error)
}

type Conn added in v0.1.9

type Conn interface {
	ConnID() uint64
	ClientIP() string
	WriteBinary(streamID int64, data []byte) error
	// Persistent returns FALSE if this connection will be closed when edge.DispatchCtx has been done. i.e. HTTP connections
	// It returns TRUE if this connection still alive when edge.DispatchCtx has been done. i.e. WebSocket connections
	Persistent() bool
	Get(key string) interface{}
	Set(key string, val interface{})
}

Conn defines the Connection interface

type Edge added in v0.5.0

type Edge struct {
	ReplicaSet uint64   `protobuf:"varint,1,opt,name=ReplicaSet,proto3" json:"ReplicaSet,omitempty"`
	ServerID   string   `protobuf:"bytes,2,opt,name=ServerID,proto3" json:"ServerID,omitempty"`
	HostPorts  []string `protobuf:"bytes,3,rep,name=HostPorts,proto3" json:"HostPorts,omitempty"`
	// contains filtered or unexported fields
}

Edge

func (*Edge) Clone added in v0.12.0

func (x *Edge) Clone() *Edge

func (*Edge) DeepCopy added in v0.5.0

func (x *Edge) DeepCopy(z *Edge)

func (*Edge) Descriptor deprecated added in v0.5.0

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

Deprecated: Use Edge.ProtoReflect.Descriptor instead.

func (*Edge) GetHostPorts added in v0.5.0

func (x *Edge) GetHostPorts() []string

func (*Edge) GetReplicaSet added in v0.5.0

func (x *Edge) GetReplicaSet() uint64

func (*Edge) GetServerID added in v0.5.0

func (x *Edge) GetServerID() string

func (*Edge) Marshal added in v0.5.0

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

func (*Edge) MarshalJSON added in v0.10.3

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

func (*Edge) ProtoMessage added in v0.5.0

func (*Edge) ProtoMessage()

func (*Edge) ProtoReflect added in v0.5.0

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

func (*Edge) Reset added in v0.5.0

func (x *Edge) Reset()

func (*Edge) String added in v0.5.0

func (x *Edge) String() string

func (*Edge) Unmarshal added in v0.5.0

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

func (*Edge) UnmarshalJSON added in v0.10.3

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

type Edges added in v0.5.0

type Edges struct {
	Nodes []*Edge `protobuf:"bytes,1,rep,name=Nodes,proto3" json:"Nodes,omitempty"`
	// contains filtered or unexported fields
}

Edges

func (*Edges) Clone added in v0.12.0

func (x *Edges) Clone() *Edges

func (*Edges) DeepCopy added in v0.5.0

func (x *Edges) DeepCopy(z *Edges)

func (*Edges) Descriptor deprecated added in v0.5.0

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

Deprecated: Use Edges.ProtoReflect.Descriptor instead.

func (*Edges) GetNodes added in v0.5.0

func (x *Edges) GetNodes() []*Edge

func (*Edges) Marshal added in v0.5.0

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

func (*Edges) MarshalJSON added in v0.10.3

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

func (*Edges) ProtoMessage added in v0.5.0

func (*Edges) ProtoMessage()

func (*Edges) ProtoReflect added in v0.5.0

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

func (*Edges) Reset added in v0.5.0

func (x *Edges) Reset()

func (*Edges) String added in v0.5.0

func (x *Edges) String() string

func (*Edges) Unmarshal added in v0.5.0

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

func (*Edges) UnmarshalJSON added in v0.10.3

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

type Error

type Error struct {
	Code        string `protobuf:"bytes,1,opt,name=Code,proto3" json:"Code,omitempty"`
	Items       string `protobuf:"bytes,2,opt,name=Items,proto3" json:"Items,omitempty"`
	Description string `protobuf:"bytes,3,opt,name=Description,proto3" json:"Description,omitempty"`
	// contains filtered or unexported fields
}

Error

func (*Error) Clone added in v0.12.0

func (x *Error) Clone() *Error

func (*Error) DeepCopy

func (x *Error) DeepCopy(z *Error)

func (*Error) Descriptor deprecated

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

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) Error added in v0.2.4

func (x *Error) Error() string

Extra methods for Error

func (*Error) Expand added in v0.8.0

func (x *Error) Expand() (string, string)

func (*Error) GetCode

func (x *Error) GetCode() string

func (*Error) GetDescription added in v0.5.0

func (x *Error) GetDescription() string

func (*Error) GetItems

func (x *Error) GetItems() string

func (*Error) Marshal added in v0.0.17

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

func (*Error) MarshalJSON added in v0.10.3

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

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

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

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

func (*Error) ToEnvelope added in v0.8.0

func (x *Error) ToEnvelope(me *MessageEnvelope)

func (*Error) Unmarshal

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

func (*Error) UnmarshalJSON added in v0.10.3

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

type Gateway added in v0.8.6

type Gateway interface {
	Start()
	Run()
	Shutdown()
	GetConn(connID uint64) Conn
	Addr() []string
	Protocol() GatewayProtocol
}

Gateway defines the gateway interface where clients could connect and communicate with the edge server

type GatewayProtocol added in v0.9.0

type GatewayProtocol int32
const (
	Undefined GatewayProtocol = 0
	Dummy     GatewayProtocol = 1 << iota
	Http
	Websocket
	Quic
	Grpc
	TCP = Http | Websocket // Http & Websocket
)

func (GatewayProtocol) String added in v0.9.0

func (p GatewayProtocol) String() string

type GetAllNodes added in v0.7.4

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

GetNodes @Function @Return: Edges

func (*GetAllNodes) Clone added in v0.12.0

func (x *GetAllNodes) Clone() *GetAllNodes

func (*GetAllNodes) DeepCopy added in v0.7.4

func (x *GetAllNodes) DeepCopy(z *GetAllNodes)

func (*GetAllNodes) Descriptor deprecated added in v0.7.4

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

Deprecated: Use GetAllNodes.ProtoReflect.Descriptor instead.

func (*GetAllNodes) Marshal added in v0.7.4

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

func (*GetAllNodes) MarshalJSON added in v0.10.3

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

func (*GetAllNodes) ProtoMessage added in v0.7.4

func (*GetAllNodes) ProtoMessage()

func (*GetAllNodes) ProtoReflect added in v0.7.4

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

func (*GetAllNodes) Reset added in v0.7.4

func (x *GetAllNodes) Reset()

func (*GetAllNodes) String added in v0.7.4

func (x *GetAllNodes) String() string

func (*GetAllNodes) Unmarshal added in v0.7.4

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

func (*GetAllNodes) UnmarshalJSON added in v0.10.3

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

type GetNodes added in v0.1.5

type GetNodes struct {
	ReplicaSet []uint64 `protobuf:"varint,1,rep,packed,name=ReplicaSet,proto3" json:"ReplicaSet,omitempty"`
	// contains filtered or unexported fields
}

GetNodes @Function @Return: Edges

func (*GetNodes) Clone added in v0.12.0

func (x *GetNodes) Clone() *GetNodes

func (*GetNodes) DeepCopy added in v0.1.5

func (x *GetNodes) DeepCopy(z *GetNodes)

func (*GetNodes) Descriptor deprecated added in v0.1.5

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

Deprecated: Use GetNodes.ProtoReflect.Descriptor instead.

func (*GetNodes) GetReplicaSet added in v0.1.5

func (x *GetNodes) GetReplicaSet() []uint64

func (*GetNodes) Marshal added in v0.1.5

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

func (*GetNodes) MarshalJSON added in v0.10.3

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

func (*GetNodes) ProtoMessage added in v0.1.5

func (*GetNodes) ProtoMessage()

func (*GetNodes) ProtoReflect added in v0.1.5

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

func (*GetNodes) Reset added in v0.1.5

func (x *GetNodes) Reset()

func (*GetNodes) String added in v0.1.5

func (x *GetNodes) String() string

func (*GetNodes) Unmarshal added in v0.1.5

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

func (*GetNodes) UnmarshalJSON added in v0.10.3

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

type HttpBody added in v0.8.0

type HttpBody struct {
	ContentType string      `protobuf:"bytes,1,opt,name=ContentType,proto3" json:"ContentType,omitempty"`
	Header      []*KeyValue `protobuf:"bytes,2,rep,name=Header,proto3" json:"Header,omitempty"`
	Body        []byte      `protobuf:"bytes,3,opt,name=Body,proto3" json:"Body,omitempty"`
	// contains filtered or unexported fields
}

HttpBody used by REST proxies to fill the output.

func (*HttpBody) Clone added in v0.12.0

func (x *HttpBody) Clone() *HttpBody

func (*HttpBody) DeepCopy added in v0.8.0

func (x *HttpBody) DeepCopy(z *HttpBody)

func (*HttpBody) Descriptor deprecated added in v0.8.0

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

Deprecated: Use HttpBody.ProtoReflect.Descriptor instead.

func (*HttpBody) GetBody added in v0.8.0

func (x *HttpBody) GetBody() []byte

func (*HttpBody) GetContentType added in v0.8.0

func (x *HttpBody) GetContentType() string

func (*HttpBody) GetHeader added in v0.8.0

func (x *HttpBody) GetHeader() []*KeyValue

func (*HttpBody) Marshal added in v0.8.0

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

func (*HttpBody) MarshalJSON added in v0.10.3

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

func (*HttpBody) ProtoMessage added in v0.8.0

func (*HttpBody) ProtoMessage()

func (*HttpBody) ProtoReflect added in v0.8.0

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

func (*HttpBody) Reset added in v0.8.0

func (x *HttpBody) Reset()

func (*HttpBody) String added in v0.8.0

func (x *HttpBody) String() string

func (*HttpBody) Unmarshal added in v0.8.0

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

func (*HttpBody) UnmarshalJSON added in v0.10.3

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

type KeyValue

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

KeyValue

func (*KeyValue) Clone added in v0.12.0

func (x *KeyValue) Clone() *KeyValue

func (*KeyValue) DeepCopy

func (x *KeyValue) DeepCopy(z *KeyValue)

func (*KeyValue) Descriptor deprecated

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

Deprecated: Use KeyValue.ProtoReflect.Descriptor instead.

func (*KeyValue) GetKey

func (x *KeyValue) GetKey() string

func (*KeyValue) GetValue

func (x *KeyValue) GetValue() string

func (*KeyValue) Marshal added in v0.0.17

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

func (*KeyValue) MarshalJSON added in v0.10.3

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

func (*KeyValue) ProtoMessage

func (*KeyValue) ProtoMessage()

func (*KeyValue) ProtoReflect

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

func (*KeyValue) Reset

func (x *KeyValue) Reset()

func (*KeyValue) String

func (x *KeyValue) String() string

func (*KeyValue) Unmarshal

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

func (*KeyValue) UnmarshalJSON added in v0.10.3

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

type LocalDB added in v0.12.2

type LocalDB = badger.DB

type LogLevel added in v0.10.3

type LogLevel = log.Level

type MessageContainer

type MessageContainer struct {
	Length    int32              `protobuf:"varint,1,opt,name=Length,proto3" json:"Length,omitempty"`
	Envelopes []*MessageEnvelope `protobuf:"bytes,2,rep,name=Envelopes,proto3" json:"Envelopes,omitempty"`
	// contains filtered or unexported fields
}

MessageContainer This type of message will be used to send multi messages inside a single container message

func (*MessageContainer) Add added in v0.6.11

func (x *MessageContainer) Add(reqID uint64, constructor int64, p proto.Message, kvs ...*KeyValue)

Extra methods for MessageContainer

func (*MessageContainer) Clone added in v0.12.0

func (x *MessageContainer) Clone() *MessageContainer

func (*MessageContainer) DeepCopy

func (x *MessageContainer) DeepCopy(z *MessageContainer)

func (*MessageContainer) Descriptor deprecated

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

Deprecated: Use MessageContainer.ProtoReflect.Descriptor instead.

func (*MessageContainer) GetEnvelopes

func (x *MessageContainer) GetEnvelopes() []*MessageEnvelope

func (*MessageContainer) GetLength

func (x *MessageContainer) GetLength() int32

func (*MessageContainer) Marshal added in v0.0.17

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

func (*MessageContainer) MarshalJSON added in v0.10.3

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

func (*MessageContainer) ProtoMessage

func (*MessageContainer) ProtoMessage()

func (*MessageContainer) ProtoReflect

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

func (*MessageContainer) Reset

func (x *MessageContainer) Reset()

func (*MessageContainer) String

func (x *MessageContainer) String() string

func (*MessageContainer) Unmarshal

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

func (*MessageContainer) UnmarshalJSON added in v0.10.3

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

type MessageEnvelope

type MessageEnvelope struct {
	Constructor int64       `protobuf:"varint,1,opt,name=Constructor,proto3" json:"Constructor,omitempty"`
	RequestID   uint64      `protobuf:"fixed64,2,opt,name=RequestID,proto3" json:"RequestID,omitempty"`
	Message     []byte      `protobuf:"bytes,4,opt,name=Message,proto3" json:"Message,omitempty"`
	Auth        []byte      `protobuf:"bytes,8,opt,name=Auth,proto3" json:"Auth,omitempty"`
	Header      []*KeyValue `protobuf:"bytes,10,rep,name=Header,proto3" json:"Header,omitempty"`
	// contains filtered or unexported fields
}

MessageEnvelope This type of message will be used to contain another ProtoBuffer Message inside

func (*MessageEnvelope) Clone

func (x *MessageEnvelope) Clone() *MessageEnvelope

func (*MessageEnvelope) DeepCopy

func (x *MessageEnvelope) DeepCopy(z *MessageEnvelope)

func (*MessageEnvelope) Descriptor deprecated

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

Deprecated: Use MessageEnvelope.ProtoReflect.Descriptor instead.

func (*MessageEnvelope) Fill

func (x *MessageEnvelope) Fill(reqID uint64, constructor int64, p proto.Message, kvs ...*KeyValue)

func (*MessageEnvelope) Get added in v0.0.18

func (x *MessageEnvelope) Get(key, defaultVal string) string

func (*MessageEnvelope) GetAuth

func (x *MessageEnvelope) GetAuth() []byte

func (*MessageEnvelope) GetConstructor

func (x *MessageEnvelope) GetConstructor() int64

func (*MessageEnvelope) GetHeader

func (x *MessageEnvelope) GetHeader() []*KeyValue

func (*MessageEnvelope) GetMessage

func (x *MessageEnvelope) GetMessage() []byte

func (*MessageEnvelope) GetRequestID

func (x *MessageEnvelope) GetRequestID() uint64

func (*MessageEnvelope) Marshal added in v0.0.17

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

func (*MessageEnvelope) MarshalJSON added in v0.10.3

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

func (*MessageEnvelope) ProtoMessage

func (*MessageEnvelope) ProtoMessage()

func (*MessageEnvelope) ProtoReflect

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

func (*MessageEnvelope) Reset

func (x *MessageEnvelope) Reset()

func (*MessageEnvelope) Set added in v0.0.18

func (x *MessageEnvelope) Set(KVs ...*KeyValue)

func (*MessageEnvelope) String

func (x *MessageEnvelope) String() string

func (*MessageEnvelope) Unmarshal

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

func (*MessageEnvelope) UnmarshalJSON added in v0.10.3

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

type PrimaryKeyOpt added in v0.12.0

type PrimaryKeyOpt struct {
	PartKey []string `protobuf:"bytes,1,rep,name=part_key,json=partKey" json:"part_key,omitempty"`
	SortKey []string `protobuf:"bytes,2,rep,name=sort_key,json=sortKey" json:"sort_key,omitempty"`
	// Alias could be used to override the name of materialized view. If this is not set, Rony automatically
	// generates for you.
	Alias *string `protobuf:"bytes,4,opt,name=alias" json:"alias,omitempty"`
	// contains filtered or unexported fields
}

PrimaryKeyOpt is the container for aggregate primary key settings. It is going to replace old rony_aggregate_table & rony_aggregate_view options.

func (*PrimaryKeyOpt) Descriptor deprecated added in v0.12.0

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

Deprecated: Use PrimaryKeyOpt.ProtoReflect.Descriptor instead.

func (*PrimaryKeyOpt) GetAlias added in v0.12.0

func (x *PrimaryKeyOpt) GetAlias() string

func (*PrimaryKeyOpt) GetPartKey added in v0.12.0

func (x *PrimaryKeyOpt) GetPartKey() []string

func (*PrimaryKeyOpt) GetSortKey added in v0.12.0

func (x *PrimaryKeyOpt) GetSortKey() []string

func (*PrimaryKeyOpt) ProtoMessage added in v0.12.0

func (*PrimaryKeyOpt) ProtoMessage()

func (*PrimaryKeyOpt) ProtoReflect added in v0.12.0

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

func (*PrimaryKeyOpt) Reset added in v0.12.0

func (x *PrimaryKeyOpt) Reset()

func (*PrimaryKeyOpt) String added in v0.12.0

func (x *PrimaryKeyOpt) String() string

type Redirect

type Redirect struct {
	Reason    RedirectReason `protobuf:"varint,100,opt,name=Reason,proto3,enum=rony.RedirectReason" json:"Reason,omitempty"`
	Edges     []*Edge        `protobuf:"bytes,2,rep,name=Edges,proto3" json:"Edges,omitempty"`
	WaitInSec uint32         `protobuf:"varint,3,opt,name=WaitInSec,proto3" json:"WaitInSec,omitempty"`
	// contains filtered or unexported fields
}

Redirect

func (*Redirect) Clone added in v0.12.0

func (x *Redirect) Clone() *Redirect

func (*Redirect) DeepCopy

func (x *Redirect) DeepCopy(z *Redirect)

func (*Redirect) Descriptor deprecated

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

Deprecated: Use Redirect.ProtoReflect.Descriptor instead.

func (*Redirect) GetEdges added in v0.7.1

func (x *Redirect) GetEdges() []*Edge

func (*Redirect) GetReason added in v0.1.5

func (x *Redirect) GetReason() RedirectReason

func (*Redirect) GetWaitInSec

func (x *Redirect) GetWaitInSec() uint32

func (*Redirect) Marshal added in v0.0.17

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

func (*Redirect) MarshalJSON added in v0.10.3

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

func (*Redirect) ProtoMessage

func (*Redirect) ProtoMessage()

func (*Redirect) ProtoReflect

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

func (*Redirect) Reset

func (x *Redirect) Reset()

func (*Redirect) String

func (x *Redirect) String() string

func (*Redirect) Unmarshal

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

func (*Redirect) UnmarshalJSON added in v0.10.3

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

type RedirectReason added in v0.1.5

type RedirectReason int32

RedirectReason

const (
	RedirectReason_ReplicaSetSession RedirectReason = 0
	RedirectReason_ReplicaSetRequest RedirectReason = 1
	RedirectReason_Reserved1         RedirectReason = 3
	RedirectReason_Reserved2         RedirectReason = 4
	RedirectReason_Reserved3         RedirectReason = 5
	RedirectReason_Reserved4         RedirectReason = 6
)

func (RedirectReason) Descriptor added in v0.1.5

func (RedirectReason) Enum added in v0.1.5

func (x RedirectReason) Enum() *RedirectReason

func (RedirectReason) EnumDescriptor deprecated added in v0.1.5

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

Deprecated: Use RedirectReason.Descriptor instead.

func (RedirectReason) Number added in v0.1.5

func (RedirectReason) String added in v0.1.5

func (x RedirectReason) String() string

func (RedirectReason) Type added in v0.1.5

type RestConn added in v0.10.0

type RestConn interface {
	Conn
	WriteStatus(status int)
	WriteHeader(key, value string)
	MultiPart() (*multipart.Form, error)
	Method() string
	Path() string
	Body() []byte
	Redirect(statusCode int, newHostPort string)
}

RestConn is same as Conn but it supports REST format apis.

type RestOpt added in v0.10.3

type RestOpt struct {

	// method identifies the HTTP command: i.e. 'get', 'post', 'put', ...
	Method *string `protobuf:"bytes,1,req,name=method" json:"method,omitempty"`
	// path identifies the path that this RPC method will be available as REST endpoint.
	Path *string `protobuf:"bytes,2,req,name=path" json:"path,omitempty"`
	// bind_variables is a list of pair of bindings. For example if we have a path '/part1/:var1/:var2'
	// and we want to bind 'var1' to field 'fieldVar1' and bind 'var2' to field 'fieldVar2' then it will be:
	// `["var1=fieldVar1" , "var2=fieldVar2"]`
	BindVariables []string `protobuf:"bytes,3,rep,name=bind_variables,json=bindVariables" json:"bind_variables,omitempty"`
	// json_encode if is set then input and output data are json encoded version of the proto messages
	JsonEncode *bool `protobuf:"varint,4,opt,name=json_encode,json=jsonEncode" json:"json_encode,omitempty"`
	// contains filtered or unexported fields
}

RestOpt is the container message for all the required and optional parameters for REST setup. By adding 'rony_rest' option to the method definition a REST wrapper will be generated for that method and that RPC handler will become accessible using REST endpoint.

func (*RestOpt) Descriptor deprecated added in v0.10.3

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

Deprecated: Use RestOpt.ProtoReflect.Descriptor instead.

func (*RestOpt) GetBindVariables added in v0.10.3

func (x *RestOpt) GetBindVariables() []string

func (*RestOpt) GetJsonEncode added in v0.10.3

func (x *RestOpt) GetJsonEncode() bool

func (*RestOpt) GetMethod added in v0.10.3

func (x *RestOpt) GetMethod() string

func (*RestOpt) GetPath added in v0.10.3

func (x *RestOpt) GetPath() string

func (*RestOpt) ProtoMessage added in v0.10.3

func (*RestOpt) ProtoMessage()

func (*RestOpt) ProtoReflect added in v0.10.3

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

func (*RestOpt) Reset added in v0.10.3

func (x *RestOpt) Reset()

func (*RestOpt) String added in v0.10.3

func (x *RestOpt) String() string

type Store added in v0.9.0

type Store interface {
	View(fn func(*StoreTxn) error) error
	Update(fn func(*StoreTxn) error) error
	LocalDB() *LocalDB
	Shutdown()
}

type StoreTxn added in v0.9.0

type StoreTxn = badger.Txn

type Tunnel added in v0.8.6

type Tunnel interface {
	Start()
	Run()
	Shutdown()
	Addr() []string
}

Tunnel provides the communication channel between edge servers. Tunnel is similar to gateway.Gateway in functionalities. However Tunnel is optimized for inter-communication between edge servers, and Gateway is optimized for client-server communications.

Directories

Path Synopsis
cmd
example
internal
codegen
This is auto-generated code; DO NOT EDIT.
This is auto-generated code; DO NOT EDIT.
gateway/tcp/util
Package wsutil provides utilities for working with WebSocket protocol.
Package wsutil provides utilities for working with WebSocket protocol.
log
msg
parser
Package parse builds parse trees for templates as defined by text/template and html/template.
Package parse builds parse trees for templates as defined by text/template and html/template.

Jump to

Keyboard shortcuts

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