streamer

package
v0.0.0-...-aa30a3e Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Streamer_Increment_FullMethodName = "/streamer.Streamer/Increment"
	Streamer_Pipeline_FullMethodName  = "/streamer.Streamer/Pipeline"
)

Variables

View Source
var File_streamer_streamer_proto protoreflect.FileDescriptor
View Source
var Streamer_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "streamer.Streamer",
	HandlerType: (*StreamerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Increment",
			Handler:    _Streamer_Increment_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Pipeline",
			Handler:       _Streamer_Pipeline_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "streamer/streamer.proto",
}

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

Functions

func ForkAndDial

func ForkAndDial() (grpc.ClientConnInterface, func(), error)

ForkAndDial forks the current executable with a socketpair on fd 3, dials the child over gRPC, and returns the connection + a cleanup function that closes the connection and waits for the child to exit.

func InheritedConn

func InheritedConn() (net.Conn, error)

InheritedConn returns a net.Conn wrapping fd 3 if it exists.

func NewStreamerServer

func NewStreamerServer() *streamerServer

func RegisterStreamerServer

func RegisterStreamerServer(s grpc.ServiceRegistrar, srv StreamerServer)

Types

type PipelineConfig

type PipelineConfig struct {
	Method *descriptorpb.MethodDescriptorProto `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
	Depth  int32                               `protobuf:"varint,2,opt,name=depth,proto3" json:"depth,omitempty"` // fork levels remaining (0 = leaf, no more forks)
	// contains filtered or unexported fields
}

func (*PipelineConfig) Descriptor deprecated

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

Deprecated: Use PipelineConfig.ProtoReflect.Descriptor instead.

func (*PipelineConfig) GetDepth

func (x *PipelineConfig) GetDepth() int32

func (*PipelineConfig) GetMethod

func (*PipelineConfig) ProtoMessage

func (*PipelineConfig) ProtoMessage()

func (*PipelineConfig) ProtoReflect

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

func (*PipelineConfig) Reset

func (x *PipelineConfig) Reset()

func (*PipelineConfig) String

func (x *PipelineConfig) String() string

type PipelineMessage

type PipelineMessage struct {

	// Types that are valid to be assigned to Msg:
	//
	//	*PipelineMessage_Config
	//	*PipelineMessage_Value
	Msg isPipelineMessage_Msg `protobuf_oneof:"msg"`
	// contains filtered or unexported fields
}

func (*PipelineMessage) Descriptor deprecated

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

Deprecated: Use PipelineMessage.ProtoReflect.Descriptor instead.

func (*PipelineMessage) GetConfig

func (x *PipelineMessage) GetConfig() *PipelineConfig

func (*PipelineMessage) GetMsg

func (x *PipelineMessage) GetMsg() isPipelineMessage_Msg

func (*PipelineMessage) GetValue

func (x *PipelineMessage) GetValue() *anypb.Any

func (*PipelineMessage) ProtoMessage

func (*PipelineMessage) ProtoMessage()

func (*PipelineMessage) ProtoReflect

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

func (*PipelineMessage) Reset

func (x *PipelineMessage) Reset()

func (*PipelineMessage) String

func (x *PipelineMessage) String() string

type PipelineMessage_Config

type PipelineMessage_Config struct {
	Config *PipelineConfig `protobuf:"bytes,1,opt,name=config,proto3,oneof"`
}

type PipelineMessage_Value

type PipelineMessage_Value struct {
	Value *anypb.Any `protobuf:"bytes,2,opt,name=value,proto3,oneof"`
}

type StreamerClient

type StreamerClient interface {
	// Increment unpacks a numeric Any (Int64Value), adds 1, repacks it.
	Increment(ctx context.Context, in *anypb.Any, opts ...grpc.CallOption) (*anypb.Any, error)
	// Pipeline is a bidi stream that builds a fork chain.
	// First message carries PipelineConfig (method descriptor + depth).
	// Subsequent messages carry values. Each pipeline level applies
	// the described method to each value and forwards it downstream.
	// Results stream back through the chain.
	Pipeline(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[PipelineMessage, PipelineMessage], error)
}

StreamerClient is the client API for Streamer 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 NewStreamerClient

func NewStreamerClient(cc grpc.ClientConnInterface) StreamerClient

type StreamerServer

type StreamerServer interface {
	// Increment unpacks a numeric Any (Int64Value), adds 1, repacks it.
	Increment(context.Context, *anypb.Any) (*anypb.Any, error)
	// Pipeline is a bidi stream that builds a fork chain.
	// First message carries PipelineConfig (method descriptor + depth).
	// Subsequent messages carry values. Each pipeline level applies
	// the described method to each value and forwards it downstream.
	// Results stream back through the chain.
	Pipeline(grpc.BidiStreamingServer[PipelineMessage, PipelineMessage]) error
	// contains filtered or unexported methods
}

StreamerServer is the server API for Streamer service. All implementations must embed UnimplementedStreamerServer for forward compatibility.

type Streamer_PipelineClient

type Streamer_PipelineClient = grpc.BidiStreamingClient[PipelineMessage, PipelineMessage]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Streamer_PipelineServer

type Streamer_PipelineServer = grpc.BidiStreamingServer[PipelineMessage, PipelineMessage]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type UnimplementedStreamerServer

type UnimplementedStreamerServer struct{}

UnimplementedStreamerServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedStreamerServer) Increment

type UnsafeStreamerServer

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

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

Jump to

Keyboard shortcuts

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