cluster

package
v0.0.0-...-5f0d520 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Cluster_Ping_FullMethodName = "/Cluster/Ping"
	Cluster_Sync_FullMethodName = "/Cluster/Sync"
)

Variables

View Source
var Cluster_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Cluster",
	HandlerType: (*ClusterServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Ping",
			Handler:    _Cluster_Ping_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Sync",
			Handler:       _Cluster_Sync_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "plugin/cluster/proto/cluster.proto",
}

Cluster_ServiceDesc is the grpc.ServiceDesc for Cluster service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_plugin_cluster_proto_cluster_proto protoreflect.FileDescriptor

Functions

func RegisterClusterServer

func RegisterClusterServer(s grpc.ServiceRegistrar, srv ClusterServer)

Types

type Ack

type Ack struct {
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*Ack) Descriptor deprecated

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

Deprecated: Use Ack.ProtoReflect.Descriptor instead.

func (*Ack) GetId

func (x *Ack) GetId() uint64

func (*Ack) ProtoMessage

func (*Ack) ProtoMessage()

func (*Ack) ProtoReflect

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

func (*Ack) Reset

func (x *Ack) Reset()

func (*Ack) String

func (x *Ack) String() string

type Cluster

type Cluster struct {
	Peers *sync.Map

	UnimplementedClusterServer
	// contains filtered or unexported fields
}

func New

func New() *Cluster

func (*Cluster) Ping

func (c *Cluster) Ping(ctx context.Context, req *PingReq) (*PingRsp, error)

func (*Cluster) Start

func (c *Cluster) Start() error

func (*Cluster) Stop

func (c *Cluster) Stop() error

func (*Cluster) Subscribe

func (c *Cluster) Subscribe(cid, topic string)

func (*Cluster) Sync

func (c *Cluster) Sync(stream Cluster_SyncServer) error

func (*Cluster) SyncHandler

func (c *Cluster) SyncHandler(s *session, e *Event)

type ClusterClient

type ClusterClient interface {
	Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingRsp, error)
	Sync(ctx context.Context, opts ...grpc.CallOption) (Cluster_SyncClient, error)
}

ClusterClient is the client API for Cluster service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewClusterClient

func NewClusterClient(cc grpc.ClientConnInterface) ClusterClient

type ClusterServer

type ClusterServer interface {
	Ping(context.Context, *PingReq) (*PingRsp, error)
	Sync(Cluster_SyncServer) error
	// contains filtered or unexported methods
}

ClusterServer is the server API for Cluster service. All implementations must embed UnimplementedClusterServer for forward compatibility

type Cluster_SyncClient

type Cluster_SyncClient interface {
	Send(*Event) error
	Recv() (*Ack, error)
	grpc.ClientStream
}

type Cluster_SyncServer

type Cluster_SyncServer interface {
	Send(*Ack) error
	Recv() (*Event, error)
	grpc.ServerStream
}

type Event

type Event struct {
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// Types that are assignable to Event:
	//
	//	*Event_Subscribe
	//	*Event_Message
	//	*Event_Unsubscribe
	Event isEvent_Event `protobuf_oneof:"event"`
	// contains filtered or unexported fields
}

func (*Event) Descriptor deprecated

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

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetEvent

func (m *Event) GetEvent() isEvent_Event

func (*Event) GetId

func (x *Event) GetId() uint64

func (*Event) GetMessage

func (x *Event) GetMessage() *Message

func (*Event) GetSubscribe

func (x *Event) GetSubscribe() *Subscribe

func (*Event) GetUnsubscribe

func (x *Event) GetUnsubscribe() *Unsubscribe

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect

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

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

type Event_Message

type Event_Message struct {
	Message *Message `protobuf:"bytes,3,opt,name=message,proto3,oneof"`
}

type Event_Subscribe

type Event_Subscribe struct {
	Subscribe *Subscribe `protobuf:"bytes,2,opt,name=subscribe,proto3,oneof"`
}

type Event_Unsubscribe

type Event_Unsubscribe struct {
	Unsubscribe *Unsubscribe `protobuf:"bytes,4,opt,name=unsubscribe,proto3,oneof"`
}

type Message

type Message struct {
	Topic   string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetPayload

func (x *Message) GetPayload() []byte

func (*Message) GetTopic

func (x *Message) GetTopic() string

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

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

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type PingReq

type PingReq struct {
	SessionId string `protobuf:"bytes,1,opt,name=sessionId,proto3" json:"sessionId,omitempty"`
	// contains filtered or unexported fields
}

func (*PingReq) Descriptor deprecated

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

Deprecated: Use PingReq.ProtoReflect.Descriptor instead.

func (*PingReq) GetSessionId

func (x *PingReq) GetSessionId() string

func (*PingReq) ProtoMessage

func (*PingReq) ProtoMessage()

func (*PingReq) ProtoReflect

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

func (*PingReq) Reset

func (x *PingReq) Reset()

func (*PingReq) String

func (x *PingReq) String() string

type PingRsp

type PingRsp struct {
	Restart bool   `protobuf:"varint,1,opt,name=restart,proto3" json:"restart,omitempty"`
	NextId  uint64 `protobuf:"varint,2,opt,name=nextId,proto3" json:"nextId,omitempty"`
	// contains filtered or unexported fields
}

func (*PingRsp) Descriptor deprecated

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

Deprecated: Use PingRsp.ProtoReflect.Descriptor instead.

func (*PingRsp) GetNextId

func (x *PingRsp) GetNextId() uint64

func (*PingRsp) GetRestart

func (x *PingRsp) GetRestart() bool

func (*PingRsp) ProtoMessage

func (*PingRsp) ProtoMessage()

func (*PingRsp) ProtoReflect

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

func (*PingRsp) Reset

func (x *PingRsp) Reset()

func (*PingRsp) String

func (x *PingRsp) String() string

type Subscribe

type Subscribe struct {
	Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	// contains filtered or unexported fields
}

func (*Subscribe) Descriptor deprecated

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

Deprecated: Use Subscribe.ProtoReflect.Descriptor instead.

func (*Subscribe) GetTopic

func (x *Subscribe) GetTopic() string

func (*Subscribe) ProtoMessage

func (*Subscribe) ProtoMessage()

func (*Subscribe) ProtoReflect

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

func (*Subscribe) Reset

func (x *Subscribe) Reset()

func (*Subscribe) String

func (x *Subscribe) String() string

type UnimplementedClusterServer

type UnimplementedClusterServer struct {
}

UnimplementedClusterServer must be embedded to have forward compatible implementations.

func (UnimplementedClusterServer) Ping

func (UnimplementedClusterServer) Sync

type UnsafeClusterServer

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

UnsafeClusterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ClusterServer will result in compilation errors.

type Unsubscribe

type Unsubscribe struct {
	Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	// contains filtered or unexported fields
}

func (*Unsubscribe) Descriptor deprecated

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

Deprecated: Use Unsubscribe.ProtoReflect.Descriptor instead.

func (*Unsubscribe) GetTopic

func (x *Unsubscribe) GetTopic() string

func (*Unsubscribe) ProtoMessage

func (*Unsubscribe) ProtoMessage()

func (*Unsubscribe) ProtoReflect

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

func (*Unsubscribe) Reset

func (x *Unsubscribe) Reset()

func (*Unsubscribe) String

func (x *Unsubscribe) String() string

Jump to

Keyboard shortcuts

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