Documentation ¶
Overview ¶
utils contains common code used through-out the Forest Bus server implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrintFFunc ¶
type PrintFFunc func(format string, args ...interface{})
PrintFFunc is a type definition for the log.Printf function used as a field in a number of objects that require logging services.
func GetServerLogger ¶
func GetServerLogger(component string) PrintFFunc
GetServerLogger returns a PrintFFunc that prefixes messages with a component name.
func GetTopicLogger ¶
func GetTopicLogger(topicName, component string) PrintFFunc
GetTopicLogger returns a PrintFFunc that prefixes messages with the topic and component name.
type ShutdownNotifier ¶
type ShutdownNotifier struct {
// contains filtered or unexported fields
}
ShutdownNotifier provides a way of managing asynchronous shutdown requests of the Forest Bus sub-systems.
func NewShutdownNotifier ¶
func NewShutdownNotifier(numRoutines int) *ShutdownNotifier
NewShutdownNotifier provides a new ShutdownNotifier that is expecting numRoutines to notify shutdown completion through this object.
func (*ShutdownNotifier) ShutdownDone ¶
func (notifier *ShutdownNotifier) ShutdownDone()
ShutdownDone is used by a routine to inform the ShutdownNotifier that is has completed shutdown.
func (*ShutdownNotifier) WaitForAllDone ¶
func (notifier *ShutdownNotifier) WaitForAllDone()
WaitForAllDone blocks until all expected routines have reported that their shutdown is done.
func (*ShutdownNotifier) WaitForDone ¶
func (notifier *ShutdownNotifier) WaitForDone(timeout time.Duration) int
WaitForDone blocks until all of the expected routines have completed or the given timeout occurs. The number of routines that actually notified of shutdown completion is returned.