aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Roizner <mroizner@gmail.com>2022-02-10 16:50:47 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:47 +0300
commit4e10711f67db90b5b08220fee274f8f0fe620485 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8
parenta196186fa7feb0aae6d87e1b6d890a83851be4f2 (diff)
downloadydb-4e10711f67db90b5b08220fee274f8f0fe620485.tar.gz
Restoring authorship annotation for Michael Roizner <mroizner@gmail.com>. Commit 2 of 2.
-rw-r--r--library/cpp/yt/misc/property.h48
-rw-r--r--library/cpp/yt/string/enum.h2
-rw-r--r--util/system/file.cpp52
-rw-r--r--util/system/file.h4
-rw-r--r--util/system/file_ut.cpp12
-rw-r--r--util/system/filemap.cpp12
-rw-r--r--util/system/filemap.h8
7 files changed, 69 insertions, 69 deletions
diff --git a/library/cpp/yt/misc/property.h b/library/cpp/yt/misc/property.h
index d0d931219f..bef8024ae1 100644
--- a/library/cpp/yt/misc/property.h
+++ b/library/cpp/yt/misc/property.h
@@ -1,7 +1,7 @@
-#pragma once
-
-////////////////////////////////////////////////////////////////////////////////
-
+#pragma once
+
+////////////////////////////////////////////////////////////////////////////////
+
//! Declares a trivial public read-write property that is passed by reference.
#define DECLARE_BYREF_RW_PROPERTY(type, name) \
public: \
@@ -13,18 +13,18 @@ public: \
#define DEFINE_BYREF_RW_PROPERTY(type, name, ...) \
protected: \
type name##_ { __VA_ARGS__ }; \
- \
-public: \
+ \
+public: \
Y_FORCE_INLINE type& name() \
- { \
- return name##_; \
- } \
- \
+ { \
+ return name##_; \
+ } \
+ \
Y_FORCE_INLINE const type& name() const \
- { \
- return name##_; \
- }
-
+ { \
+ return name##_; \
+ }
+
//! Defines a trivial public read-write property that is passed by reference
//! and is not inline-initialized.
#define DEFINE_BYREF_RW_PROPERTY_NO_INIT(type, name) \
@@ -105,18 +105,18 @@ public: \
#define DEFINE_BYVAL_RW_PROPERTY(type, name, ...) \
protected: \
type name##_ { __VA_ARGS__ }; \
- \
-public: \
+ \
+public: \
Y_FORCE_INLINE type Get##name() const \
- { \
- return name##_; \
- } \
- \
+ { \
+ return name##_; \
+ } \
+ \
Y_FORCE_INLINE void Set##name(type value) \
- { \
- name##_ = value; \
+ { \
+ name##_ = value; \
} \
-
+
//! Defines a trivial public read-write property that is passed by value.
//! All arguments after name are used as default value (via braced-init-list).
#define DEFINE_BYVAL_RW_PROPERTY_WITH_FLUENT_SETTER(declaringType, type, name, ...) \
@@ -208,7 +208,7 @@ public: \
return (delegateTo).Get##name(); \
}
-////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
//! Below are macro helpers for extra properties.
//! Extra properties should be used for lazy memory allocation for properties that
diff --git a/library/cpp/yt/string/enum.h b/library/cpp/yt/string/enum.h
index f85cc69a19..10dc02610f 100644
--- a/library/cpp/yt/string/enum.h
+++ b/library/cpp/yt/string/enum.h
@@ -13,7 +13,7 @@ namespace NYT {
TString DecodeEnumValue(TStringBuf value);
TString EncodeEnumValue(TStringBuf value);
-template <class T>
+template <class T>
T ParseEnum(TStringBuf value);
template <class T>
diff --git a/util/system/file.cpp b/util/system/file.cpp
index d6d7d05062..4a261d020c 100644
--- a/util/system/file.cpp
+++ b/util/system/file.cpp
@@ -339,25 +339,25 @@ bool TFileHandle::Resize(i64 length) noexcept {
if (!IsOpen()) {
return false;
}
- i64 currentLength = GetLength();
+ i64 currentLength = GetLength();
if (length == currentLength) {
- return true;
+ return true;
}
#if defined(_win_)
- i64 currentPosition = GetPosition();
+ i64 currentPosition = GetPosition();
if (currentPosition == -1L) {
return false;
}
- Seek(length, sSet);
+ Seek(length, sSet);
if (!::SetEndOfFile(Fd_)) {
return false;
}
if (currentPosition < length) {
- Seek(currentPosition, sSet);
+ Seek(currentPosition, sSet);
}
return true;
#elif defined(_unix_)
- return (0 == ftruncate(Fd_, (off_t)length));
+ return (0 == ftruncate(Fd_, (off_t)length));
#else
#error unsupported platform
#endif
@@ -366,28 +366,28 @@ bool TFileHandle::Resize(i64 length) noexcept {
bool TFileHandle::Reserve(i64 length) noexcept {
// FIXME this should reserve disk space with fallocate
if (!IsOpen()) {
- return false;
+ return false;
}
- i64 currentLength = GetLength();
+ i64 currentLength = GetLength();
if (length <= currentLength) {
- return true;
+ return true;
}
if (!Resize(length)) {
- return false;
+ return false;
}
#if defined(_win_)
- if (!::SetFileValidData(Fd_, length)) {
- Resize(currentLength);
- return false;
- }
+ if (!::SetFileValidData(Fd_, length)) {
+ Resize(currentLength);
+ return false;
+ }
#elif defined(_unix_)
// No way to implement this under FreeBSD. Just do nothing
-#else
+#else
#error unsupported platform
-#endif
- return true;
-}
-
+#endif
+ return true;
+}
+
bool TFileHandle::FallocateNoResize(i64 length) noexcept {
if (!IsOpen()) {
return false;
@@ -897,7 +897,7 @@ public:
ythrow TFileError() << "can't reserve " << length << " for file " << FileName_.Quote();
}
}
-
+
void FallocateNoResize(i64 length) {
if (!Handle_.FallocateNoResize(length)) {
ythrow TFileError() << "can't allocate " << length << "bytes of space for file " << FileName_.Quote();
@@ -1137,14 +1137,14 @@ i64 TFile::Seek(i64 offset, SeekDir origin) {
return Impl_->Seek(offset, origin);
}
-void TFile::Resize(i64 length) {
- Impl_->Resize(length);
+void TFile::Resize(i64 length) {
+ Impl_->Resize(length);
+}
+
+void TFile::Reserve(i64 length) {
+ Impl_->Reserve(length);
}
-void TFile::Reserve(i64 length) {
- Impl_->Reserve(length);
-}
-
void TFile::FallocateNoResize(i64 length) {
Impl_->FallocateNoResize(length);
}
diff --git a/util/system/file.h b/util/system/file.h
index 3c22a7edd5..9502e159b6 100644
--- a/util/system/file.h
+++ b/util/system/file.h
@@ -162,8 +162,8 @@ public:
FHANDLE GetHandle() const noexcept;
i64 Seek(i64 offset, SeekDir origin);
- void Resize(i64 length);
- void Reserve(i64 length);
+ void Resize(i64 length);
+ void Reserve(i64 length);
void FallocateNoResize(i64 length);
void ShrinkToFit();
void Flush();
diff --git a/util/system/file_ut.cpp b/util/system/file_ut.cpp
index 098a875766..941e6a50f3 100644
--- a/util/system/file_ut.cpp
+++ b/util/system/file_ut.cpp
@@ -92,24 +92,24 @@ public:
UNIT_ASSERT_EQUAL(TUnbufferedFileInput(tmp.Name()).ReadAll(), "67895678");
}
-
+
inline void TestResize() {
TTempFile tmp("tmp");
-
+
{
TFile file(tmp.Name(), OpenAlways | WrOnly);
-
+
file.Write("1234567", 7);
file.Seek(3, sSet);
-
+
file.Resize(5);
UNIT_ASSERT_EQUAL(file.GetLength(), 5);
UNIT_ASSERT_EQUAL(file.GetPosition(), 3);
-
+
file.Resize(12);
UNIT_ASSERT_EQUAL(file.GetLength(), 12);
UNIT_ASSERT_EQUAL(file.GetPosition(), 3);
- }
+ }
const TString data = TUnbufferedFileInput(tmp.Name()).ReadAll();
UNIT_ASSERT_EQUAL(data.length(), 12);
diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp
index d75c666b36..7454a4cb94 100644
--- a/util/system/filemap.cpp
+++ b/util/system/filemap.cpp
@@ -474,20 +474,20 @@ TFileMap::TFileMap(const TFileMap& fm) noexcept
{
}
-void TFileMap::Flush(void* ptr, size_t size, bool sync) {
+void TFileMap::Flush(void* ptr, size_t size, bool sync) {
Y_ASSERT(ptr >= Ptr());
Y_ASSERT(static_cast<char*>(ptr) + size <= static_cast<char*>(Ptr()) + MappedSize());
-
+
if (!Region_.IsMapped()) {
return;
}
#if defined(_win_)
- if (sync) {
- FlushViewOfFile(ptr, size);
- }
+ if (sync) {
+ FlushViewOfFile(ptr, size);
+ }
#else
- msync(ptr, size, sync ? MS_SYNC : MS_ASYNC);
+ msync(ptr, size, sync ? MS_SYNC : MS_ASYNC);
#endif
}
diff --git a/util/system/filemap.h b/util/system/filemap.h
index 0016d4f9e5..11be64bff4 100644
--- a/util/system/filemap.h
+++ b/util/system/filemap.h
@@ -129,15 +129,15 @@ public:
void Flush() {
Flush(Ptr(), MappedSize());
}
-
+
void FlushAsync(void* ptr, size_t size) {
Flush(ptr, size, false);
}
-
+
void FlushAsync() {
FlushAsync(Ptr(), MappedSize());
}
-
+
inline i64 Length() const noexcept {
return Map_.Length();
}
@@ -178,7 +178,7 @@ public:
private:
void Flush(void* ptr, size_t size, bool sync);
-
+
TMemoryMap Map_;
TMapResult Region_;
};