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 ¶
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 ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) NewReaderAt ¶
func (c *Client) NewReaderAt(ctx context.Context, resourceName string, offset int64) (*Reader, error)
NewReader 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 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 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.