@@ -11,13 +11,15 @@ class TListPortionsLock: public ILock {
1111 THashSet<TPortionAddress> Portions;
1212 THashSet<ui64> Granules;
1313protected:
14- virtual std::optional<TString> DoIsLocked (const TPortionInfo& portion, const THashSet<TString>& /* excludedLocks*/ ) const override {
14+ virtual std::optional<TString> DoIsLocked (
15+ const TPortionInfo& portion, const ELockCategory /* category*/ , const THashSet<TString>& /* excludedLocks*/ ) const override {
1516 if (Portions.contains (portion.GetAddress ())) {
1617 return GetLockName ();
1718 }
1819 return {};
1920 }
20- virtual std::optional<TString> DoIsLocked (const TGranuleMeta& granule, const THashSet<TString>& /* excludedLocks*/ ) const override {
21+ virtual std::optional<TString> DoIsLocked (
22+ const TGranuleMeta& granule, const ELockCategory /* category*/ , const THashSet<TString>& /* excludedLocks*/ ) const override {
2123 if (Granules.contains (granule.GetPathId ())) {
2224 return GetLockName ();
2325 }
@@ -27,42 +29,46 @@ class TListPortionsLock: public ILock {
2729 return Portions.empty ();
2830 }
2931public:
30- TListPortionsLock (const TString& lockName, const std::vector<TPortionDataAccessor>& portions, const bool readOnly = false )
31- : TBase(lockName, readOnly)
32+ TListPortionsLock (const TString& lockName, const std::vector<TPortionDataAccessor>& portions, const ELockCategory category, const bool readOnly = false )
33+ : TBase(lockName, category, readOnly)
3234 {
3335 for (auto && p : portions) {
3436 Portions.emplace (p.GetPortionInfo ().GetAddress ());
3537 Granules.emplace (p.GetPortionInfo ().GetPathId ());
3638 }
3739 }
3840
39- TListPortionsLock (const TString& lockName, const std::vector<std::shared_ptr<TPortionInfo>>& portions, const bool readOnly = false )
40- : TBase(lockName, readOnly) {
41+ TListPortionsLock (const TString& lockName, const std::vector<std::shared_ptr<TPortionInfo>>& portions, const ELockCategory category,
42+ const bool readOnly = false )
43+ : TBase(lockName, category, readOnly) {
4144 for (auto && p : portions) {
4245 Portions.emplace (p->GetAddress ());
4346 Granules.emplace (p->GetPathId ());
4447 }
4548 }
4649
47- TListPortionsLock (const TString& lockName, const std::vector<TPortionInfo::TConstPtr>& portions, const bool readOnly = false )
48- : TBase(lockName, readOnly) {
50+ TListPortionsLock (
51+ const TString& lockName, const std::vector<TPortionInfo::TConstPtr>& portions, const ELockCategory category, const bool readOnly = false )
52+ : TBase(lockName, category, readOnly) {
4953 for (auto && p : portions) {
5054 Portions.emplace (p->GetAddress ());
5155 Granules.emplace (p->GetPathId ());
5256 }
5357 }
5458
55- TListPortionsLock (const TString& lockName, const std::vector<TPortionInfo>& portions, const bool readOnly = false )
56- : TBase(lockName, readOnly) {
59+ TListPortionsLock (
60+ const TString& lockName, const std::vector<TPortionInfo>& portions, const ELockCategory category, const bool readOnly = false )
61+ : TBase(lockName, category, readOnly) {
5762 for (auto && p : portions) {
5863 Portions.emplace (p.GetAddress ());
5964 Granules.emplace (p.GetPathId ());
6065 }
6166 }
6267
6368 template <class T , class TGetter >
64- TListPortionsLock (const TString& lockName, const std::vector<T>& portions, const TGetter& g, const bool readOnly = false )
65- : TBase(lockName, readOnly) {
69+ TListPortionsLock (
70+ const TString& lockName, const std::vector<T>& portions, const TGetter& g, const ELockCategory category, const bool readOnly = false )
71+ : TBase(lockName, category, readOnly) {
6672 for (auto && p : portions) {
6773 const auto address = g (p);
6874 Portions.emplace (address);
@@ -71,17 +77,19 @@ class TListPortionsLock: public ILock {
7177 }
7278
7379 template <class T >
74- TListPortionsLock (const TString& lockName, const THashMap<TPortionAddress, T>& portions, const bool readOnly = false )
75- : TBase(lockName, readOnly) {
80+ TListPortionsLock (
81+ const TString& lockName, const THashMap<TPortionAddress, T>& portions, const ELockCategory category, const bool readOnly = false )
82+ : TBase(lockName, category, readOnly) {
7683 for (auto && p : portions) {
7784 const auto address = p.first ;
7885 Portions.emplace (address);
7986 Granules.emplace (address.GetPathId ());
8087 }
8188 }
8289
83- TListPortionsLock (const TString& lockName, const THashSet<TPortionAddress>& portions, const bool readOnly = false )
84- : TBase(lockName, readOnly) {
90+ TListPortionsLock (
91+ const TString& lockName, const THashSet<TPortionAddress>& portions, const ELockCategory category, const bool readOnly = false )
92+ : TBase(lockName, category, readOnly) {
8593 for (auto && address : portions) {
8694 Portions.emplace (address);
8795 Granules.emplace (address.GetPathId ());
@@ -94,13 +102,15 @@ class TListTablesLock: public ILock {
94102 using TBase = ILock;
95103 THashSet<ui64> Tables;
96104protected:
97- virtual std::optional<TString> DoIsLocked (const TPortionInfo& portion, const THashSet<TString>& /* excludedLocks*/ ) const override {
105+ virtual std::optional<TString> DoIsLocked (
106+ const TPortionInfo& portion, const ELockCategory /* category*/ , const THashSet<TString>& /* excludedLocks*/ ) const override {
98107 if (Tables.contains (portion.GetPathId ())) {
99108 return GetLockName ();
100109 }
101110 return {};
102111 }
103- virtual std::optional<TString> DoIsLocked (const TGranuleMeta& granule, const THashSet<TString>& /* excludedLocks*/ ) const override {
112+ virtual std::optional<TString> DoIsLocked (
113+ const TGranuleMeta& granule, const ELockCategory /* category*/ , const THashSet<TString>& /* excludedLocks*/ ) const override {
104114 if (Tables.contains (granule.GetPathId ())) {
105115 return GetLockName ();
106116 }
@@ -110,8 +120,8 @@ class TListTablesLock: public ILock {
110120 return Tables.empty ();
111121 }
112122public:
113- TListTablesLock (const TString& lockName, const THashSet<ui64>& tables, const bool readOnly = false )
114- : TBase(lockName, readOnly)
123+ TListTablesLock (const TString& lockName, const THashSet<ui64>& tables, const ELockCategory category, const bool readOnly = false )
124+ : TBase(lockName, category, readOnly)
115125 , Tables(tables)
116126 {
117127 }
0 commit comments