diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-02-11 19:15:32 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-02-11 19:15:32 +0300 |
commit | 623b75523fbec13f26b532972a46e75faf149088 (patch) | |
tree | ce04a52fd058b3017037ecc4a843a39c2a829575 /library/cpp/deprecated/mapped_file/mapped_file.h | |
parent | 4f5398551111a2b05b55de391d5d296bd0a670bf (diff) | |
download | ydb-623b75523fbec13f26b532972a46e75faf149088.tar.gz |
intermediate changes
ref:ee911405f4248489c0aa2817134b7162e0b94f18
Diffstat (limited to 'library/cpp/deprecated/mapped_file/mapped_file.h')
-rw-r--r-- | library/cpp/deprecated/mapped_file/mapped_file.h | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/library/cpp/deprecated/mapped_file/mapped_file.h b/library/cpp/deprecated/mapped_file/mapped_file.h deleted file mode 100644 index 45859ed65a..0000000000 --- a/library/cpp/deprecated/mapped_file/mapped_file.h +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include <util/generic/flags.h> -#include <util/generic/ptr.h> -#include <util/generic/string.h> -#include <util/generic/utility.h> -#include <util/generic/yexception.h> -#include <util/system/align.h> -#include <util/system/file.h> -#include <util/system/filemap.h> -#include <util/system/yassert.h> - -#include <cstdio> -#include <new> - -/// Deprecated (by pg@), use TFileMap or TMemoryMap instead -class TMappedFile { -private: - TFileMap* Map_; - -private: - TMappedFile(TFileMap* map, const char* dbgName); - -public: - TMappedFile() { - Map_ = nullptr; - } - - ~TMappedFile() { - term(); - } - - explicit TMappedFile(const TString& name) { - Map_ = nullptr; - init(name, TFileMap::oRdOnly); - } - - TMappedFile(const TFile& file, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown"); - - void init(const TString& name); - - void init(const TString& name, TFileMap::EOpenMode om); - - void init(const TString& name, size_t length, TFileMap::EOpenMode om); - - void init(const TFile&, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown"); - - void flush(); - - void term() { - if (Map_) { - Map_->Unmap(); - delete Map_; - Map_ = nullptr; - } - } - - size_t getSize() const { - return (Map_ ? Map_->MappedSize() : 0); - } - - void* getData(size_t pos = 0) const { - Y_ASSERT(!Map_ || (pos <= getSize())); - return (Map_ ? (void*)((unsigned char*)Map_->Ptr() + pos) : nullptr); - } - - void precharge(size_t pos = 0, size_t size = (size_t)-1) const; - - void swap(TMappedFile& file) noexcept { - DoSwap(Map_, file.Map_); - } -}; |