Documentation ¶
Index ¶
- func RegisterCacheManager(man CacheManager)
- func Start[O lockman.ILockedObject](ctx context.Context, resMan IResourceManager[O])
- type CacheManager
- type CommonResourceManager
- func (m CommonResourceManager[O]) GetAll() []O
- func (m *CommonResourceManager[O]) GetKeyword() string
- func (m *CommonResourceManager[O]) GetRefreshInterval() time.Duration
- func (m CommonResourceManager[O]) GetResource(id string) (O, bool)
- func (m CommonResourceManager[O]) GetStore() IResourceStore[O]
- func (m *CommonResourceManager[O]) Start(ctx context.Context)
- func (m *CommonResourceManager[O]) SyncOnce() error
- type FGetDBObject
- type IResourceManager
- type IResourceStore
- type ResourceStore
- func (s *ResourceStore[O]) Add(obj *jsonutils.JSONDict)
- func (s *ResourceStore[O]) Delete(obj *jsonutils.JSONDict)
- func (s *ResourceStore[O]) Get(id string) (O, bool)
- func (s *ResourceStore[O]) GetAll() []O
- func (s *ResourceStore[O]) GetByPrefix(prefixId string) []O
- func (s *ResourceStore[O]) GetInformerResourceManager() informer.IResourceManager
- func (s *ResourceStore[O]) Init() error
- func (s *ResourceStore[O]) Update(oldObj, newObj *jsonutils.JSONDict)
- func (s *ResourceStore[O]) WithOnAdd(onAdd func(db.IModel)) *ResourceStore[O]
- func (s *ResourceStore[O]) WithOnDelete(onDelete func(*jsonutils.JSONDict)) *ResourceStore[O]
- func (s *ResourceStore[O]) WithOnUpdate(onUpdate func(old *jsonutils.JSONDict, newObj db.IModel)) *ResourceStore[O]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCacheManager ¶
func RegisterCacheManager(man CacheManager)
func Start ¶
func Start[O lockman.ILockedObject](ctx context.Context, resMan IResourceManager[O])
Types ¶
type CacheManager ¶
func GetCacheManager ¶
func GetCacheManager() CacheManager
type CommonResourceManager ¶
type CommonResourceManager[O lockman.ILockedObject] struct { // contains filtered or unexported fields }
func NewCommonResourceManager ¶
func NewCommonResourceManager[O lockman.ILockedObject]( keyword string, refreshInterval time.Duration, store IResourceStore[O], ) *CommonResourceManager[O]
func (CommonResourceManager[O]) GetAll ¶
func (m CommonResourceManager[O]) GetAll() []O
func (*CommonResourceManager[O]) GetKeyword ¶
func (m *CommonResourceManager[O]) GetKeyword() string
func (*CommonResourceManager[O]) GetRefreshInterval ¶
func (m *CommonResourceManager[O]) GetRefreshInterval() time.Duration
func (CommonResourceManager[O]) GetResource ¶
func (m CommonResourceManager[O]) GetResource(id string) (O, bool)
func (CommonResourceManager[O]) GetStore ¶
func (m CommonResourceManager[O]) GetStore() IResourceStore[O]
func (*CommonResourceManager[O]) Start ¶
func (m *CommonResourceManager[O]) Start(ctx context.Context)
func (*CommonResourceManager[O]) SyncOnce ¶
func (m *CommonResourceManager[O]) SyncOnce() error
type FGetDBObject ¶
type IResourceManager ¶
type IResourceStore ¶
type IResourceStore[O lockman.ILockedObject] interface { GetInformerResourceManager() informer.IResourceManager Init() error Get(id string) (O, bool) GetAll() []O GetByPrefix(prefixId string) []O Add(obj *jsonutils.JSONDict) Update(oldObj, newObj *jsonutils.JSONDict) Delete(obj *jsonutils.JSONDict) }
type ResourceStore ¶
type ResourceStore[O lockman.ILockedObject] struct { // contains filtered or unexported fields }
func NewJointResourceStore ¶
func NewJointResourceStore[O lockman.ILockedObject]( modelMan db.IModelManager, res informer.IResourceManager, getId func(O) string, getWatchId func(*jsonutils.JSONDict) string, getDBObject FGetDBObject, ) *ResourceStore[O]
func NewResourceStore ¶
func NewResourceStore[O lockman.ILockedObject]( modelMan db.IModelManager, res informer.IResourceManager, ) *ResourceStore[O]
func (*ResourceStore[O]) Add ¶
func (s *ResourceStore[O]) Add(obj *jsonutils.JSONDict)
func (*ResourceStore[O]) Delete ¶
func (s *ResourceStore[O]) Delete(obj *jsonutils.JSONDict)
func (*ResourceStore[O]) Get ¶
func (s *ResourceStore[O]) Get(id string) (O, bool)
func (*ResourceStore[O]) GetAll ¶
func (s *ResourceStore[O]) GetAll() []O
func (*ResourceStore[O]) GetByPrefix ¶
func (s *ResourceStore[O]) GetByPrefix(prefixId string) []O
func (*ResourceStore[O]) GetInformerResourceManager ¶
func (s *ResourceStore[O]) GetInformerResourceManager() informer.IResourceManager
func (*ResourceStore[O]) Init ¶
func (s *ResourceStore[O]) Init() error
func (*ResourceStore[O]) Update ¶
func (s *ResourceStore[O]) Update(oldObj, newObj *jsonutils.JSONDict)
func (*ResourceStore[O]) WithOnAdd ¶
func (s *ResourceStore[O]) WithOnAdd(onAdd func(db.IModel)) *ResourceStore[O]
func (*ResourceStore[O]) WithOnDelete ¶
func (s *ResourceStore[O]) WithOnDelete(onDelete func(*jsonutils.JSONDict)) *ResourceStore[O]
func (*ResourceStore[O]) WithOnUpdate ¶
func (s *ResourceStore[O]) WithOnUpdate(onUpdate func(old *jsonutils.JSONDict, newObj db.IModel)) *ResourceStore[O]
Click to show internal directories.
Click to hide internal directories.