Documentation ¶
Index ¶
- Constants
- Variables
- func Chunk(data []byte, chunkSize int) [][]byte
- func ChunkReader(r io.Reader, f func([]byte) error) (int, error)
- func GetBuffer() []byte
- func NewStreamingBytesReader(streamingBytesClient StreamingBytesClient, cancel context.CancelFunc) io.ReadCloser
- func NewStreamingBytesWriter(streamingBytesServer StreamingBytesServer) io.Writer
- func PutBuffer(buf []byte)
- func ScrubGRPC(err error) error
- func WriteFromStreamingBytesClient(streamingBytesClient StreamingBytesClient, writer io.Writer) error
- func WriteToStreamingBytesServer(reader io.Reader, streamingBytesServer StreamingBytesServer) error
- type BufPool
- type ChunkWriteCloser
- type Dialer
- type PachdAddress
- type ReaderWrapper
- type Server
- type StreamingBytesClient
- type StreamingBytesServer
Constants ¶
const ( // DefaultPachdNodePort is the pachd kubernetes service's default // NodePort.Port setting DefaultPachdNodePort = 30650 // DefaultPachdPort is the pachd kubernetes service's default // Port (often used with Pachyderm ELBs) DefaultPachdPort = 650 )
Variables ¶
var ( // ErrNoPachdAddress is returned by ParsePachdAddress when the input is an // empty string ErrNoPachdAddress = errors.New("no pachd address specified") // DefaultPachdAddress is the default PachdAddress that should be used // if none is otherwise specified. It's a loopback that should rely on // port forwarding. DefaultPachdAddress = PachdAddress{ Secured: false, Host: "0.0.0.0", Port: DefaultPachdNodePort, } )
var (
// MaxMsgSize is used to define the GRPC frame size
MaxMsgSize = 20 * 1024 * 1024
)
Functions ¶
func Chunk ¶ added in v1.4.5
Chunk splits a piece of data up, this is useful for splitting up data that's bigger than MaxMsgSize
func ChunkReader ¶ added in v1.4.6
ChunkReader splits a reader into reasonably sized chunks for the purpose of transmitting the chunks over gRPC. For each chunk, it calls the given function.
func GetBuffer ¶ added in v1.4.6
func GetBuffer() []byte
GetBuffer returns a buffer. The buffer may or may not be freshly allocated, and it may or may not be zero-ed.
func NewStreamingBytesReader ¶ added in v1.3.5
func NewStreamingBytesReader(streamingBytesClient StreamingBytesClient, cancel context.CancelFunc) io.ReadCloser
NewStreamingBytesReader returns an io.Reader for a StreamingBytesClient.
func NewStreamingBytesWriter ¶ added in v1.3.5
func NewStreamingBytesWriter(streamingBytesServer StreamingBytesServer) io.Writer
NewStreamingBytesWriter returns an io.Writer for a StreamingBytesServer.
func PutBuffer ¶ added in v1.4.6
func PutBuffer(buf []byte)
PutBuffer returns the buffer to the pool.
func ScrubGRPC ¶ added in v1.6.0
ScrubGRPC removes GRPC error code information from 'err' if it came from GRPC (and returns it unchanged otherwise)
func WriteFromStreamingBytesClient ¶ added in v1.3.5
func WriteFromStreamingBytesClient(streamingBytesClient StreamingBytesClient, writer io.Writer) error
WriteFromStreamingBytesClient writes from the StreamingBytesClient to the io.Writer.
func WriteToStreamingBytesServer ¶ added in v1.3.5
func WriteToStreamingBytesServer(reader io.Reader, streamingBytesServer StreamingBytesServer) error
WriteToStreamingBytesServer writes the data from the io.Reader to the StreamingBytesServer.
Types ¶
type BufPool ¶ added in v1.8.3
BufPool is a wrapper around sync.Pool that makes it a little nicer to use for []byte by doing the casting for you and defining the `New` function.
func NewBufPool ¶ added in v1.8.3
NewBufPool creates a new BufPool that returns buffers of the given size.
type ChunkWriteCloser ¶ added in v1.8.8
type ChunkWriteCloser struct {
// contains filtered or unexported fields
}
ChunkWriteCloser is a utility for buffering writes into buffers obtained from a buffer pool. The ChunkWriteCloser will buffer up to the capacity of a buffer obtained from a buffer pool, then execute a callback that will receive the buffered data. The ChunkWriteCloser will get a new buffer from the pool for subsequent writes, so it is expected that the callback will return the buffer to the pool.
func NewChunkWriteCloser ¶ added in v1.8.8
func NewChunkWriteCloser(bufPool *BufPool, f func(chunk []byte) error) *ChunkWriteCloser
NewChunkWriteCloser creates a new ChunkWriteCloser.
func (*ChunkWriteCloser) Close ¶ added in v1.8.8
func (w *ChunkWriteCloser) Close() error
Close closes the writer.
type Dialer ¶
type Dialer interface { Dial(address string) (*grpc.ClientConn, error) CloseConns() error }
Dialer defines a grpc.ClientConn connection dialer.
type PachdAddress ¶ added in v1.9.8
type PachdAddress struct { // Secured specifies whether grpcs should be used Secured bool // Host specifies the pachd address host without the port Host string // Port specifies the pachd port Port uint16 }
PachdAddress represents a parsed pachd address value
func ParsePachdAddress ¶ added in v1.9.8
func ParsePachdAddress(value string) (*PachdAddress, error)
ParsePachdAddress parses a string into a pachd address, or returns an error if it's invalid
func (*PachdAddress) Hostname ¶ added in v1.9.8
func (p *PachdAddress) Hostname() string
Hostname returns the host:port combination of the pachd address, without the scheme
func (*PachdAddress) IsLoopback ¶ added in v1.9.8
func (p *PachdAddress) IsLoopback() bool
IsLoopback returns whether the pachd address is referencing the loopback hostname
func (*PachdAddress) IsUnusualPort ¶ added in v1.9.8
func (p *PachdAddress) IsUnusualPort() bool
IsUnusualPort returns true if the pachd address port is not one of the usual values
func (*PachdAddress) Qualified ¶ added in v1.9.8
func (p *PachdAddress) Qualified() string
Qualified returns the "fully qualified" address, including the scheme
type ReaderWrapper ¶ added in v1.6.0
ReaderWrapper wraps a reader for the following reason: Go's io.CopyBuffer has an annoying optimization wherein if the reader has the WriteTo function defined, it doesn't actually use the given buffer. As a result, we might write a large chunk to the gRPC streaming server even though we intend to use a small buffer. Therefore we wrap readers in this wrapper so that only Read is defined.
type Server ¶ added in v1.9.9
Server is a convenience wrapper to gRPC servers that simplifies their setup and execution
func NewServer ¶ added in v1.9.9
NewServer creates a new gRPC server, but does not start serving yet.
If 'publicPortTLSAllowed' is set, grpcutil may enable TLS. This should be set for public ports that serve GRPC services to 3rd party clients. If set, the criterion for actually serving over TLS is: if a signed TLS cert and corresponding private key in 'TLSVolumePath', this will serve GRPC traffic over TLS. If either are missing this will serve GRPC traffic over unencrypted HTTP,
type StreamingBytesClient ¶ added in v1.3.5
type StreamingBytesClient interface {
Recv() (*types.BytesValue, error)
}
StreamingBytesClient represents a client for an rpc method of the form:
rpc Foo(Bar) returns (stream google.protobuf.BytesValue) {}
type StreamingBytesServer ¶ added in v1.3.5
type StreamingBytesServer interface {
Send(bytesValue *types.BytesValue) error
}
StreamingBytesServer represents a server for an rpc method of the form:
rpc Foo(Bar) returns (stream google.protobuf.BytesValue) {}