forked from TrueCloudLab/frostfs-node
[#1559] shard: Remove public functions
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
34d319fed2
commit
7b882b26d8
3 changed files with 9 additions and 42 deletions
|
@ -71,7 +71,10 @@ func (e *StorageEngine) containerSize(prm ContainerSizePrm) (res ContainerSizeRe
|
||||||
}
|
}
|
||||||
|
|
||||||
e.iterateOverUnsortedShards(func(sh hashedShard) (stop bool) {
|
e.iterateOverUnsortedShards(func(sh hashedShard) (stop bool) {
|
||||||
size, err := shard.ContainerSize(sh.Shard, prm.cnr)
|
var csPrm shard.ContainerSizePrm
|
||||||
|
csPrm.WithContainerID(prm.cnr)
|
||||||
|
|
||||||
|
csRes, err := sh.Shard.ContainerSize(csPrm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.reportShardError(sh, "can't get container size", err,
|
e.reportShardError(sh, "can't get container size", err,
|
||||||
zap.Stringer("container_id", prm.cnr),
|
zap.Stringer("container_id", prm.cnr),
|
||||||
|
@ -79,7 +82,7 @@ func (e *StorageEngine) containerSize(prm ContainerSizePrm) (res ContainerSizeRe
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
res.size += size
|
res.size += csRes.Size()
|
||||||
|
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
@ -119,16 +122,16 @@ func (e *StorageEngine) listContainers() (ListContainersRes, error) {
|
||||||
uniqueIDs := make(map[string]cid.ID)
|
uniqueIDs := make(map[string]cid.ID)
|
||||||
|
|
||||||
e.iterateOverUnsortedShards(func(sh hashedShard) (stop bool) {
|
e.iterateOverUnsortedShards(func(sh hashedShard) (stop bool) {
|
||||||
cnrs, err := shard.ListContainers(sh.Shard)
|
res, err := sh.Shard.ListContainers(shard.ListContainersPrm{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.reportShardError(sh, "can't get list of containers", err)
|
e.reportShardError(sh, "can't get list of containers", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range cnrs {
|
for _, cnr := range res.Containers() {
|
||||||
id := cnrs[i].EncodeToString()
|
id := cnr.EncodeToString()
|
||||||
if _, ok := uniqueIDs[id]; !ok {
|
if _, ok := uniqueIDs[id]; !ok {
|
||||||
uniqueIDs[id] = cnrs[i]
|
uniqueIDs[id] = cnr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,3 @@ func (s *Shard) ContainerSize(prm ContainerSizePrm) (ContainerSizeRes, error) {
|
||||||
size: size,
|
size: size,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ContainerSize(s *Shard, cnr cid.ID) (uint64, error) {
|
|
||||||
res, err := s.ContainerSize(ContainerSizePrm{cnr: cnr})
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return res.Size(), nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -103,15 +103,6 @@ func (s *Shard) ListContainers(_ ListContainersPrm) (ListContainersRes, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ListContainers(s *Shard) ([]cid.ID, error) {
|
|
||||||
res, err := s.ListContainers(ListContainersPrm{})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return res.Containers(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListWithCursor lists physical objects available in shard starting from
|
// ListWithCursor lists physical objects available in shard starting from
|
||||||
// cursor. Includes regular, tombstone and storage group objects. Does not
|
// cursor. Includes regular, tombstone and storage group objects. Does not
|
||||||
// include inhumed objects. Use cursor value from response for consecutive requests.
|
// include inhumed objects. Use cursor value from response for consecutive requests.
|
||||||
|
@ -132,21 +123,3 @@ func (s *Shard) ListWithCursor(prm ListWithCursorPrm) (ListWithCursorRes, error)
|
||||||
cursor: res.Cursor(),
|
cursor: res.Cursor(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListWithCursor lists physical objects available in shard starting from
|
|
||||||
// cursor. Includes regular, tombstone and storage group objects. Does not
|
|
||||||
// include inhumed objects. Use cursor value from response for consecutive requests.
|
|
||||||
//
|
|
||||||
// Returns ErrEndOfListing if there are no more objects to return or count
|
|
||||||
// parameter set to zero.
|
|
||||||
func ListWithCursor(s *Shard, count uint32, cursor *Cursor) ([]oid.Address, *Cursor, error) {
|
|
||||||
var prm ListWithCursorPrm
|
|
||||||
prm.WithCount(count)
|
|
||||||
prm.WithCursor(cursor)
|
|
||||||
res, err := s.ListWithCursor(prm)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return res.AddressList(), res.Cursor(), nil
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue