@@ -11,36 +11,42 @@ class TListPortionsLock: public ILock {
1111 THashSet<TPortionAddress> Portions;
1212 THashSet<TTabletId> Granules;
1313protected:
14- virtual bool DoIsLocked (const TPortionInfo& portion) const override {
15- return Portions.contains (portion.GetAddress ());
14+ virtual std::optional<TString> DoIsLocked (const TPortionInfo& portion) const override {
15+ if (Portions.contains (portion.GetAddress ())) {
16+ return GetLockName ();
17+ }
18+ return {};
1619 }
17- virtual bool DoIsLocked (const TGranuleMeta& granule) const override {
18- return Granules.contains ((TTabletId)granule.GetPathId ());
20+ virtual std::optional<TString> DoIsLocked (const TGranuleMeta& granule) const override {
21+ if (Granules.contains ((TTabletId)granule.GetPathId ())) {
22+ return GetLockName ();
23+ }
24+ return {};
1925 }
2026 bool DoIsEmpty () const override {
2127 return Portions.empty ();
2228 }
2329public:
24- TListPortionsLock (const std::vector<std::shared_ptr<TPortionInfo>>& portions, const bool readOnly = false )
25- : TBase(readOnly)
30+ TListPortionsLock (const TString& lockName, const std::vector<std::shared_ptr<TPortionInfo>>& portions, const bool readOnly = false )
31+ : TBase(lockName, readOnly)
2632 {
2733 for (auto && p : portions) {
2834 Portions.emplace (p->GetAddress ());
2935 Granules.emplace ((TTabletId)p->GetPathId ());
3036 }
3137 }
3238
33- TListPortionsLock (const std::vector<TPortionInfo>& portions, const bool readOnly = false )
34- : TBase(readOnly) {
39+ TListPortionsLock (const TString& lockName, const std::vector<TPortionInfo>& portions, const bool readOnly = false )
40+ : TBase(lockName, readOnly) {
3541 for (auto && p : portions) {
3642 Portions.emplace (p.GetAddress ());
3743 Granules.emplace ((TTabletId)p.GetPathId ());
3844 }
3945 }
4046
4147 template <class T , class TGetter >
42- TListPortionsLock (const std::vector<T>& portions, const TGetter& g, const bool readOnly = false )
43- : TBase(readOnly) {
48+ TListPortionsLock (const TString& lockName, const std::vector<T>& portions, const TGetter& g, const bool readOnly = false )
49+ : TBase(lockName, readOnly) {
4450 for (auto && p : portions) {
4551 const auto address = g (p);
4652 Portions.emplace (address);
@@ -49,8 +55,8 @@ class TListPortionsLock: public ILock {
4955 }
5056
5157 template <class T >
52- TListPortionsLock (const THashMap<TPortionAddress, T>& portions, const bool readOnly = false )
53- : TBase(readOnly) {
58+ TListPortionsLock (const TString& lockName, const THashMap<TPortionAddress, T>& portions, const bool readOnly = false )
59+ : TBase(lockName, readOnly) {
5460 for (auto && p : portions) {
5561 const auto address = p.first ;
5662 Portions.emplace (address);
0 commit comments