luci: go.chromium.org/luci/logdog/client/butlerlib/streamclient Index | Files

package streamclient

import "go.chromium.org/luci/logdog/client/butlerlib/streamclient"

Index

Package Files

client.go client_namedPipe_posix.go registry.go stream.go tcp.go

func RegisterDefaultProtocols Uses

func RegisterDefaultProtocols(r *Registry)

RegisterDefaultProtocols registers the default set of protocols with a Registry.

type BaseStream Uses

type BaseStream struct {
    // WriteCloser (required) is the stream's underlying io.WriteCloser.
    io.WriteCloser

    // P (required) is this stream's properties.
    P   *streamproto.Properties
    // contains filtered or unexported fields
}

BaseStream is the standard implementation of the Stream interface.

func (*BaseStream) Properties Uses

func (s *BaseStream) Properties() *streamproto.Properties

Properties implements StreamClient.

func (*BaseStream) Write Uses

func (s *BaseStream) Write(data []byte) (int, error)

Write implements StreamClient.

func (*BaseStream) WriteDatagram Uses

func (s *BaseStream) WriteDatagram(dg []byte) error

WriteDatagram implements StreamClient.

type Client Uses

type Client interface {
    // NewStream creates a new stream with the supplied stream properties.
    NewStream(f streamproto.Flags) (Stream, error)
}

Client is a client to a LogDog Butler StreamServer. A Client will connect to a StreamServer, negotiate a stream configuration, and return an active stream object that can be written to.

func New Uses

func New(path string) (Client, error)

New instantiates a new Client instance. This type of instance will be parsed from the supplied path string, which takes the form:

<protocol>:<protocol-specific-spec>

Supported protocols and their respective specs are:

- unix:/path/to/socket describes a stream server listening on UNIX domain
  socket at "/path/to/socket".

Windows-only:

- net.pipe:name describes a stream server listening on Windows named pipe
  "\\.\pipe\name".

type ClientFactory Uses

type ClientFactory func(string) (Client, error)

ClientFactory is a generator function that is invoked by the Registry when a new Client is requested for its protocol.

type Registry Uses

type Registry struct {
    // contains filtered or unexported fields
}

Registry maps protocol prefix strings to their Client generator functions.

This allows multiple Butler stream protocols (e.g., "unix:", "net.pipe:", etc.) to be parsed from string.

func GetDefaultRegistry Uses

func GetDefaultRegistry() *Registry

GetDefaultRegistry returns the default client registry instance.

Initializes the registry on first invocation.

func (*Registry) NewClient Uses

func (r *Registry) NewClient(path string) (Client, error)

NewClient invokes the protocol ClientFactory generator for the supplied protocol/address string, returning the generated Client.

func (*Registry) Register Uses

func (r *Registry) Register(name string, f ClientFactory)

Register registers a new protocol and its ClientFactory.

This can be invoked by calling NewClient with a path spec referencing that protocol.

type Stream Uses

type Stream interface {
    io.WriteCloser

    // WriteDatagram writes a LogDog Butler streaming datagram to the underlying
    // Writer.
    WriteDatagram([]byte) error

    // Properties returns a copy of this Stream's properties.
    Properties() *streamproto.Properties
}

Stream is an individual LogDog Butler stream.

Package streamclient imports 12 packages (graph) and is imported by 9 packages. Updated 2018-08-14. Refresh now. Tools for package owners.