streamclient

package
v0.0.0-...-678bb0e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDefaultProtocols

func RegisterDefaultProtocols(r *Registry)

RegisterDefaultProtocols registers the default set of protocols with a Registry.

Types

type BaseStream

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

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

Properties implements StreamClient.

func (*BaseStream) Write

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

Write implements StreamClient.

func (*BaseStream) WriteDatagram

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

WriteDatagram implements StreamClient.

type Client

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

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

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

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

func GetDefaultRegistry() *Registry

GetDefaultRegistry returns the default client registry instance.

Initializes the registry on first invocation.

func (*Registry) NewClient

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

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

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.

Jump to

Keyboard shortcuts

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