[#2068] blobstor: Allow to provide storage ID in Exists

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-11-17 09:29:35 +03:00 committed by fyrchik
parent 6ad2b5d5b8
commit 63f604e948
5 changed files with 101 additions and 4 deletions

View file

@ -13,6 +13,13 @@ func (b *BlobStor) Exists(prm common.ExistsPrm) (common.ExistsRes, error) {
b.modeMtx.RLock()
defer b.modeMtx.RUnlock()
if prm.StorageID != nil {
if len(prm.StorageID) == 0 {
return b.storage[len(b.storage)-1].Storage.Exists(prm)
}
return b.storage[0].Storage.Exists(prm)
}
// If there was an error during existence check below,
// it will be returned unless object was found in blobovnicza.
// Otherwise, it is logged and the latest error is returned.