[#176] blobstor: Fix maximum tree depth
Correct the calculation of maximum value of fs tree depth. Fix check of the max depth overflow in WithShallowDepth function. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
f7116f27ec
commit
86385af67d
2 changed files with 2 additions and 2 deletions
|
@ -61,7 +61,7 @@ func New(opts ...Option) *BlobStor {
|
|||
// Depth is reduced to maximum value in case of overflow.
|
||||
func WithShallowDepth(depth int) Option {
|
||||
return func(c *cfg) {
|
||||
if depth <= maxDepth {
|
||||
if depth > maxDepth {
|
||||
depth = maxDepth
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ type fsTree struct {
|
|||
|
||||
const dirNameLen = 2 // in bytes
|
||||
|
||||
var maxDepth = (hex.EncodedLen(sha256.Size) - 1) / dirNameLen
|
||||
var maxDepth = (sha256.Size - 1) / dirNameLen
|
||||
|
||||
var errFileNotFound = errors.New("file not found")
|
||||
|
||||
|
|
Loading…
Reference in a new issue