forked from TrueCloudLab/frostfs-s3-gw
[#101] app: Refactor the default copies number setting
Signed-off-by: Artem Tataurov <a.tataurov@yadro.com>
This commit is contained in:
parent
bf47978cfe
commit
e24bc3f2ce
4 changed files with 35 additions and 18 deletions
|
@ -34,7 +34,7 @@ type (
|
|||
XMLDecoder XMLDecoderProvider
|
||||
DefaultMaxAge int
|
||||
NotificatorEnabled bool
|
||||
CopiesNumber uint32
|
||||
DefaultCopiesNumbers []uint32
|
||||
CopiesNumbers map[string][]uint32
|
||||
ResolveZoneList []string
|
||||
IsResolveListAllow bool // True if ResolveZoneList contains allowed zones
|
||||
|
@ -84,9 +84,9 @@ func New(log *zap.Logger, obj layer.Client, notificator Notificator, cfg *Config
|
|||
}
|
||||
|
||||
// pickCopiesNumbers chooses the return values following this logic:
|
||||
// 1) array of copies numbers sent in request's header has the highest priority
|
||||
// 2) array of copies numbers with corresponding location constraint provided in the config file
|
||||
// 3) default copies number from the config file wrapped into array
|
||||
// 1) array of copies numbers sent in request's header has the highest priority.
|
||||
// 2) array of copies numbers with corresponding location constraint provided in the config file.
|
||||
// 3) default copies number from the config file wrapped into array.
|
||||
func (h *handler) pickCopiesNumbers(metadata map[string]string, locationConstraint string) ([]uint32, error) {
|
||||
copiesNumbersStr, ok := metadata[layer.AttributeFrostfsCopiesNumber]
|
||||
if ok {
|
||||
|
@ -102,7 +102,7 @@ func (h *handler) pickCopiesNumbers(metadata map[string]string, locationConstrai
|
|||
return copiesNumbers, nil
|
||||
}
|
||||
|
||||
return []uint32{h.cfg.CopiesNumber}, nil
|
||||
return h.cfg.DefaultCopiesNumbers, nil
|
||||
}
|
||||
|
||||
func parseCopiesNumbers(copiesNumbersStr string) ([]uint32, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue