Documentation ¶
Overview ¶
Package handler contains all helper functions with backend process
Index ¶
- type BackendCacheWrapperInterface
- type BackendFetchInterface
- type BackendFetcher
- type BackendRegister
- func (b *BackendRegister) CheckConsistency(ctx context.Context, contents []v1.StorageBackendContent)
- func (b *BackendRegister) FetchAndRegisterAllBackend(ctx context.Context)
- func (b *BackendRegister) FetchAndRegisterOneBackend(ctx context.Context, name string, checkOnline bool) (*model.Backend, error)
- func (b *BackendRegister) LoadOrRebuildOneBackend(ctx context.Context, name, contentName string) (*model.Backend, error)
- func (b *BackendRegister) LoadOrRegisterOneBackend(ctx context.Context, name string) (*model.Backend, error)
- func (b *BackendRegister) RemoveRegisteredOneBackend(ctx context.Context, name string)
- func (b *BackendRegister) UpdateAndAddBackend(ctx context.Context, sbct v1.StorageBackendContent) (*model.Backend, error)
- func (b *BackendRegister) UpdateOrRegisterOneBackend(ctx context.Context, sbct *v1.StorageBackendContent) error
- func (b *BackendRegister) UpdateOrRegisterOnlineBackend(ctx context.Context, contents []v1.StorageBackendContent) error
- type BackendRegisterInterface
- type BackendSelectInterface
- type BackendSelector
- func (b *BackendSelector) SelectBackend(ctx context.Context, name string) (*model.Backend, error)
- func (b *BackendSelector) SelectLocalPool(ctx context.Context, requestSize int64, parameters map[string]interface{}) ([]*model.StoragePool, error)
- func (b *BackendSelector) SelectPoolPair(ctx context.Context, requestSize int64, params map[string]interface{}) (*model.SelectPoolPair, error)
- func (b *BackendSelector) SelectRemotePool(ctx context.Context, requestSize int64, localBackendName string, ...) (*model.StoragePool, error)
- type CacheWrapper
- func (b *CacheWrapper) AddBackendToCache(ctx context.Context, sbct v1.StorageBackendContent) (*model.Backend, error)
- func (b *CacheWrapper) LoadCacheBackendTopologies(ctx context.Context, name string) []map[string]string
- func (b *CacheWrapper) LoadCacheStoragePools(ctx context.Context) []*model.StoragePool
- func (b *CacheWrapper) UpdateCacheBackend(ctx context.Context, name string, sbct v1.StorageBackendContent)
- func (b *CacheWrapper) UpdateCacheBackendMetro(ctx context.Context)
- func (b *CacheWrapper) UpdateCacheBackendStatus(ctx context.Context, name string, online bool)
- type StorageBackendDetails
- type StorageHandler
- type StorageServiceInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendCacheWrapperInterface ¶
type BackendCacheWrapperInterface interface { cache.BackendCacheInterface AddBackendToCache(ctx context.Context, sbct v1.StorageBackendContent) (*model.Backend, error) UpdateCacheBackend(ctx context.Context, name string, sbct v1.StorageBackendContent) UpdateCacheBackendMetro(ctx context.Context) UpdateCacheBackendStatus(ctx context.Context, name string, online bool) LoadCacheStoragePools(ctx context.Context) []*model.StoragePool LoadCacheBackendTopologies(ctx context.Context, name string) []map[string]string }
BackendCacheWrapperInterface wrapping interface of the backend cache, which is used to provide combined operation cache interfaces.
type BackendFetchInterface ¶
type BackendFetchInterface interface { FetchAllBackends(ctx context.Context) ([]v1.StorageBackendContent, error) FetchBackendByName(ctx context.Context, name string, online bool) (*v1.StorageBackendContent, error) }
BackendFetchInterface fetch backend operation set
type BackendFetcher ¶
type BackendFetcher struct{}
BackendFetcher fetch resources of StorageBackendClaim and StorageBackendContent
func NewBackendFetcher ¶
func NewBackendFetcher() *BackendFetcher
NewBackendFetcher init instance of BackendFetcher
func (*BackendFetcher) FetchAllBackends ¶
func (b *BackendFetcher) FetchAllBackends(ctx context.Context) ([]v1.StorageBackendContent, error)
FetchAllBackends fetch all backends
func (*BackendFetcher) FetchBackendByName ¶
func (b *BackendFetcher) FetchBackendByName(ctx context.Context, name string, checkOnline bool) (*v1.StorageBackendContent, error)
FetchBackendByName fetch storage tuple from kube-api by name
type BackendRegister ¶
type BackendRegister struct {
// contains filtered or unexported fields
}
BackendRegister backend register
func NewBackendRegister ¶
func NewBackendRegister() *BackendRegister
NewBackendRegister init instance of BackendRegister
func (*BackendRegister) CheckConsistency ¶
func (b *BackendRegister) CheckConsistency(ctx context.Context, contents []v1.StorageBackendContent)
CheckConsistency if storage backend deleted, but memory, however, the backend still exists in the memory. so need to delete the backend from the memory.
func (*BackendRegister) FetchAndRegisterAllBackend ¶
func (b *BackendRegister) FetchAndRegisterAllBackend(ctx context.Context)
FetchAndRegisterAllBackend fetch all backends in the kubernetes and register them to cache.
func (*BackendRegister) FetchAndRegisterOneBackend ¶
func (b *BackendRegister) FetchAndRegisterOneBackend(ctx context.Context, name string, checkOnline bool) (*model.Backend, error)
FetchAndRegisterOneBackend fetch one backend in the kubernetes and register them to cache.
func (*BackendRegister) LoadOrRebuildOneBackend ¶
func (b *BackendRegister) LoadOrRebuildOneBackend(ctx context.Context, name, contentName string) (*model.Backend, error)
LoadOrRebuildOneBackend if the backend has been already in cache, and doesn't need to rebuild, return it directly. Otherwise, fetch and register the backend again.
func (*BackendRegister) LoadOrRegisterOneBackend ¶
func (b *BackendRegister) LoadOrRegisterOneBackend(ctx context.Context, name string) (*model.Backend, error)
LoadOrRegisterOneBackend if the cache is hit, the cache backend is directly returned. If the cache is not hit, the Kubernetes is queried for registration again.
func (*BackendRegister) RemoveRegisteredOneBackend ¶
func (b *BackendRegister) RemoveRegisteredOneBackend(ctx context.Context, name string)
RemoveRegisteredOneBackend remove registered backend from cache
func (*BackendRegister) UpdateAndAddBackend ¶
func (b *BackendRegister) UpdateAndAddBackend(ctx context.Context, sbct v1.StorageBackendContent) (*model.Backend, error)
UpdateAndAddBackend if the cache is hit, the cache backend is directly updated. If the cache is not hit, the Kubernetes is queried for registration again.
func (*BackendRegister) UpdateOrRegisterOneBackend ¶
func (b *BackendRegister) UpdateOrRegisterOneBackend(ctx context.Context, sbct *v1.StorageBackendContent) error
UpdateOrRegisterOneBackend register one backend by sbct
func (*BackendRegister) UpdateOrRegisterOnlineBackend ¶
func (b *BackendRegister) UpdateOrRegisterOnlineBackend(ctx context.Context, contents []v1.StorageBackendContent) error
UpdateOrRegisterOnlineBackend update or register all online backend.
type BackendRegisterInterface ¶
type BackendRegisterInterface interface { FetchAndRegisterAllBackend(ctx context.Context) FetchAndRegisterOneBackend(ctx context.Context, name string, checkOnline bool) (*model.Backend, error) LoadOrRegisterOneBackend(ctx context.Context, name string) (*model.Backend, error) LoadOrRebuildOneBackend(ctx context.Context, name, contentName string) (*model.Backend, error) RemoveRegisteredOneBackend(ctx context.Context, name string) UpdateOrRegisterOneBackend(ctx context.Context, sbct *v1.StorageBackendContent) error }
BackendRegisterInterface register backend operation set
type BackendSelectInterface ¶
type BackendSelectInterface interface { SelectBackend(context.Context, string) (*model.Backend, error) SelectPoolPair(context.Context, int64, map[string]interface{}) (*model.SelectPoolPair, error) SelectLocalPool(context.Context, int64, map[string]interface{}) ([]*model.StoragePool, error) SelectRemotePool(context.Context, int64, string, map[string]interface{}) (*model.StoragePool, error) }
BackendSelectInterface all backend select operation set
type BackendSelector ¶
type BackendSelector struct {
// contains filtered or unexported fields
}
BackendSelector backend selector
func NewBackendSelector ¶
func NewBackendSelector() *BackendSelector
NewBackendSelector init instance of BackendSelector
func (*BackendSelector) SelectBackend ¶
SelectBackend select one backend by name
func (*BackendSelector) SelectLocalPool ¶
func (b *BackendSelector) SelectLocalPool(ctx context.Context, requestSize int64, parameters map[string]interface{}) ([]*model.StoragePool, error)
SelectLocalPool select local pool
func (*BackendSelector) SelectPoolPair ¶
func (b *BackendSelector) SelectPoolPair(ctx context.Context, requestSize int64, params map[string]interface{}) (*model.SelectPoolPair, error)
SelectPoolPair select local pool and remote pool
func (*BackendSelector) SelectRemotePool ¶
func (b *BackendSelector) SelectRemotePool(ctx context.Context, requestSize int64, localBackendName string, parameters map[string]interface{}) (*model.StoragePool, error)
SelectRemotePool select remote pool
type CacheWrapper ¶
type CacheWrapper struct {
cache.BackendCacheInterface
}
CacheWrapper cache wrapper
func NewCacheWrapper ¶
func NewCacheWrapper() *CacheWrapper
NewCacheWrapper init instance of CacheWrapper
func (*CacheWrapper) AddBackendToCache ¶
func (b *CacheWrapper) AddBackendToCache(ctx context.Context, sbct v1.StorageBackendContent) (*model.Backend, error)
AddBackendToCache init a backend and add to cache
func (*CacheWrapper) LoadCacheBackendTopologies ¶
func (b *CacheWrapper) LoadCacheBackendTopologies(ctx context.Context, name string) []map[string]string
LoadCacheBackendTopologies load specify backend's pools
func (*CacheWrapper) LoadCacheStoragePools ¶
func (b *CacheWrapper) LoadCacheStoragePools(ctx context.Context) []*model.StoragePool
LoadCacheStoragePools load all cached storage pools
func (*CacheWrapper) UpdateCacheBackend ¶
func (b *CacheWrapper) UpdateCacheBackend(ctx context.Context, name string, sbct v1.StorageBackendContent)
UpdateCacheBackend update cache backend step 1: update storage pool step 2: update hyperMetro relationships
func (*CacheWrapper) UpdateCacheBackendMetro ¶
func (b *CacheWrapper) UpdateCacheBackendMetro(ctx context.Context)
UpdateCacheBackendMetro update hyperMetro relationships
func (*CacheWrapper) UpdateCacheBackendStatus ¶
func (b *CacheWrapper) UpdateCacheBackendStatus(ctx context.Context, name string, online bool)
UpdateCacheBackendStatus update backend status
type StorageBackendDetails ¶
type StorageBackendDetails struct { Capabilities map[string]bool Specifications map[string]string Pools []*drcsi.Pool }
StorageBackendDetails backend details
type StorageHandler ¶
type StorageHandler struct {
// contains filtered or unexported fields
}
StorageHandler backend query handler
func NewStorageHandler ¶
func NewStorageHandler() *StorageHandler
NewStorageHandler init instance of StorageHandler
func (*StorageHandler) GetBackendDetails ¶
func (s *StorageHandler) GetBackendDetails(ctx context.Context, name, contentName string) (StorageBackendDetails, error)
GetBackendDetails query backend details
type StorageServiceInterface ¶
type StorageServiceInterface interface {
GetBackendDetails(ctx context.Context, name, contentName string) (StorageBackendDetails, error)
}
StorageServiceInterface query backend operation set