|
@@ -117,13 +117,13 @@ public:
|
|
ythrow yexception() << "can not map(" << offset << ", " << len << ")";
|
|
ythrow yexception() << "can not map(" << offset << ", " << len << ")";
|
|
}
|
|
}
|
|
|
|
|
|
- if (Mode_ == EMappingMode::Locked) {
|
|
|
|
|
|
+ if (Mode_ == EMappingMode::Locked) {
|
|
LockMemory(Data(), Length());
|
|
LockMemory(Data(), Length());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
~TMappedBlobBase() override {
|
|
~TMappedBlobBase() override {
|
|
- if (Mode_ == EMappingMode::Locked && Length()) {
|
|
|
|
|
|
+ if (Mode_ == EMappingMode::Locked && Length()) {
|
|
UnlockMemory(Data(), Length());
|
|
UnlockMemory(Data(), Length());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -208,7 +208,7 @@ static inline TBlob ConstructFromMap(const TMemoryMap& map, ui64 offset, size_t
|
|
|
|
|
|
template <class TCounter, class T>
|
|
template <class TCounter, class T>
|
|
static inline TBlob ConstructAsMap(const T& t, EMappingMode mode) {
|
|
static inline TBlob ConstructAsMap(const T& t, EMappingMode mode) {
|
|
- TMemoryMap::EOpenMode openMode = (mode == EMappingMode::Precharged) ? (TMemoryMap::oRdOnly | TMemoryMap::oPrecharge) : TMemoryMap::oRdOnly;
|
|
|
|
|
|
+ TMemoryMap::EOpenMode openMode = (mode == EMappingMode::Precharged) ? (TMemoryMap::oRdOnly | TMemoryMap::oPrecharge) : TMemoryMap::oRdOnly;
|
|
|
|
|
|
TMemoryMap map(t, openMode);
|
|
TMemoryMap map(t, openMode);
|
|
const ui64 toMap = map.Length();
|
|
const ui64 toMap = map.Length();
|
|
@@ -220,84 +220,84 @@ static inline TBlob ConstructAsMap(const T& t, EMappingMode mode) {
|
|
return ConstructFromMap<TCounter>(map, 0, static_cast<size_t>(toMap), mode);
|
|
return ConstructFromMap<TCounter>(map, 0, static_cast<size_t>(toMap), mode);
|
|
}
|
|
}
|
|
|
|
|
|
-TBlob TBlob::FromFileSingleThreaded(const TString& path, EMappingMode mode) {
|
|
|
|
- return ConstructAsMap<TSimpleCounter>(path, mode);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-TBlob TBlob::FromFile(const TString& path, EMappingMode mode) {
|
|
|
|
- return ConstructAsMap<TAtomicCounter>(path, mode);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-TBlob TBlob::FromFileSingleThreaded(const TFile& file, EMappingMode mode) {
|
|
|
|
- return ConstructAsMap<TSimpleCounter>(file, mode);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-TBlob TBlob::FromFile(const TFile& file, EMappingMode mode) {
|
|
|
|
- return ConstructAsMap<TAtomicCounter>(file, mode);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
+TBlob TBlob::FromFileSingleThreaded(const TString& path, EMappingMode mode) {
|
|
|
|
+ return ConstructAsMap<TSimpleCounter>(path, mode);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TBlob TBlob::FromFile(const TString& path, EMappingMode mode) {
|
|
|
|
+ return ConstructAsMap<TAtomicCounter>(path, mode);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TBlob TBlob::FromFileSingleThreaded(const TFile& file, EMappingMode mode) {
|
|
|
|
+ return ConstructAsMap<TSimpleCounter>(file, mode);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+TBlob TBlob::FromFile(const TFile& file, EMappingMode mode) {
|
|
|
|
+ return ConstructAsMap<TAtomicCounter>(file, mode);
|
|
|
|
+}
|
|
|
|
+
|
|
TBlob TBlob::FromFileSingleThreaded(const TString& path) {
|
|
TBlob TBlob::FromFileSingleThreaded(const TString& path) {
|
|
- return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Standard);
|
|
|
|
|
|
+ return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Standard);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::FromFile(const TString& path) {
|
|
TBlob TBlob::FromFile(const TString& path) {
|
|
- return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Standard);
|
|
|
|
|
|
+ return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Standard);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::FromFileSingleThreaded(const TFile& file) {
|
|
TBlob TBlob::FromFileSingleThreaded(const TFile& file) {
|
|
- return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Standard);
|
|
|
|
|
|
+ return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Standard);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::FromFile(const TFile& file) {
|
|
TBlob TBlob::FromFile(const TFile& file) {
|
|
- return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Standard);
|
|
|
|
|
|
+ return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Standard);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::PrechargedFromFileSingleThreaded(const TString& path) {
|
|
TBlob TBlob::PrechargedFromFileSingleThreaded(const TString& path) {
|
|
- return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Precharged);
|
|
|
|
|
|
+ return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Precharged);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::PrechargedFromFile(const TString& path) {
|
|
TBlob TBlob::PrechargedFromFile(const TString& path) {
|
|
- return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Precharged);
|
|
|
|
|
|
+ return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Precharged);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::PrechargedFromFileSingleThreaded(const TFile& file) {
|
|
TBlob TBlob::PrechargedFromFileSingleThreaded(const TFile& file) {
|
|
- return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Precharged);
|
|
|
|
|
|
+ return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Precharged);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::PrechargedFromFile(const TFile& file) {
|
|
TBlob TBlob::PrechargedFromFile(const TFile& file) {
|
|
- return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Precharged);
|
|
|
|
|
|
+ return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Precharged);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::LockedFromFileSingleThreaded(const TString& path) {
|
|
TBlob TBlob::LockedFromFileSingleThreaded(const TString& path) {
|
|
- return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Locked);
|
|
|
|
|
|
+ return ConstructAsMap<TSimpleCounter>(path, EMappingMode::Locked);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::LockedFromFile(const TString& path) {
|
|
TBlob TBlob::LockedFromFile(const TString& path) {
|
|
- return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Locked);
|
|
|
|
|
|
+ return ConstructAsMap<TAtomicCounter>(path, EMappingMode::Locked);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::LockedFromFileSingleThreaded(const TFile& file) {
|
|
TBlob TBlob::LockedFromFileSingleThreaded(const TFile& file) {
|
|
- return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Locked);
|
|
|
|
|
|
+ return ConstructAsMap<TSimpleCounter>(file, EMappingMode::Locked);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::LockedFromFile(const TFile& file) {
|
|
TBlob TBlob::LockedFromFile(const TFile& file) {
|
|
- return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Locked);
|
|
|
|
|
|
+ return ConstructAsMap<TAtomicCounter>(file, EMappingMode::Locked);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::LockedFromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) {
|
|
TBlob TBlob::LockedFromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) {
|
|
- return ConstructFromMap<TSimpleCounter>(map, offset, length, EMappingMode::Locked);
|
|
|
|
|
|
+ return ConstructFromMap<TSimpleCounter>(map, offset, length, EMappingMode::Locked);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::LockedFromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) {
|
|
TBlob TBlob::LockedFromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) {
|
|
- return ConstructFromMap<TAtomicCounter>(map, offset, length, EMappingMode::Locked);
|
|
|
|
|
|
+ return ConstructFromMap<TAtomicCounter>(map, offset, length, EMappingMode::Locked);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::FromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) {
|
|
TBlob TBlob::FromMemoryMapSingleThreaded(const TMemoryMap& map, ui64 offset, size_t length) {
|
|
- return ConstructFromMap<TSimpleCounter>(map, offset, length, EMappingMode::Standard);
|
|
|
|
|
|
+ return ConstructFromMap<TSimpleCounter>(map, offset, length, EMappingMode::Standard);
|
|
}
|
|
}
|
|
|
|
|
|
TBlob TBlob::FromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) {
|
|
TBlob TBlob::FromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length) {
|
|
- return ConstructFromMap<TAtomicCounter>(map, offset, length, EMappingMode::Standard);
|
|
|
|
|
|
+ return ConstructFromMap<TAtomicCounter>(map, offset, length, EMappingMode::Standard);
|
|
}
|
|
}
|
|
|
|
|
|
template <class TCounter>
|
|
template <class TCounter>
|