Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateFunc ¶
type CreateFunc func() (s interface{}, cleanup ReleaseFunc, err error)
CreateFunc is the function that creates the actual struct
type ReferenceCountable ¶
type ReferenceCountable struct {
// contains filtered or unexported fields
}
ReferenceCountable is a wrapper that handles the reference counting of an instance
func (*ReferenceCountable) Get ¶
func (r *ReferenceCountable) Get(create CreateFunc) (sr interface{}, rf ReleaseFunc, err error)
Get receives a factory function and returns the instance if exists or creates a new one. In addition it returns ReleaseFunc to be used when the owner no longer needs the instance.
func (*ReferenceCountable) Release ¶
func (r *ReferenceCountable) Release() error
Release should be called when the owner of the instance no longer uses it and would like to release resources.
type ReleaseFunc ¶
type ReleaseFunc func() error
ReleaseFunc should be called by the client when he stopps to use the service
Click to show internal directories.
Click to hide internal directories.