reflector

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPort is the port the reflector server listens on if not passed in.
	DefaultPort = 5566
	// DefaultTimeout is the default timeout to read or write the next message
	DefaultTimeout = 5 * time.Second
)

Variables

View Source
var ErrBlobExists = errors.Base("blob exists on server")

ErrBlobExists is a default error for when a blob already exists on the reflector server.

Functions

func BlobHash added in v1.0.2

func BlobHash(blob []byte) string

Types

type Client

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

Client is an instance of a client connected to a server.

func (*Client) Close

func (c *Client) Close() error

Close closes the connection with the client.

func (*Client) Connect

func (c *Client) Connect(address string) error

Connect connects to a specific clients and errors if it cannot be contacted.

func (*Client) SendBlob

func (c *Client) SendBlob(blob []byte) error

SendBlob sends a send blob request to the client.

type Server

type Server struct {
	Timeout time.Duration // timeout to read or write next message

	StatLogger          *log.Logger   // logger to log stats
	StatReportFrequency time.Duration // how often to log stats
	// contains filtered or unexported fields
}

Server is and instance of the reflector server. It houses the blob store and listener.

func NewServer

func NewServer(store store.BlobStore) *Server

NewServer returns an initialized reflector server pointer.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown shuts down the reflector server gracefully.

func (*Server) Start

func (s *Server) Start(address string) error

Start starts the server to handle connections.

Jump to

Keyboard shortcuts

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