Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Mgr = NewManager()
Mgr is the singleton resource manager
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager initializes resources at peer startup and closes them at peer shutdown.
func (*Manager) ChannelJoined ¶
ChannelJoined notifies all applicable resources that the peer has joined a channel
func (*Manager) Close ¶
func (b *Manager) Close()
Close closes all applicable resources (i.e. the ones that implement closable).
func (*Manager) Initialize ¶
Initialize initializes all of the registered resources with the given set of providers.
func (*Manager) Register ¶
func (b *Manager) Register(creator interface{})
Register registers a resource creator function. The function is invoked on peer startup. The creator function defines a set of arguments (which must all be of type interface{}, struct{}, or *struct{}) and returns a single pointer to a struct. Each of the args are resolved against a set of registered providers. If a provider is found then it is passed in as the argument value. If a provider is not found then a panic results.
Example:
func CreateMyResource(x someProvider, y someOtherProvider) *MyStruct {
return &MyResource{x: x, y: y}
}
Register(CreateMyResource)