remote

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
var File_remote_proto protoreflect.FileDescriptor
View Source
var Remote_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "remote.Remote",
	HandlerType: (*RemoteServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Receive",
			Handler:       _Remote_Receive_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "remote.proto",
}

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

Functions

func DRPCRegisterRemote

func DRPCRegisterRemote(mux drpc.Mux, impl DRPCRemoteServer) error

func RegisterRemoteServer

func RegisterRemoteServer(s grpc.ServiceRegistrar, srv RemoteServer)

func RegisterType

func RegisterType(v VTUnmarshaler)

Types

type Config

type Config struct {
	TLSConfig *tls.Config
}

Config holds the remote configuration.

func NewConfig

func NewConfig() Config

NewConfig returns a new default remote configuration.

func (Config) WithTLS

func (c Config) WithTLS(tlsconf *tls.Config) Config

WithTLS sets the TLS config of the remote which will set the transport of the Remote to TLS.

type DRPCRemoteClient

type DRPCRemoteClient interface {
	DRPCConn() drpc.Conn

	Receive(ctx context.Context) (DRPCRemote_ReceiveClient, error)
}

func NewDRPCRemoteClient

func NewDRPCRemoteClient(cc drpc.Conn) DRPCRemoteClient

type DRPCRemoteDescription

type DRPCRemoteDescription struct{}

func (DRPCRemoteDescription) Method

func (DRPCRemoteDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool)

func (DRPCRemoteDescription) NumMethods

func (DRPCRemoteDescription) NumMethods() int

type DRPCRemoteServer

type DRPCRemoteServer interface {
	Receive(DRPCRemote_ReceiveStream) error
}

type DRPCRemoteUnimplementedServer

type DRPCRemoteUnimplementedServer struct{}

func (*DRPCRemoteUnimplementedServer) Receive

type DRPCRemote_ReceiveClient

type DRPCRemote_ReceiveClient interface {
	drpc.Stream
	Send(*Envelope) error
	Recv() (*Envelope, error)
}

type DRPCRemote_ReceiveStream

type DRPCRemote_ReceiveStream interface {
	drpc.Stream
	Send(*Envelope) error
	Recv() (*Envelope, error)
}

type Deserializer

type Deserializer interface {
	Deserialize([]byte, string) (any, error)
}

type Envelope

type Envelope struct {
	TypeNames []string     `protobuf:"bytes,1,rep,name=typeNames,proto3" json:"typeNames,omitempty"`
	Targets   []*actor.PID `protobuf:"bytes,2,rep,name=targets,proto3" json:"targets,omitempty"`
	Senders   []*actor.PID `protobuf:"bytes,3,rep,name=senders,proto3" json:"senders,omitempty"`
	Messages  []*Message   `protobuf:"bytes,4,rep,name=messages,proto3" json:"messages,omitempty"`
	// contains filtered or unexported fields
}

func (*Envelope) CloneMessageVT

func (m *Envelope) CloneMessageVT() proto.Message

func (*Envelope) CloneVT

func (m *Envelope) CloneVT() *Envelope

func (*Envelope) Descriptor deprecated

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

Deprecated: Use Envelope.ProtoReflect.Descriptor instead.

func (*Envelope) EqualMessageVT

func (this *Envelope) EqualMessageVT(thatMsg proto.Message) bool

func (*Envelope) EqualVT

func (this *Envelope) EqualVT(that *Envelope) bool

func (*Envelope) GetMessages

func (x *Envelope) GetMessages() []*Message

func (*Envelope) GetSenders

func (x *Envelope) GetSenders() []*actor.PID

func (*Envelope) GetTargets

func (x *Envelope) GetTargets() []*actor.PID

func (*Envelope) GetTypeNames

func (x *Envelope) GetTypeNames() []string

func (*Envelope) MarshalToSizedBufferVT

func (m *Envelope) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Envelope) MarshalToSizedBufferVTStrict

func (m *Envelope) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Envelope) MarshalToVT

func (m *Envelope) MarshalToVT(dAtA []byte) (int, error)

func (*Envelope) MarshalToVTStrict

func (m *Envelope) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Envelope) MarshalVT

func (m *Envelope) MarshalVT() (dAtA []byte, err error)

func (*Envelope) MarshalVTStrict

func (m *Envelope) MarshalVTStrict() (dAtA []byte, err error)

func (*Envelope) ProtoMessage

func (*Envelope) ProtoMessage()

func (*Envelope) ProtoReflect

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

func (*Envelope) Reset

func (x *Envelope) Reset()

func (*Envelope) SizeVT

func (m *Envelope) SizeVT() (n int)

func (*Envelope) String

func (x *Envelope) String() string

func (*Envelope) UnmarshalVT

func (m *Envelope) UnmarshalVT(dAtA []byte) error

type Message

type Message struct {
	Data          []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	TargetIndex   int32  `protobuf:"varint,2,opt,name=targetIndex,proto3" json:"targetIndex,omitempty"`
	SenderIndex   int32  `protobuf:"varint,3,opt,name=senderIndex,proto3" json:"senderIndex,omitempty"`
	TypeNameIndex int32  `protobuf:"varint,4,opt,name=typeNameIndex,proto3" json:"typeNameIndex,omitempty"`
	// contains filtered or unexported fields
}

func (*Message) CloneMessageVT

func (m *Message) CloneMessageVT() proto.Message

func (*Message) CloneVT

func (m *Message) CloneVT() *Message

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) EqualMessageVT

func (this *Message) EqualMessageVT(thatMsg proto.Message) bool

func (*Message) EqualVT

func (this *Message) EqualVT(that *Message) bool

func (*Message) GetData

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

func (*Message) GetSenderIndex

func (x *Message) GetSenderIndex() int32

func (*Message) GetTargetIndex

func (x *Message) GetTargetIndex() int32

func (*Message) GetTypeNameIndex

func (x *Message) GetTypeNameIndex() int32

func (*Message) MarshalToSizedBufferVT

func (m *Message) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Message) MarshalToSizedBufferVTStrict

func (m *Message) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Message) MarshalToVT

func (m *Message) MarshalToVT(dAtA []byte) (int, error)

func (*Message) MarshalToVTStrict

func (m *Message) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Message) MarshalVT

func (m *Message) MarshalVT() (dAtA []byte, err error)

func (*Message) MarshalVTStrict

func (m *Message) MarshalVTStrict() (dAtA []byte, err error)

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

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

func (*Message) Reset

func (x *Message) Reset()

func (*Message) SizeVT

func (m *Message) SizeVT() (n int)

func (*Message) String

func (x *Message) String() string

func (*Message) UnmarshalVT

func (m *Message) UnmarshalVT(dAtA []byte) error

type ProtoSerializer

type ProtoSerializer struct{}

func (ProtoSerializer) Deserialize

func (ProtoSerializer) Deserialize(data []byte, tname string) (any, error)

func (ProtoSerializer) Serialize

func (ProtoSerializer) Serialize(msg any) ([]byte, error)

func (ProtoSerializer) TypeName

func (ProtoSerializer) TypeName(msg any) string

type Remote

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

func New

func New(addr string, config Config) *Remote

New creates a new "Remote" object given a Config.

func (*Remote) Address

func (r *Remote) Address() string

Address returns the listen address of the remote.

func (*Remote) Send

func (r *Remote) Send(pid *actor.PID, msg any, sender *actor.PID)

Send sends the given message to the process with the given pid over the network. Optional a "Sender PID" can be given to inform the receiving process who sent the message. Sending will work even if the remote is stopped. Receiving however, will not work.

func (*Remote) Start

func (r *Remote) Start(e *actor.Engine) error

func (*Remote) Stop

func (r *Remote) Stop() *sync.WaitGroup

Stop will stop the remote from listening.

type RemoteClient

type RemoteClient interface {
	Receive(ctx context.Context, opts ...grpc.CallOption) (Remote_ReceiveClient, error)
}

RemoteClient is the client API for Remote 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 NewRemoteClient

func NewRemoteClient(cc grpc.ClientConnInterface) RemoteClient

type RemoteServer

type RemoteServer interface {
	Receive(Remote_ReceiveServer) error
	// contains filtered or unexported methods
}

RemoteServer is the server API for Remote service. All implementations must embed UnimplementedRemoteServer for forward compatibility

type Remote_ReceiveClient

type Remote_ReceiveClient interface {
	Send(*Envelope) error
	Recv() (*Envelope, error)
	grpc.ClientStream
}

type Remote_ReceiveServer

type Remote_ReceiveServer interface {
	Send(*Envelope) error
	Recv() (*Envelope, error)
	grpc.ServerStream
}

type Serializer

type Serializer interface {
	Serialize(msg any) ([]byte, error)
	TypeName(any) string
}

type TestMessage

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

func (*TestMessage) CloneMessageVT

func (m *TestMessage) CloneMessageVT() proto.Message

func (*TestMessage) CloneVT

func (m *TestMessage) CloneVT() *TestMessage

func (*TestMessage) Descriptor deprecated

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

Deprecated: Use TestMessage.ProtoReflect.Descriptor instead.

func (*TestMessage) EqualMessageVT

func (this *TestMessage) EqualMessageVT(thatMsg proto.Message) bool

func (*TestMessage) EqualVT

func (this *TestMessage) EqualVT(that *TestMessage) bool

func (*TestMessage) GetData

func (x *TestMessage) GetData() []byte

func (*TestMessage) MarshalToSizedBufferVT

func (m *TestMessage) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TestMessage) MarshalToSizedBufferVTStrict

func (m *TestMessage) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*TestMessage) MarshalToVT

func (m *TestMessage) MarshalToVT(dAtA []byte) (int, error)

func (*TestMessage) MarshalToVTStrict

func (m *TestMessage) MarshalToVTStrict(dAtA []byte) (int, error)

func (*TestMessage) MarshalVT

func (m *TestMessage) MarshalVT() (dAtA []byte, err error)

func (*TestMessage) MarshalVTStrict

func (m *TestMessage) MarshalVTStrict() (dAtA []byte, err error)

func (*TestMessage) ProtoMessage

func (*TestMessage) ProtoMessage()

func (*TestMessage) ProtoReflect

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

func (*TestMessage) Reset

func (x *TestMessage) Reset()

func (*TestMessage) SizeVT

func (m *TestMessage) SizeVT() (n int)

func (*TestMessage) String

func (x *TestMessage) String() string

func (*TestMessage) UnmarshalVT

func (m *TestMessage) UnmarshalVT(dAtA []byte) error

type UnimplementedRemoteServer

type UnimplementedRemoteServer struct {
}

UnimplementedRemoteServer must be embedded to have forward compatible implementations.

func (UnimplementedRemoteServer) Receive

type UnsafeRemoteServer

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

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

type VTMarshaler

type VTMarshaler interface {
	proto.Message
	MarshalVT() ([]byte, error)
}

type VTProtoSerializer

type VTProtoSerializer struct{}

func (VTProtoSerializer) Deserialize

func (VTProtoSerializer) Deserialize(data []byte, mtype string) (any, error)

func (VTProtoSerializer) Serialize

func (VTProtoSerializer) Serialize(msg any) ([]byte, error)

func (VTProtoSerializer) TypeName

func (VTProtoSerializer) TypeName(msg any) string

type VTUnmarshaler

type VTUnmarshaler interface {
	proto.Message
	UnmarshalVT([]byte) error
}

Jump to

Keyboard shortcuts

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