client

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2017 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCert = errors.New("invalid cert error")

ErrInvalidCert represents the error returned when a specified certificate was not valid

Functions

func Write

func Write(client Client, writer Writer, msg message.Msg) (message.Msg, error)

Write encapsulates the function of determining which function to call based on the msg.OP() and also wraps the function call with a Session.

Types

type Client

type Client interface {
	Connect() (Session, error)
}

Client provides a standard interface for interacting with the underlying sources/sinks.

type Closer

type Closer interface {
	Close()
}

Closer provides a standard interface for closing a client or session

type ConnectError

type ConnectError struct {
	Reason string
}

ConnectError wraps the underlying error when a failure occurs dialing the database.

func (ConnectError) Error

func (e ConnectError) Error() string

type InvalidTimeoutError

type InvalidTimeoutError struct {
	Timeout string
}

InvalidTimeoutError wraps the underlying error when the provided is not parsable time.ParseDuration.

func (InvalidTimeoutError) Error

func (e InvalidTimeoutError) Error() string

type InvalidURIError

type InvalidURIError struct {
	URI string
	Err string
}

InvalidURIError wraps the underlying error when the provided URI is not parsable by mgo.

func (InvalidURIError) Error

func (e InvalidURIError) Error() string

type MessageChanFunc

type MessageChanFunc func(Session, chan struct{}) (chan message.Msg, error)

MessageChanFunc represents the func signature needed to send messages to downstream adaptors.

type Mock

type Mock struct {
	Closed bool
}

Mock can be used for mocking tests that need no actual client or Session.

func (*Mock) Close

func (c *Mock) Close()

Close satisfies the Closer interface.

func (*Mock) Connect

func (c *Mock) Connect() (Session, error)

Connect satisfies the Client interface.

type MockErr

type MockErr struct {
}

MockErr can be used for mocking tests that need no actual client or Session.

func (*MockErr) Connect

func (c *MockErr) Connect() (Session, error)

Connect satisfies the Client interface.

type MockReader added in v0.3.0

type MockReader struct {
	MsgCount int
}

MockReader can be used to send a random number of messages

func (*MockReader) Read added in v0.3.0

func (r *MockReader) Read(filterFn NsFilterFunc) MessageChanFunc

type MockSession

type MockSession struct {
}

MockSession can be used for mocking tests the do not need to use anything in the Session.

func (*MockSession) Close

func (s *MockSession) Close()

Close satisfies the Closer interface.

type MockWriter

type MockWriter struct {
	MsgCount int
}

MockWriter can be used to count the number of messages sent to Write.

func (*MockWriter) Write

func (w *MockWriter) Write(msg message.Msg) func(Session) (message.Msg, error)

Writer satisfies the Writer interface.

type NsFilterFunc

type NsFilterFunc func(string) bool

NsFilterFunc represents the func signature needed to filter while Read()ing.

type Reader

type Reader interface {
	Read(NsFilterFunc) MessageChanFunc
}

Reader represents the ability to send messages down the pipe and is only needed for adaptors acting as a Source node.

type Session

type Session interface {
}

Session represents the connection to the underlying service.

type VersionError

type VersionError struct {
	URI string
	V   string
	Err string
}

VersionError represents any failure in attempting to obtain the version from the provided uri.

func (VersionError) Error

func (e VersionError) Error() string

type Writer

type Writer interface {
	Write(message.Msg) func(Session) (message.Msg, error)
}

Writer represents all possible functions needing to be implemented to handle messages.

Jump to

Keyboard shortcuts

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