Documentation
¶
Overview ¶
Package bytestream provides a client for any service that exposes a ByteStream API.
Note: This package is a work-in-progress. Backwards-incompatible changes should be expected.
Index ¶
- Constants
- Variables
- func RegisterByteStreamServer(s *grpc.Server, srv ByteStreamServer)
- type ByteStreamClient
- type ByteStreamServer
- type ByteStream_ReadClient
- type ByteStream_ReadServer
- type ByteStream_WriteClient
- type ByteStream_WriteServer
- type Client
- type QueryWriteStatusRequest
- func (*QueryWriteStatusRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryWriteStatusRequest) GetResourceName() string
- func (*QueryWriteStatusRequest) ProtoMessage()
- func (x *QueryWriteStatusRequest) ProtoReflect() protoreflect.Message
- func (x *QueryWriteStatusRequest) Reset()
- func (x *QueryWriteStatusRequest) String() string
- type QueryWriteStatusResponse
- func (*QueryWriteStatusResponse) Descriptor() ([]byte, []int)deprecated
- func (x *QueryWriteStatusResponse) GetCommittedSize() int64
- func (x *QueryWriteStatusResponse) GetComplete() bool
- func (*QueryWriteStatusResponse) ProtoMessage()
- func (x *QueryWriteStatusResponse) ProtoReflect() protoreflect.Message
- func (x *QueryWriteStatusResponse) Reset()
- func (x *QueryWriteStatusResponse) String() string
- type ReadRequest
- func (*ReadRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ReadRequest) GetReadLimit() int64
- func (x *ReadRequest) GetReadOffset() int64
- func (x *ReadRequest) GetResourceName() string
- func (*ReadRequest) ProtoMessage()
- func (x *ReadRequest) ProtoReflect() protoreflect.Message
- func (x *ReadRequest) Reset()
- func (x *ReadRequest) String() string
- type ReadResponse
- type Reader
- type UnimplementedByteStreamServer
- type WriteRequest
- func (*WriteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *WriteRequest) GetData() []byte
- func (x *WriteRequest) GetFinishWrite() bool
- func (x *WriteRequest) GetResourceName() string
- func (x *WriteRequest) GetWriteOffset() int64
- func (*WriteRequest) ProtoMessage()
- func (x *WriteRequest) ProtoReflect() protoreflect.Message
- func (x *WriteRequest) Reset()
- func (x *WriteRequest) String() string
- type WriteResponse
- type Writer
Constants ¶
const (
// MaxBufSize is the maximum buffer size (in bytes) received in a read chunk or sent in a write chunk.
MaxBufSize = 2 * 1024 * 1024
)
Variables ¶
var File_bazel_bytestream_bytestream_proto protoreflect.FileDescriptor
Functions ¶
func RegisterByteStreamServer ¶
func RegisterByteStreamServer(s *grpc.Server, srv ByteStreamServer)
Types ¶
type ByteStreamClient ¶
type ByteStreamClient interface {
Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (ByteStream_ReadClient, error)
Write(ctx context.Context, opts ...grpc.CallOption) (ByteStream_WriteClient, error)
QueryWriteStatus(ctx context.Context, in *QueryWriteStatusRequest, opts ...grpc.CallOption) (*QueryWriteStatusResponse, error)
}
ByteStreamClient is the client API for ByteStream service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewByteStreamClient ¶
func NewByteStreamClient(cc grpc.ClientConnInterface) ByteStreamClient
type ByteStreamServer ¶
type ByteStreamServer interface {
Read(*ReadRequest, ByteStream_ReadServer) error
Write(ByteStream_WriteServer) error
QueryWriteStatus(context.Context, *QueryWriteStatusRequest) (*QueryWriteStatusResponse, error)
}
ByteStreamServer is the server API for ByteStream service.
type ByteStream_ReadClient ¶
type ByteStream_ReadClient interface {
Recv() (*ReadResponse, error)
grpc.ClientStream
}
type ByteStream_ReadServer ¶
type ByteStream_ReadServer interface {
Send(*ReadResponse) error
grpc.ServerStream
}
type ByteStream_WriteClient ¶
type ByteStream_WriteClient interface {
Send(*WriteRequest) error
CloseAndRecv() (*WriteResponse, error)
grpc.ClientStream
}
type ByteStream_WriteServer ¶
type ByteStream_WriteServer interface {
SendAndClose(*WriteResponse) error
Recv() (*WriteRequest, error)
grpc.ServerStream
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the go wrapper around a ByteStreamClient and provides an interface to it.
func NewClient ¶
func NewClient(cc *grpc.ClientConn, options ...grpc.CallOption) *Client
NewClient creates a new bytestream.Client.
func (*Client) Close ¶
func (c *Client) Close()
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) NewReaderAt ¶
func (c *Client) NewReaderAt(ctx context.Context, resourceName string, offset int64) (*Reader, error)
NewReaderAt creates a new Reader to read a resource from the given offset.
func (*Client) NewWriter ¶
NewWriter creates a new Writer to write a resource.
resourceName specifies the name of the resource. The resource will be available after Close has been called.
It is the caller's responsibility to call Close when writing is done.
TODO: There is currently no way to resume a write. Maybe NewWriter should begin with a call to QueryWriteStatus.
type QueryWriteStatusRequest ¶
type QueryWriteStatusRequest struct {
ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"`
// contains filtered or unexported fields
}
func (*QueryWriteStatusRequest) Descriptor
deprecated
func (*QueryWriteStatusRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryWriteStatusRequest.ProtoReflect.Descriptor instead.
func (*QueryWriteStatusRequest) GetResourceName ¶
func (x *QueryWriteStatusRequest) GetResourceName() string
func (*QueryWriteStatusRequest) ProtoMessage ¶
func (*QueryWriteStatusRequest) ProtoMessage()
func (*QueryWriteStatusRequest) ProtoReflect ¶
func (x *QueryWriteStatusRequest) ProtoReflect() protoreflect.Message
func (*QueryWriteStatusRequest) Reset ¶
func (x *QueryWriteStatusRequest) Reset()
func (*QueryWriteStatusRequest) String ¶
func (x *QueryWriteStatusRequest) String() string
type QueryWriteStatusResponse ¶
type QueryWriteStatusResponse struct {
CommittedSize int64 `protobuf:"varint,1,opt,name=committed_size,json=committedSize,proto3" json:"committed_size,omitempty"`
Complete bool `protobuf:"varint,2,opt,name=complete,proto3" json:"complete,omitempty"`
// contains filtered or unexported fields
}
func (*QueryWriteStatusResponse) Descriptor
deprecated
func (*QueryWriteStatusResponse) Descriptor() ([]byte, []int)
Deprecated: Use QueryWriteStatusResponse.ProtoReflect.Descriptor instead.
func (*QueryWriteStatusResponse) GetCommittedSize ¶
func (x *QueryWriteStatusResponse) GetCommittedSize() int64
func (*QueryWriteStatusResponse) GetComplete ¶
func (x *QueryWriteStatusResponse) GetComplete() bool
func (*QueryWriteStatusResponse) ProtoMessage ¶
func (*QueryWriteStatusResponse) ProtoMessage()
func (*QueryWriteStatusResponse) ProtoReflect ¶
func (x *QueryWriteStatusResponse) ProtoReflect() protoreflect.Message
func (*QueryWriteStatusResponse) Reset ¶
func (x *QueryWriteStatusResponse) Reset()
func (*QueryWriteStatusResponse) String ¶
func (x *QueryWriteStatusResponse) String() string
type ReadRequest ¶
type ReadRequest struct {
ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"`
ReadOffset int64 `protobuf:"varint,2,opt,name=read_offset,json=readOffset,proto3" json:"read_offset,omitempty"`
ReadLimit int64 `protobuf:"varint,3,opt,name=read_limit,json=readLimit,proto3" json:"read_limit,omitempty"`
// contains filtered or unexported fields
}
func (*ReadRequest) Descriptor
deprecated
func (*ReadRequest) Descriptor() ([]byte, []int)
Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.
func (*ReadRequest) GetReadLimit ¶
func (x *ReadRequest) GetReadLimit() int64
func (*ReadRequest) GetReadOffset ¶
func (x *ReadRequest) GetReadOffset() int64
func (*ReadRequest) GetResourceName ¶
func (x *ReadRequest) GetResourceName() string
func (*ReadRequest) ProtoMessage ¶
func (*ReadRequest) ProtoMessage()
func (*ReadRequest) ProtoReflect ¶
func (x *ReadRequest) ProtoReflect() protoreflect.Message
func (*ReadRequest) Reset ¶
func (x *ReadRequest) Reset()
func (*ReadRequest) String ¶
func (x *ReadRequest) String() string
type ReadResponse ¶
type ReadResponse struct {
Data []byte `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"`
// contains filtered or unexported fields
}
func (*ReadResponse) Descriptor
deprecated
func (*ReadResponse) Descriptor() ([]byte, []int)
Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.
func (*ReadResponse) GetData ¶
func (x *ReadResponse) GetData() []byte
func (*ReadResponse) ProtoMessage ¶
func (*ReadResponse) ProtoMessage()
func (*ReadResponse) ProtoReflect ¶
func (x *ReadResponse) ProtoReflect() protoreflect.Message
func (*ReadResponse) Reset ¶
func (x *ReadResponse) Reset()
func (*ReadResponse) String ¶
func (x *ReadResponse) String() string
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads from a byte stream.
func (*Reader) ResourceName ¶
ResourceName gets the resource name this Reader is reading.
type UnimplementedByteStreamServer ¶
type UnimplementedByteStreamServer struct {
}
UnimplementedByteStreamServer can be embedded to have forward compatible implementations.
func (*UnimplementedByteStreamServer) QueryWriteStatus ¶
func (*UnimplementedByteStreamServer) QueryWriteStatus(context.Context, *QueryWriteStatusRequest) (*QueryWriteStatusResponse, error)
func (*UnimplementedByteStreamServer) Read ¶
func (*UnimplementedByteStreamServer) Read(*ReadRequest, ByteStream_ReadServer) error
func (*UnimplementedByteStreamServer) Write ¶
func (*UnimplementedByteStreamServer) Write(ByteStream_WriteServer) error
type WriteRequest ¶
type WriteRequest struct {
ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"`
WriteOffset int64 `protobuf:"varint,2,opt,name=write_offset,json=writeOffset,proto3" json:"write_offset,omitempty"`
FinishWrite bool `protobuf:"varint,3,opt,name=finish_write,json=finishWrite,proto3" json:"finish_write,omitempty"`
Data []byte `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"`
// contains filtered or unexported fields
}
func (*WriteRequest) Descriptor
deprecated
func (*WriteRequest) Descriptor() ([]byte, []int)
Deprecated: Use WriteRequest.ProtoReflect.Descriptor instead.
func (*WriteRequest) GetData ¶
func (x *WriteRequest) GetData() []byte
func (*WriteRequest) GetFinishWrite ¶
func (x *WriteRequest) GetFinishWrite() bool
func (*WriteRequest) GetResourceName ¶
func (x *WriteRequest) GetResourceName() string
func (*WriteRequest) GetWriteOffset ¶
func (x *WriteRequest) GetWriteOffset() int64
func (*WriteRequest) ProtoMessage ¶
func (*WriteRequest) ProtoMessage()
func (*WriteRequest) ProtoReflect ¶
func (x *WriteRequest) ProtoReflect() protoreflect.Message
func (*WriteRequest) Reset ¶
func (x *WriteRequest) Reset()
func (*WriteRequest) String ¶
func (x *WriteRequest) String() string
type WriteResponse ¶
type WriteResponse struct {
CommittedSize int64 `protobuf:"varint,1,opt,name=committed_size,json=committedSize,proto3" json:"committed_size,omitempty"`
// contains filtered or unexported fields
}
func (*WriteResponse) Descriptor
deprecated
func (*WriteResponse) Descriptor() ([]byte, []int)
Deprecated: Use WriteResponse.ProtoReflect.Descriptor instead.
func (*WriteResponse) GetCommittedSize ¶
func (x *WriteResponse) GetCommittedSize() int64
func (*WriteResponse) ProtoMessage ¶
func (*WriteResponse) ProtoMessage()
func (*WriteResponse) ProtoReflect ¶
func (x *WriteResponse) ProtoReflect() protoreflect.Message
func (*WriteResponse) Reset ¶
func (x *WriteResponse) Reset()
func (*WriteResponse) String ¶
func (x *WriteResponse) String() string
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer writes to a byte stream.
func (*Writer) Close ¶
Close implements io.Closer. It is the caller's responsibility to call Close() when writing is done.
func (*Writer) ResourceName ¶
ResourceName gets the resource name this Writer is writing.