forked from TrueCloudLab/frostfs-s3-gw
[#577] Update SDK to support new tree/pool version
Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
This commit is contained in:
parent
e0ce59fd32
commit
95d847d611
21 changed files with 371 additions and 124 deletions
|
@ -20,7 +20,7 @@ type Cache struct {
|
|||
bucketCache *cache.BucketCache
|
||||
systemCache *cache.SystemCache
|
||||
accessCache *cache.AccessControlCache
|
||||
networkInfoCache *cache.NetworkInfoCache
|
||||
networkCache *cache.NetworkCache
|
||||
}
|
||||
|
||||
// CachesConfig contains params for caches.
|
||||
|
@ -33,7 +33,8 @@ type CachesConfig struct {
|
|||
Buckets *cache.Config
|
||||
System *cache.Config
|
||||
AccessControl *cache.Config
|
||||
NetworkInfo *cache.NetworkInfoCacheConfig
|
||||
Network *cache.NetworkCacheConfig
|
||||
CIDCache bool
|
||||
}
|
||||
|
||||
// DefaultCachesConfigs returns filled configs.
|
||||
|
@ -47,7 +48,7 @@ func DefaultCachesConfigs(logger *zap.Logger) *CachesConfig {
|
|||
Buckets: cache.DefaultBucketConfig(logger),
|
||||
System: cache.DefaultSystemConfig(logger),
|
||||
AccessControl: cache.DefaultAccessControlConfig(logger),
|
||||
NetworkInfo: cache.DefaultNetworkInfoConfig(logger),
|
||||
Network: cache.DefaultNetworkConfig(logger),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,10 +59,10 @@ func NewCache(cfg *CachesConfig) *Cache {
|
|||
sessionListCache: cache.NewListSessionCache(cfg.SessionList),
|
||||
objCache: cache.New(cfg.Objects),
|
||||
namesCache: cache.NewObjectsNameCache(cfg.Names),
|
||||
bucketCache: cache.NewBucketCache(cfg.Buckets),
|
||||
bucketCache: cache.NewBucketCache(cfg.Buckets, cfg.CIDCache),
|
||||
systemCache: cache.NewSystemCache(cfg.System),
|
||||
accessCache: cache.NewAccessControlCache(cfg.AccessControl),
|
||||
networkInfoCache: cache.NewNetworkInfoCache(cfg.NetworkInfo),
|
||||
networkCache: cache.NewNetworkCache(cfg.Network),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,11 +291,30 @@ func (c *Cache) DeleteLifecycleConfiguration(bktInfo *data.BucketInfo) {
|
|||
}
|
||||
|
||||
func (c *Cache) GetNetworkInfo() *netmap.NetworkInfo {
|
||||
return c.networkInfoCache.Get()
|
||||
return c.networkCache.GetNetworkInfo()
|
||||
}
|
||||
|
||||
func (c *Cache) PutNetworkInfo(info netmap.NetworkInfo) {
|
||||
if err := c.networkInfoCache.Put(info); err != nil {
|
||||
if err := c.networkCache.PutNetworkInfo(info); err != nil {
|
||||
c.logger.Warn(logs.CouldntCacheNetworkInfo, zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Cache) GetNetmap() *netmap.NetMap {
|
||||
return c.networkCache.GetNetmap()
|
||||
}
|
||||
|
||||
func (c *Cache) PutNetmap(nm netmap.NetMap) {
|
||||
if err := c.networkCache.PutNetmap(nm); err != nil {
|
||||
c.logger.Warn(logs.CouldntCacheNetmap, zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Cache) GetPlacementPolicy(cnrID cid.ID) *netmap.PlacementPolicy {
|
||||
res := c.bucketCache.GetByCID(cnrID)
|
||||
if res != nil {
|
||||
return &res.PlacementPolicy
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue