Documentation ¶
Index ¶
- type DummyObserver
- func (observer DummyObserver) AfterAlloc(ctx context.Context, resources []string)
- func (observer DummyObserver) AfterDealloc(ctx context.Context, resources []string)
- func (observer DummyObserver) AfterInit(ctx context.Context, resources []core.Resource)
- func (observer DummyObserver) AfterLoad(ctx context.Context, resources []core.Resource)
- func (observer DummyObserver) BeforeAlloc(ctx context.Context, n int) error
- func (observer DummyObserver) BeforeDealloc(ctx context.Context, resources []string) error
- func (observer DummyObserver) BeforeInit(ctx context.Context, resources []core.Resource) error
- func (observer DummyObserver) BeforeLoad(ctx context.Context, ids []string) error
- func (observer DummyObserver) OnAllocError(ctx context.Context, n int, err error)
- func (observer DummyObserver) OnDeallocError(ctx context.Context, resources []string, err error)
- func (observer DummyObserver) OnInitError(ctx context.Context, resources []core.Resource, err error)
- func (observer DummyObserver) OnLoadError(ctx context.Context, ids []string, err error)
- type FunctionalObserver
- func (observer FunctionalObserver) AfterAlloc(ctx context.Context, resources []string)
- func (observer FunctionalObserver) AfterDealloc(ctx context.Context, resources []string)
- func (observer FunctionalObserver) AfterInit(ctx context.Context, resources []core.Resource)
- func (observer FunctionalObserver) AfterLoad(ctx context.Context, resources []core.Resource)
- func (observer FunctionalObserver) BeforeAlloc(ctx context.Context, n int) error
- func (observer FunctionalObserver) BeforeDealloc(ctx context.Context, resources []string) error
- func (observer FunctionalObserver) BeforeInit(ctx context.Context, resources []core.Resource) error
- func (observer FunctionalObserver) BeforeLoad(ctx context.Context, ids []string) error
- func (observer FunctionalObserver) OnAllocError(ctx context.Context, n int, err error)
- func (observer FunctionalObserver) OnDeallocError(ctx context.Context, resources []string, err error)
- func (observer FunctionalObserver) OnInitError(ctx context.Context, resources []core.Resource, err error)
- func (observer FunctionalObserver) OnLoadError(ctx context.Context, ids []string, err error)
- type Notifier
- type Observable
- func (storage *Observable) Alloc(ctx context.Context, amount int) ([]string, error)
- func (storage *Observable) Dealloc(ctx context.Context, ids []string) error
- func (storage *Observable) Init(ctx context.Context, resources []core.Resource) error
- func (storage *Observable) Load(ctx context.Context, ids ...string) ([]core.Resource, error)
- type Observer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DummyObserver ¶
type DummyObserver struct{}
func (DummyObserver) AfterAlloc ¶
func (observer DummyObserver) AfterAlloc(ctx context.Context, resources []string)
func (DummyObserver) AfterDealloc ¶
func (observer DummyObserver) AfterDealloc(ctx context.Context, resources []string)
func (DummyObserver) AfterInit ¶
func (observer DummyObserver) AfterInit(ctx context.Context, resources []core.Resource)
func (DummyObserver) AfterLoad ¶
func (observer DummyObserver) AfterLoad(ctx context.Context, resources []core.Resource)
func (DummyObserver) BeforeAlloc ¶
func (observer DummyObserver) BeforeAlloc(ctx context.Context, n int) error
func (DummyObserver) BeforeDealloc ¶
func (observer DummyObserver) BeforeDealloc(ctx context.Context, resources []string) error
func (DummyObserver) BeforeInit ¶
func (DummyObserver) BeforeLoad ¶
func (observer DummyObserver) BeforeLoad(ctx context.Context, ids []string) error
func (DummyObserver) OnAllocError ¶
func (observer DummyObserver) OnAllocError(ctx context.Context, n int, err error)
func (DummyObserver) OnDeallocError ¶
func (observer DummyObserver) OnDeallocError(ctx context.Context, resources []string, err error)
func (DummyObserver) OnInitError ¶
func (DummyObserver) OnLoadError ¶
func (observer DummyObserver) OnLoadError(ctx context.Context, ids []string, err error)
type FunctionalObserver ¶
type FunctionalObserver struct { BeforeLoadF func(ctx context.Context, ids []string) error AfterLoadF func(ctx context.Context, resources []core.Resource) OnLoadErrorF func(ctx context.Context, ids []string, err error) BeforeAllocF func(ctx context.Context, n int) error AfterAllocF func(ctx context.Context, resources []string) OnAllocErrorF func(ctx context.Context, n int, err error) BeforeInitF func(ctx context.Context, resources []core.Resource) error AfterInitF func(ctx context.Context, resources []core.Resource) OnInitErrorF func(ctx context.Context, resources []core.Resource, err error) BeforeDeallocF func(ctx context.Context, resources []string) error AfterDeallocF func(ctx context.Context, resources []string) OnDeallocErrorF func(ctx context.Context, resources []string, err error) }
func (FunctionalObserver) AfterAlloc ¶
func (observer FunctionalObserver) AfterAlloc(ctx context.Context, resources []string)
func (FunctionalObserver) AfterDealloc ¶
func (observer FunctionalObserver) AfterDealloc(ctx context.Context, resources []string)
func (FunctionalObserver) AfterInit ¶
func (observer FunctionalObserver) AfterInit(ctx context.Context, resources []core.Resource)
func (FunctionalObserver) AfterLoad ¶
func (observer FunctionalObserver) AfterLoad(ctx context.Context, resources []core.Resource)
func (FunctionalObserver) BeforeAlloc ¶
func (observer FunctionalObserver) BeforeAlloc(ctx context.Context, n int) error
func (FunctionalObserver) BeforeDealloc ¶
func (observer FunctionalObserver) BeforeDealloc(ctx context.Context, resources []string) error
func (FunctionalObserver) BeforeInit ¶
func (FunctionalObserver) BeforeLoad ¶
func (observer FunctionalObserver) BeforeLoad(ctx context.Context, ids []string) error
func (FunctionalObserver) OnAllocError ¶
func (observer FunctionalObserver) OnAllocError(ctx context.Context, n int, err error)
func (FunctionalObserver) OnDeallocError ¶
func (observer FunctionalObserver) OnDeallocError(ctx context.Context, resources []string, err error)
func (FunctionalObserver) OnInitError ¶
func (FunctionalObserver) OnLoadError ¶
func (observer FunctionalObserver) OnLoadError(ctx context.Context, ids []string, err error)
type Observable ¶
type Observable struct {
// contains filtered or unexported fields
}
func Observe ¶
func Observe(raw core.ResourceDB, observer Observer) *Observable
func (*Observable) Dealloc ¶
func (storage *Observable) Dealloc(ctx context.Context, ids []string) error
type Observer ¶
type Observer interface { BeforeLoad(ctx context.Context, ids []string) error AfterLoad(ctx context.Context, resources []core.Resource) OnLoadError(ctx context.Context, ids []string, err error) BeforeAlloc(ctx context.Context, n int) error AfterAlloc(ctx context.Context, resources []string) OnAllocError(ctx context.Context, n int, err error) BeforeInit(ctx context.Context, resources []core.Resource) error AfterInit(ctx context.Context, resources []core.Resource) OnInitError(ctx context.Context, resources []core.Resource, err error) BeforeDealloc(ctx context.Context, resources []string) error AfterDealloc(ctx context.Context, resources []string) OnDeallocError(ctx context.Context, resources []string, err error) }
Click to show internal directories.
Click to hide internal directories.