pb

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_infra_pb_image_proto protoreflect.FileDescriptor
View Source
var ImageIOService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pb.ImageIOService",
	HandlerType: (*ImageIOServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Pull",
			Handler:       _ImageIOService_Pull_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Push",
			Handler:       _ImageIOService_Push_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "infra/pb/image.proto",
}

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

Functions

func Receive

func Receive(from PacketReceiver, to io.Writer, tracker ProgressTracker) error

Receive receives Packets from provided PacketReceiver and writes their content into the provided Writer. Progress is reported through a ProgressTracker.

func RegisterImageIOServiceServer

func RegisterImageIOServiceServer(s grpc.ServiceRegistrar, srv ImageIOServiceServer)

func Send

func Send(from io.Reader, totalSize int64, to PacketSender, tracker ProgressTracker) error

Send sends contents of provided Reader through a PacketSender. Content is split into chunks of 1024 bytes. From time to time this function also sends over the wire a progress message, informing the total file size and the current offset.

func SendProgressMessage

func SendProgressMessage(offset int64, size int64, sender PacketSender) error

SendProgressMessage sends a progress message down the protobuf connection. This message contains the total file size and the current offset.

Types

type Chunk

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

Chunk is a message containing part of a file.

func (*Chunk) Descriptor deprecated

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

Deprecated: Use Chunk.ProtoReflect.Descriptor instead.

func (*Chunk) GetContent

func (x *Chunk) GetContent() []byte

func (*Chunk) ProtoMessage

func (*Chunk) ProtoMessage()

func (*Chunk) ProtoReflect

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

func (*Chunk) Reset

func (x *Chunk) Reset()

func (*Chunk) String

func (x *Chunk) String() string
type Header struct {
	Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
	Name      string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Token     string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
	// contains filtered or unexported fields
}

Header identifies an user (through a token) and an image (through namespace and name). This is used to when informing which user is requesting wich image during pull and push operations.

func (*Header) Descriptor deprecated

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

Deprecated: Use Header.ProtoReflect.Descriptor instead.

func (*Header) GetName

func (x *Header) GetName() string

func (*Header) GetNamespace

func (x *Header) GetNamespace() string

func (*Header) GetToken

func (x *Header) GetToken() string

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) ProtoReflect

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

func (*Header) Reset

func (x *Header) Reset()

func (*Header) String

func (x *Header) String() string

type ImageIOServiceClient

type ImageIOServiceClient interface {
	Pull(ctx context.Context, in *Packet, opts ...grpc.CallOption) (ImageIOService_PullClient, error)
	Push(ctx context.Context, opts ...grpc.CallOption) (ImageIOService_PushClient, error)
}

ImageIOServiceClient is the client API for ImageIOService 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.

type ImageIOServiceServer

type ImageIOServiceServer interface {
	Pull(*Packet, ImageIOService_PullServer) error
	Push(ImageIOService_PushServer) error
	// contains filtered or unexported methods
}

ImageIOServiceServer is the server API for ImageIOService service. All implementations must embed UnimplementedImageIOServiceServer for forward compatibility

type ImageIOService_PullClient

type ImageIOService_PullClient interface {
	Recv() (*Packet, error)
	grpc.ClientStream
}

type ImageIOService_PullServer

type ImageIOService_PullServer interface {
	Send(*Packet) error
	grpc.ServerStream
}

type ImageIOService_PushClient

type ImageIOService_PushClient interface {
	Send(*Packet) error
	CloseAndRecv() (*Packet, error)
	grpc.ClientStream
}

type ImageIOService_PushServer

type ImageIOService_PushServer interface {
	SendAndClose(*Packet) error
	Recv() (*Packet, error)
	grpc.ServerStream
}

type Packet

type Packet struct {

	// Types that are assignable to TestOneof:
	//	*Packet_Header
	//	*Packet_Progress
	//	*Packet_Chunk
	TestOneof isPacket_TestOneof `protobuf_oneof:"test_oneof"`
	// contains filtered or unexported fields
}

Packet is what goes through the wire. It contains or an Header, or a Progress or a Chunk of data.

func (*Packet) Descriptor deprecated

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

Deprecated: Use Packet.ProtoReflect.Descriptor instead.

func (*Packet) GetChunk

func (x *Packet) GetChunk() *Chunk

func (*Packet) GetHeader

func (x *Packet) GetHeader() *Header

func (*Packet) GetProgress

func (x *Packet) GetProgress() *Progress

func (*Packet) GetTestOneof

func (m *Packet) GetTestOneof() isPacket_TestOneof

func (*Packet) ProtoMessage

func (*Packet) ProtoMessage()

func (*Packet) ProtoReflect

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

func (*Packet) Reset

func (x *Packet) Reset()

func (*Packet) String

func (x *Packet) String() string

type PacketReceiver

type PacketReceiver interface {
	Recv() (*Packet, error)
}

PacketReceiver is anything capable of receiving a Packet.

type PacketSender

type PacketSender interface {
	Send(*Packet) error
}

PacketSender is something capable of sending a Packet struct.

type Packet_Chunk

type Packet_Chunk struct {
	Chunk *Chunk `protobuf:"bytes,3,opt,name=chunk,proto3,oneof"`
}

type Packet_Header

type Packet_Header struct {
	Header *Header `protobuf:"bytes,1,opt,name=header,proto3,oneof"`
}

type Packet_Progress

type Packet_Progress struct {
	Progress *Progress `protobuf:"bytes,2,opt,name=progress,proto3,oneof"`
}

type Progress

type Progress struct {
	Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"`
	Size   int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
	// contains filtered or unexported fields
}

Progress is a message informing what is the current offset and what is the total size of a file. It is used to inform clients about a file transfer status.

func (*Progress) Descriptor deprecated

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

Deprecated: Use Progress.ProtoReflect.Descriptor instead.

func (*Progress) GetOffset

func (x *Progress) GetOffset() int64

func (*Progress) GetSize

func (x *Progress) GetSize() int64

func (*Progress) ProtoMessage

func (*Progress) ProtoMessage()

func (*Progress) ProtoReflect

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

func (*Progress) Reset

func (x *Progress) Reset()

func (*Progress) String

func (x *Progress) String() string

type ProgressTracker

type ProgressTracker interface {
	SetMax(int64)
	SetCurrent(int64)
}

ProgressTracker is the interface used to track progress during a send or receive of a file. SetMax is called only once and prior to any SetCurrent call.

type UnimplementedImageIOServiceServer

type UnimplementedImageIOServiceServer struct {
}

UnimplementedImageIOServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedImageIOServiceServer) Pull

func (UnimplementedImageIOServiceServer) Push

type UnsafeImageIOServiceServer

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

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

Jump to

Keyboard shortcuts

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