Documentation ¶
Index ¶
- Constants
- Variables
- func CheckContext(ctx context.Context) bool
- func LoadServiceDesc(svc *grpc.ServiceDesc) (*descriptorpb.ServiceDescriptorProto, error)
- func RegisterServerReflectionServer(s grpc.ServiceRegistrar, srv ServerReflectionServer)
- func Tracer() trace.Tracer
- func WaitErrOrTimeout(errC <-chan error, timeout time.Duration) error
- type ClientConn
- type ClientStream
- type DiscoveryRequest
- func (*DiscoveryRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DiscoveryRequest) GetInitiator() string
- func (x *DiscoveryRequest) GetRemainingHops() int32
- func (x *DiscoveryRequest) GetVisited() []string
- func (*DiscoveryRequest) ProtoMessage()
- func (x *DiscoveryRequest) ProtoReflect() protoreflect.Message
- func (x *DiscoveryRequest) Reset()
- func (x *DiscoveryRequest) String() string
- type MD
- type MDValues
- type MethodInvoker
- type QOS
- type RPC
- func (*RPC) Descriptor() ([]byte, []int)deprecated
- func (m *RPC) GetContent() isRPC_Content
- func (x *RPC) GetMetadata() *MD
- func (x *RPC) GetMethodName() string
- func (x *RPC) GetRequest() []byte
- func (x *RPC) GetResponse() *Response
- func (x *RPC) GetServiceName() string
- func (x *RPC) GetTag() uint64
- func (*RPC) ProtoMessage()
- func (x *RPC) ProtoReflect() protoreflect.Message
- func (r *RPC) QualifiedMethodName() string
- func (x *RPC) Reset()
- func (x *RPC) String() string
- type RPC_Request
- type RPC_Response
- type ReplicationStrategy
- func (ReplicationStrategy) Descriptor() protoreflect.EnumDescriptor
- func (x ReplicationStrategy) Enum() *ReplicationStrategy
- func (ReplicationStrategy) EnumDescriptor() ([]byte, []int)deprecated
- func (x ReplicationStrategy) Number() protoreflect.EnumNumber
- func (x ReplicationStrategy) String() string
- func (ReplicationStrategy) Type() protoreflect.EnumType
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetResponse() []byte
- func (r *Response) GetStatus() *status.Status
- func (x *Response) GetStatusProto() *status.Status
- func (*Response) ProtoMessage()
- func (x *Response) ProtoReflect() protoreflect.Message
- func (x *Response) Reset()
- func (x *Response) String() string
- type Server
- type ServerOption
- type ServerOptions
- type ServerReflectionClient
- type ServerReflectionServer
- type ServerStream
- type ServiceHandler
- type ServiceHandlerList
- type ServiceInfo
- func (*ServiceInfo) Descriptor() ([]byte, []int)deprecated
- func (x *ServiceInfo) GetServices() []*descriptorpb.ServiceDescriptorProto
- func (i *ServiceInfo) MethodNames() []string
- func (*ServiceInfo) ProtoMessage()
- func (x *ServiceInfo) ProtoReflect() protoreflect.Message
- func (x *ServiceInfo) Reset()
- func (x *ServiceInfo) String() string
- type Stream
- type StreamController
- func (sh *StreamController) CloseOrRecv() error
- func (sh *StreamController) Kick(err error)
- func (sh *StreamController) ListServices(ctx context.Context, req *DiscoveryRequest) (*ServiceInfo, error)
- func (sh *StreamController) NewInvoker() MethodInvoker
- func (sh *StreamController) RegisterServiceHandler(handler *ServiceHandler)
- func (sh *StreamController) Reply(ctx context.Context, tag uint64, data []byte)
- func (sh *StreamController) ReplyErr(ctx context.Context, tag uint64, reply error)
- func (sh *StreamController) Request(ctx context.Context, m *RPC) <-chan *RPC
- func (sh *StreamController) Run(ctx context.Context) error
- type StreamControllerOption
- type StreamControllerOptions
- type UnimplementedServerReflectionServer
- type UnsafeServerReflectionServer
- type Visibility
Constants ¶
const (
TracerName = "totem"
)
Variables ¶
var ( ReplicationStrategy_name = map[int32]string{ 0: "First", 1: "Broadcast", } ReplicationStrategy_value = map[string]int32{ "First": 0, "Broadcast": 1, } )
Enum value maps for ReplicationStrategy.
var ( Log *zap.Logger LogLevel = zap.NewAtomicLevelAt(zapcore.WarnLevel) )
var (
// optional totem.QOS qos = 10001;
E_Qos = &file_github_com_kralicky_totem_extensions_proto_extTypes[0]
)
Extension fields to descriptorpb.MethodOptions.
var (
// optional totem.Visibility visibility = 10002;
E_Visibility = &file_github_com_kralicky_totem_extensions_proto_extTypes[1]
)
Extension fields to descriptorpb.ServiceOptions.
var ErrTimeout = fmt.Errorf("timed out")
var File_github_com_kralicky_totem_extensions_proto protoreflect.FileDescriptor
var File_github_com_kralicky_totem_totem_proto protoreflect.FileDescriptor
var ServerReflection_ServiceDesc = grpc.ServiceDesc{ ServiceName: "totem.ServerReflection", HandlerType: (*ServerReflectionServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ListServices", Handler: _ServerReflection_ListServices_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "github.com/kralicky/totem/totem.proto", }
ServerReflection_ServiceDesc is the grpc.ServiceDesc for ServerReflection service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func CheckContext ¶
func LoadServiceDesc ¶
func LoadServiceDesc(svc *grpc.ServiceDesc) (*descriptorpb.ServiceDescriptorProto, error)
func RegisterServerReflectionServer ¶ added in v1.1.14
func RegisterServerReflectionServer(s grpc.ServiceRegistrar, srv ServerReflectionServer)
Types ¶
type ClientConn ¶ added in v1.1.14
type ClientConn struct {
// contains filtered or unexported fields
}
func (*ClientConn) Invoke ¶ added in v1.1.14
func (cc *ClientConn) Invoke( ctx context.Context, method string, req interface{}, reply interface{}, callOpts ...grpc.CallOption, ) error
func (*ClientConn) NewStream ¶ added in v1.1.14
func (cc *ClientConn) NewStream( ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption, ) (grpc.ClientStream, error)
type ClientStream ¶
type ClientStream interface { Stream grpc.ClientStream }
type DiscoveryRequest ¶ added in v1.1.14
type DiscoveryRequest struct { Initiator string `protobuf:"bytes,1,opt,name=initiator,proto3" json:"initiator,omitempty"` Visited []string `protobuf:"bytes,2,rep,name=visited,proto3" json:"visited,omitempty"` RemainingHops int32 `protobuf:"varint,3,opt,name=remainingHops,proto3" json:"remainingHops,omitempty"` // contains filtered or unexported fields }
func (*DiscoveryRequest) Descriptor
deprecated
added in
v1.1.14
func (*DiscoveryRequest) Descriptor() ([]byte, []int)
Deprecated: Use DiscoveryRequest.ProtoReflect.Descriptor instead.
func (*DiscoveryRequest) GetInitiator ¶ added in v1.1.14
func (x *DiscoveryRequest) GetInitiator() string
func (*DiscoveryRequest) GetRemainingHops ¶ added in v1.1.14
func (x *DiscoveryRequest) GetRemainingHops() int32
func (*DiscoveryRequest) GetVisited ¶ added in v1.1.14
func (x *DiscoveryRequest) GetVisited() []string
func (*DiscoveryRequest) ProtoMessage ¶ added in v1.1.14
func (*DiscoveryRequest) ProtoMessage()
func (*DiscoveryRequest) ProtoReflect ¶ added in v1.1.14
func (x *DiscoveryRequest) ProtoReflect() protoreflect.Message
func (*DiscoveryRequest) Reset ¶ added in v1.1.14
func (x *DiscoveryRequest) Reset()
func (*DiscoveryRequest) String ¶ added in v1.1.14
func (x *DiscoveryRequest) String() string
type MD ¶ added in v1.1.14
type MD struct { Data map[string]*MDValues `` /* 149-byte string literal not displayed */ // contains filtered or unexported fields }
func (*MD) Descriptor
deprecated
added in
v1.1.14
func (*MD) ProtoMessage ¶ added in v1.1.14
func (*MD) ProtoMessage()
func (*MD) ProtoReflect ¶ added in v1.1.14
func (x *MD) ProtoReflect() protoreflect.Message
type MDValues ¶ added in v1.1.14
type MDValues struct { Items []string `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` // contains filtered or unexported fields }
func (*MDValues) Descriptor
deprecated
added in
v1.1.14
func (*MDValues) ProtoMessage ¶ added in v1.1.14
func (*MDValues) ProtoMessage()
func (*MDValues) ProtoReflect ¶ added in v1.1.14
func (x *MDValues) ProtoReflect() protoreflect.Message
type MethodInvoker ¶
type QOS ¶ added in v1.1.14
type QOS struct { ReplicationStrategy ReplicationStrategy `protobuf:"varint,1,opt,name=replicationStrategy,proto3,enum=totem.ReplicationStrategy" json:"replicationStrategy,omitempty"` // contains filtered or unexported fields }
func (*QOS) Descriptor
deprecated
added in
v1.1.14
func (*QOS) GetReplicationStrategy ¶ added in v1.1.14
func (x *QOS) GetReplicationStrategy() ReplicationStrategy
func (*QOS) ProtoMessage ¶ added in v1.1.14
func (*QOS) ProtoMessage()
func (*QOS) ProtoReflect ¶ added in v1.1.14
func (x *QOS) ProtoReflect() protoreflect.Message
type RPC ¶
type RPC struct { Tag uint64 `protobuf:"varint,1,opt,name=tag,proto3" json:"tag,omitempty"` ServiceName string `protobuf:"bytes,2,opt,name=serviceName,proto3" json:"serviceName,omitempty"` MethodName string `protobuf:"bytes,3,opt,name=methodName,proto3" json:"methodName,omitempty"` // Types that are assignable to Content: // // *RPC_Request // *RPC_Response Content isRPC_Content `protobuf_oneof:"content"` Metadata *MD `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"` // contains filtered or unexported fields }
func (*RPC) Descriptor
deprecated
func (*RPC) GetContent ¶
func (m *RPC) GetContent() isRPC_Content
func (*RPC) GetMetadata ¶ added in v1.1.14
func (*RPC) GetMethodName ¶ added in v1.1.14
func (*RPC) GetRequest ¶
func (*RPC) GetResponse ¶
func (*RPC) GetServiceName ¶ added in v1.1.14
func (*RPC) ProtoMessage ¶
func (*RPC) ProtoMessage()
func (*RPC) ProtoReflect ¶
func (x *RPC) ProtoReflect() protoreflect.Message
func (*RPC) QualifiedMethodName ¶ added in v1.1.14
type RPC_Request ¶
type RPC_Request struct {
Request []byte `protobuf:"bytes,4,opt,name=request,proto3,oneof"`
}
type RPC_Response ¶
type RPC_Response struct {
Response *Response `protobuf:"bytes,5,opt,name=response,proto3,oneof"`
}
type ReplicationStrategy ¶ added in v1.1.14
type ReplicationStrategy int32
const ( ReplicationStrategy_First ReplicationStrategy = 0 ReplicationStrategy_Broadcast ReplicationStrategy = 1 )
func (ReplicationStrategy) Descriptor ¶ added in v1.1.14
func (ReplicationStrategy) Descriptor() protoreflect.EnumDescriptor
func (ReplicationStrategy) Enum ¶ added in v1.1.14
func (x ReplicationStrategy) Enum() *ReplicationStrategy
func (ReplicationStrategy) EnumDescriptor
deprecated
added in
v1.1.14
func (ReplicationStrategy) EnumDescriptor() ([]byte, []int)
Deprecated: Use ReplicationStrategy.Descriptor instead.
func (ReplicationStrategy) Number ¶ added in v1.1.14
func (x ReplicationStrategy) Number() protoreflect.EnumNumber
func (ReplicationStrategy) String ¶ added in v1.1.14
func (x ReplicationStrategy) String() string
func (ReplicationStrategy) Type ¶ added in v1.1.14
func (ReplicationStrategy) Type() protoreflect.EnumType
type Response ¶
type Response struct { Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` StatusProto *status.Status `protobuf:"bytes,2,opt,name=statusProto,proto3" json:"statusProto,omitempty"` // contains filtered or unexported fields }
func (*Response) Descriptor
deprecated
func (*Response) GetResponse ¶
func (*Response) GetStatusProto ¶ added in v1.1.14
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type Server ¶
type Server struct { ServerOptions // contains filtered or unexported fields }
func (*Server) Context ¶ added in v1.1.14
Returns the server's stream context. Only valid after Serve has been called.
func (*Server) RegisterService ¶
func (r *Server) RegisterService(desc *grpc.ServiceDesc, impl interface{})
Implements grpc.ServiceRegistrar
type ServerOption ¶ added in v1.1.14
type ServerOption func(*ServerOptions)
func WithName ¶ added in v1.1.14
func WithName(name string) ServerOption
func WithUnaryServerInterceptor ¶
func WithUnaryServerInterceptor(interceptor grpc.UnaryServerInterceptor) ServerOption
type ServerOptions ¶ added in v1.1.14
type ServerOptions struct {
// contains filtered or unexported fields
}
type ServerReflectionClient ¶ added in v1.1.14
type ServerReflectionClient interface {
ListServices(ctx context.Context, in *DiscoveryRequest, opts ...grpc.CallOption) (*ServiceInfo, error)
}
ServerReflectionClient is the client API for ServerReflection 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 NewServerReflectionClient ¶ added in v1.1.14
func NewServerReflectionClient(cc grpc.ClientConnInterface) ServerReflectionClient
type ServerReflectionServer ¶ added in v1.1.14
type ServerReflectionServer interface { ListServices(context.Context, *DiscoveryRequest) (*ServiceInfo, error) // contains filtered or unexported methods }
ServerReflectionServer is the server API for ServerReflection service. All implementations must embed UnimplementedServerReflectionServer for forward compatibility
type ServerStream ¶
type ServerStream interface { Stream grpc.ServerStream }
type ServiceHandler ¶ added in v1.1.14
type ServiceHandler struct { Descriptor *descriptorpb.ServiceDescriptorProto MethodInvokers map[string]MethodInvoker MethodQOS map[string]*QOS IsLocal bool // contains filtered or unexported fields }
func NewDefaultServiceHandler ¶ added in v1.1.14
func NewDefaultServiceHandler( ctx context.Context, descriptor *descriptorpb.ServiceDescriptorProto, invoker MethodInvoker, ) *ServiceHandler
func (*ServiceHandler) Done ¶ added in v1.1.14
func (s *ServiceHandler) Done() <-chan struct{}
type ServiceHandlerList ¶ added in v1.1.14
type ServiceHandlerList struct {
// contains filtered or unexported fields
}
func (*ServiceHandlerList) Append ¶ added in v1.1.14
func (s *ServiceHandlerList) Append(sh *ServiceHandler)
func (*ServiceHandlerList) First ¶ added in v1.1.14
func (s *ServiceHandlerList) First() *ServiceHandler
func (*ServiceHandlerList) Len ¶ added in v1.1.14
func (s *ServiceHandlerList) Len() int
func (*ServiceHandlerList) Range ¶ added in v1.1.14
func (s *ServiceHandlerList) Range(fn func(sh *ServiceHandler) bool) bool
type ServiceInfo ¶ added in v1.1.14
type ServiceInfo struct { Services []*descriptorpb.ServiceDescriptorProto `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` // contains filtered or unexported fields }
func (*ServiceInfo) Descriptor
deprecated
added in
v1.1.14
func (*ServiceInfo) Descriptor() ([]byte, []int)
Deprecated: Use ServiceInfo.ProtoReflect.Descriptor instead.
func (*ServiceInfo) GetServices ¶ added in v1.1.14
func (x *ServiceInfo) GetServices() []*descriptorpb.ServiceDescriptorProto
func (*ServiceInfo) MethodNames ¶ added in v1.1.14
func (i *ServiceInfo) MethodNames() []string
func (*ServiceInfo) ProtoMessage ¶ added in v1.1.14
func (*ServiceInfo) ProtoMessage()
func (*ServiceInfo) ProtoReflect ¶ added in v1.1.14
func (x *ServiceInfo) ProtoReflect() protoreflect.Message
func (*ServiceInfo) Reset ¶ added in v1.1.14
func (x *ServiceInfo) Reset()
func (*ServiceInfo) String ¶ added in v1.1.14
func (x *ServiceInfo) String() string
type StreamController ¶ added in v1.1.14
type StreamController struct { UnimplementedServerReflectionServer StreamControllerOptions // contains filtered or unexported fields }
func NewStreamController ¶ added in v1.1.14
func NewStreamController(stream Stream, options ...StreamControllerOption) *StreamController
NewStreamController creates a new stream controller for the given stream and method set. There can be at most one stream controller per stream.
func (*StreamController) CloseOrRecv ¶ added in v1.1.14
func (sh *StreamController) CloseOrRecv() error
If the stream is a client stream, this will call CloseSend on the stream. If the stream is a server stream, this will call Recv on the stream until it returns io.EOF.
func (*StreamController) Kick ¶ added in v1.1.14
func (sh *StreamController) Kick(err error)
func (*StreamController) ListServices ¶ added in v1.1.14
func (sh *StreamController) ListServices(ctx context.Context, req *DiscoveryRequest) (*ServiceInfo, error)
func (*StreamController) NewInvoker ¶ added in v1.1.14
func (sh *StreamController) NewInvoker() MethodInvoker
func (*StreamController) RegisterServiceHandler ¶ added in v1.1.14
func (sh *StreamController) RegisterServiceHandler(handler *ServiceHandler)
func (*StreamController) Reply ¶ added in v1.1.14
func (sh *StreamController) Reply(ctx context.Context, tag uint64, data []byte)
func (*StreamController) ReplyErr ¶ added in v1.1.14
func (sh *StreamController) ReplyErr(ctx context.Context, tag uint64, reply error)
type StreamControllerOption ¶ added in v1.1.14
type StreamControllerOption func(*StreamControllerOptions)
func WithLogger ¶ added in v1.1.14
func WithLogger(logger *zap.Logger) StreamControllerOption
func WithStreamName ¶ added in v1.1.14
func WithStreamName(name string) StreamControllerOption
type StreamControllerOptions ¶ added in v1.1.14
type StreamControllerOptions struct {
// contains filtered or unexported fields
}
type UnimplementedServerReflectionServer ¶ added in v1.1.14
type UnimplementedServerReflectionServer struct { }
UnimplementedServerReflectionServer must be embedded to have forward compatible implementations.
func (UnimplementedServerReflectionServer) ListServices ¶ added in v1.1.14
func (UnimplementedServerReflectionServer) ListServices(context.Context, *DiscoveryRequest) (*ServiceInfo, error)
type UnsafeServerReflectionServer ¶ added in v1.1.14
type UnsafeServerReflectionServer interface {
// contains filtered or unexported methods
}
UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServerReflectionServer will result in compilation errors.
type Visibility ¶ added in v1.1.14
type Visibility struct { SplicedClients bool `protobuf:"varint,1,opt,name=splicedClients,proto3" json:"splicedClients,omitempty"` // contains filtered or unexported fields }
func (*Visibility) Descriptor
deprecated
added in
v1.1.14
func (*Visibility) Descriptor() ([]byte, []int)
Deprecated: Use Visibility.ProtoReflect.Descriptor instead.
func (*Visibility) GetSplicedClients ¶ added in v1.1.14
func (x *Visibility) GetSplicedClients() bool
func (*Visibility) ProtoMessage ¶ added in v1.1.14
func (*Visibility) ProtoMessage()
func (*Visibility) ProtoReflect ¶ added in v1.1.14
func (x *Visibility) ProtoReflect() protoreflect.Message
func (*Visibility) Reset ¶ added in v1.1.14
func (x *Visibility) Reset()
func (*Visibility) String ¶ added in v1.1.14
func (x *Visibility) String() string