connectionwrapper

package
v0.0.0-...-cd1178a Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionWrapper

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

You can register a listener that will get notified when changes occur.

NOTE: It's not possible to stay transactionally in sync. Users of this class must be prepared for false-positives and false-negatives. Additionally, always use the version number when updating data to avoid overwriting another process' change.

func NewConnectionWrapper

func NewConnectionWrapper(client curator.CuratorFramework) *ConnectionWrapper

NewConnectionWrapper creates a ConnectionWrapper for the given client. Users of this type should provide a listener with callback functions that get call whenever the connection state changes.

func (*ConnectionWrapper) Listenable

Listenable returns the cache listeners.

func (*ConnectionWrapper) SetLogger

func (tc *ConnectionWrapper) SetLogger(l Logger) *ConnectionWrapper

SetLogger sets the inner Logger of ConnectionWrapper.

func (*ConnectionWrapper) Start

func (tc *ConnectionWrapper) Start() error

Start starts the ConnectionWrapper. The cache is not started automatically. You must call this method.

func (*ConnectionWrapper) UnhandledErrorListenable

func (tc *ConnectionWrapper) UnhandledErrorListenable() curator.UnhandledErrorListenable

UnhandledErrorListenable allows catching unhandled errors in asynchornous operations.

type ConnectionWrapperEvent

type ConnectionWrapperEvent struct {
	Type ConnectionWrapperEventType
}

ConnectionWrapperEvent represents a change to a path

func (ConnectionWrapperEvent) String

func (e ConnectionWrapperEvent) String() string

String returns the string representation of ConnectionWrapperEvent

type ConnectionWrapperEventType

type ConnectionWrapperEventType int

ConnectionWrapperEventType represents the type of change to a path

const (
	// ConnectionWrapperEventConnSuspended is called when the connection has changed to SUSPENDED
	ConnectionWrapperEventConnSuspended ConnectionWrapperEventType = iota
	// ConnectionWrapperEventConnReconnected is called when the connection has changed to RECONNECTED
	ConnectionWrapperEventConnReconnected
	// ConnectionWrapperEventConnLost is called when the connection has changed to LOST
	ConnectionWrapperEventConnLost
	// ConnectionWrapperEventInitialized is posted after the initial cache has been fully populated
	ConnectionWrapperEventInitialized

	ConnectionWrapperEventConnConnected
)

func (ConnectionWrapperEventType) String

func (et ConnectionWrapperEventType) String() string

String returns the string representation of ConnectionWrapperEventType "Unknown" is returned when event type is unknown

type ConnectionWrapperListenable

type ConnectionWrapperListenable interface {
	curator.Listenable

	AddListener(ConnectionWrapperListener)
	RemoveListener(ConnectionWrapperListener)
}

ConnectionWrapperListenable represents a container of ConnectionWrapperListener(s).

type ConnectionWrapperListener

type ConnectionWrapperListener interface {
	// Called when a change has occurred
	ChildEvent(client curator.CuratorFramework, event ConnectionWrapperEvent) error
}

ConnectionWrapperListener represents listener for ConnectionWrapper changes

func NewConnectionWrapperListener

func NewConnectionWrapperListener(cb childEventCallback) ConnectionWrapperListener

NewConnectionWrapperListener creates ConnectionWrapperListener with given function

type ConnectionWrapperListenerContainer

type ConnectionWrapperListenerContainer struct {
	curator.ListenerContainer
}

ConnectionWrapperListenerContainer is a container of ConnectionWrapperListener.

func (*ConnectionWrapperListenerContainer) AddListener

AddListener adds a listener to the container.

func (*ConnectionWrapperListenerContainer) RemoveListener

RemoveListener removes a listener to the container.

type ConnectionWrapperListenerPrototype

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

ConnectionWrapperListenerPrototype is the internal implementation of ConnectionWrapperListener

func (*ConnectionWrapperListenerPrototype) ChildEvent

ChildEvent is called when a change has occurred

type DummyLogger

type DummyLogger struct{}

DummyLogger is a Logger does nothing.

func (DummyLogger) Debugf

func (l DummyLogger) Debugf(string, ...interface{})

Debugf does nothing.

func (DummyLogger) Printf

func (l DummyLogger) Printf(string, ...interface{})

Printf does nothing.

type Logger

type Logger interface {
	Printf(string, ...interface{})
	Debugf(string, ...interface{})
}

Logger provides customized logging within ConnectionWrapper.

Jump to

Keyboard shortcuts

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