aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorsskvor <sskvor@yandex-team.ru>2022-02-10 16:48:04 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:04 +0300
commit10ade5dcb952a8fae61f734485641a8409e1c545 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp
parent75abffb472365d28bd0a019db1a54cb32a6100dd (diff)
downloadydb-10ade5dcb952a8fae61f734485641a8409e1c545.tar.gz
Restoring authorship annotation for <sskvor@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/deprecated/ya.make8
-rw-r--r--library/cpp/http/server/http.cpp22
-rw-r--r--library/cpp/http/server/http.h2
-rw-r--r--library/cpp/http/server/options.h16
-rw-r--r--library/cpp/logger/all.h2
-rw-r--r--library/cpp/logger/sync_page_cache_file.cpp250
-rw-r--r--library/cpp/logger/sync_page_cache_file.h38
-rw-r--r--library/cpp/logger/ya.make2
-rw-r--r--library/cpp/testing/benchmark/bench.h12
-rw-r--r--library/cpp/testing/benchmark/dummy.cpp16
-rw-r--r--library/cpp/testing/benchmark/ya.make2
-rw-r--r--library/cpp/threading/skip_list/skiplist.h16
12 files changed, 193 insertions, 193 deletions
diff --git a/library/cpp/deprecated/ya.make b/library/cpp/deprecated/ya.make
index 52e73457fb..6c753f68a9 100644
--- a/library/cpp/deprecated/ya.make
+++ b/library/cpp/deprecated/ya.make
@@ -23,11 +23,11 @@ RECURSE(
mapped_file
mapped_file/ut
mbitmap
- omni
+ omni
text_norm
- omni/print_omni
- omni/usage
- omni/ut
+ omni/print_omni
+ omni/usage
+ omni/ut
prog_options
prog_options/ut
sgi_hash
diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp
index 978847d5ca..128583bdd7 100644
--- a/library/cpp/http/server/http.cpp
+++ b/library/cpp/http/server/http.cpp
@@ -2,7 +2,7 @@
#include "http_ex.h"
#include <library/cpp/threading/equeue/equeue.h>
-
+
#include <util/generic/buffer.h>
#include <util/generic/cast.h>
#include <util/generic/intrlist.h>
@@ -458,8 +458,8 @@ public:
THttpServer* Parent_ = nullptr;
TWakeupPollAble WakeupPollAble;
TMutex StopMutex;
-
-private:
+
+private:
template <class TThreadPool_>
static THolder<IThreadPool> MakeThreadPool(IThreadFactory* factory, bool elastic, ICallBack* callback = nullptr, const TString& threadName = {}) {
if (!factory) {
@@ -470,20 +470,20 @@ private:
const auto params = IThreadPool::TParams().SetFactory(factory).SetThreadName(threadName);
if (callback) {
pool = MakeHolder<TThreadPoolBinder<TThreadPool_, THttpServer::ICallBack>>(callback, params);
- } else {
+ } else {
pool = MakeHolder<TThreadPool_>(params);
- }
-
- if (elastic) {
+ }
+
+ if (elastic) {
pool = MakeHolder<TElasticQueue>(std::move(pool));
- }
+ }
return pool;
- }
+ }
};
-THttpServer::THttpServer(ICallBack* cb, const TOptions& options, IThreadFactory* pool)
- : Impl_(new TImpl(this, cb, options, pool))
+THttpServer::THttpServer(ICallBack* cb, const TOptions& options, IThreadFactory* pool)
+ : Impl_(new TImpl(this, cb, options, pool))
{
}
diff --git a/library/cpp/http/server/http.h b/library/cpp/http/server/http.h
index 79e8754a0c..b292d38f27 100644
--- a/library/cpp/http/server/http.h
+++ b/library/cpp/http/server/http.h
@@ -64,7 +64,7 @@ public:
typedef THttpServerOptions TOptions;
typedef TSimpleSharedPtr<IThreadPool> TMtpQueueRef;
- THttpServer(ICallBack* cb, const TOptions& options = TOptions(), IThreadFactory* pool = nullptr);
+ THttpServer(ICallBack* cb, const TOptions& options = TOptions(), IThreadFactory* pool = nullptr);
THttpServer(ICallBack* cb, TMtpQueueRef mainWorkers, TMtpQueueRef failWorkers, const TOptions& options = TOptions());
virtual ~THttpServer();
diff --git a/library/cpp/http/server/options.h b/library/cpp/http/server/options.h
index 5d35eddf5d..38eda0e5e7 100644
--- a/library/cpp/http/server/options.h
+++ b/library/cpp/http/server/options.h
@@ -124,13 +124,13 @@ public:
return *this;
}
- /// Use TElasticQueue instead of TThreadPool for request queues
- inline THttpServerOptions& EnableElasticQueues(bool enable) noexcept {
- UseElasticQueues = enable;
-
- return *this;
- }
-
+ /// Use TElasticQueue instead of TThreadPool for request queues
+ inline THttpServerOptions& EnableElasticQueues(bool enable) noexcept {
+ UseElasticQueues = enable;
+
+ return *this;
+ }
+
inline THttpServerOptions& SetThreadsName(const TString& listenThreadName, const TString& requestsThreadName, const TString& failRequestsThreadName) noexcept {
ListenThreadName = listenThreadName;
RequestsThreadName = requestsThreadName;
@@ -165,7 +165,7 @@ public:
size_t OutputBufferSize = 0;
ui64 MaxInputContentLength = sizeof(size_t) <= 4 ? 2_GB : 64_GB;
size_t MaxRequestsPerConnection = 0; // If keep-alive is enabled, request limit before connection is closed
- bool UseElasticQueues = false;
+ bool UseElasticQueues = false;
TDuration PollTimeout; // timeout of TSocketPoller::WaitT call
TDuration ExpirationTimeout; // drop inactive connections after ExpirationTimeout (should be > 0)
diff --git a/library/cpp/logger/all.h b/library/cpp/logger/all.h
index e7530f1771..ee1666844e 100644
--- a/library/cpp/logger/all.h
+++ b/library/cpp/logger/all.h
@@ -6,4 +6,4 @@
#include "stream.h"
#include "thread.h"
#include "system.h"
-#include "sync_page_cache_file.h"
+#include "sync_page_cache_file.h"
diff --git a/library/cpp/logger/sync_page_cache_file.cpp b/library/cpp/logger/sync_page_cache_file.cpp
index c767b8d75d..a0e93a78d7 100644
--- a/library/cpp/logger/sync_page_cache_file.cpp
+++ b/library/cpp/logger/sync_page_cache_file.cpp
@@ -1,125 +1,125 @@
-#include "sync_page_cache_file.h"
-#include "record.h"
-
-#include <util/generic/buffer.h>
-#include <util/system/file.h>
-#include <util/system/info.h>
-#include <util/system/mutex.h>
-#include <util/system/rwlock.h>
-#include <util/system/align.h>
-
-class TSyncPageCacheFileLogBackend::TImpl: public TNonCopyable {
-public:
- TImpl(const TString& path, size_t maxBufferSize, size_t maxPendingCacheSize)
- : File_{OpenFile(path)}
- , MaxBufferSize_{maxBufferSize}
- , MaxPendingCacheSize_{maxPendingCacheSize}
- , Buffer_{maxBufferSize}
- {
- ResetPtrs();
- }
-
- ~TImpl() noexcept {
- try {
- Write();
- FlushSync(GuaranteedWrittenPtr_, WrittenPtr_);
- } catch (...) {
- }
- }
-
- void WriteData(const TLogRecord& rec) {
- TGuard guard{Lock_};
-
- Buffer_.Append(rec.Data, rec.Len);
- if (Buffer_.size() >= MaxBufferSize_) {
- const i64 prevAlignedEndPtr = PageAlignedWrittenPtr_;
- Write();
-
- if (prevAlignedEndPtr < PageAlignedWrittenPtr_) {
- FlushAsync(prevAlignedEndPtr, PageAlignedWrittenPtr_);
- }
-
- const i64 minPendingCacheOffset = PageAlignedWrittenPtr_ - MaxPendingCacheSize_;
- if (minPendingCacheOffset > GuaranteedWrittenPtr_) {
- FlushSync(GuaranteedWrittenPtr_, minPendingCacheOffset);
- }
- }
- }
-
- void ReopenLog() {
- TGuard guard{Lock_};
-
- Write();
- FlushSync(GuaranteedWrittenPtr_, WrittenPtr_);
-
- File_.LinkTo(OpenFile(File_.GetName()));
-
- ResetPtrs();
- }
-
-private:
- void ResetPtrs() {
- WrittenPtr_ = File_.GetLength();
- PageAlignedWrittenPtr_ = AlignDown(WrittenPtr_, GetPageSize());
- GuaranteedWrittenPtr_ = WrittenPtr_;
- }
-
- static TFile OpenFile(const TString& path) {
- return TFile{path, OpenAlways | WrOnly | ForAppend | Seq | NoReuse};
- }
-
- static i64 GetPageSize() {
- static const i64 pageSize = NSystemInfo::GetPageSize();
- Y_ASSUME(IsPowerOf2(pageSize));
- return pageSize;
- }
-
- void Write() {
- File_.Write(Buffer_.Data(), Buffer_.Size());
- WrittenPtr_ += Buffer_.Size();
- PageAlignedWrittenPtr_ = AlignDown(WrittenPtr_, GetPageSize());
- Buffer_.Clear();
- }
-
- void FlushAsync(const i64 from, const i64 to) {
- File_.FlushCache(from, to - from, /* wait = */ false);
- }
-
- void FlushSync(const i64 from, const i64 to) {
- const i64 begin = AlignDown(from, GetPageSize());
- const i64 end = AlignUp(to, GetPageSize());
- const i64 length = end - begin;
-
- File_.FlushCache(begin, length, /* wait = */ true);
- File_.EvictCache(begin, length);
-
- GuaranteedWrittenPtr_ = to;
- }
-
-private:
- TMutex Lock_;
- TFile File_;
-
- const size_t MaxBufferSize_ = 0;
- const size_t MaxPendingCacheSize_ = 0;
-
- TBuffer Buffer_;
- i64 WrittenPtr_ = 0;
- i64 PageAlignedWrittenPtr_ = 0;
- i64 GuaranteedWrittenPtr_ = 0;
-};
-
-TSyncPageCacheFileLogBackend::TSyncPageCacheFileLogBackend(const TString& path, size_t maxBufferSize, size_t maxPengingCacheSize)
- : Impl_(MakeHolder<TImpl>(path, maxBufferSize, maxPengingCacheSize))
-{}
-
-TSyncPageCacheFileLogBackend::~TSyncPageCacheFileLogBackend() {
-}
-
-void TSyncPageCacheFileLogBackend::WriteData(const TLogRecord& rec) {
- Impl_->WriteData(rec);
-}
-
-void TSyncPageCacheFileLogBackend::ReopenLog() {
- Impl_->ReopenLog();
-}
+#include "sync_page_cache_file.h"
+#include "record.h"
+
+#include <util/generic/buffer.h>
+#include <util/system/file.h>
+#include <util/system/info.h>
+#include <util/system/mutex.h>
+#include <util/system/rwlock.h>
+#include <util/system/align.h>
+
+class TSyncPageCacheFileLogBackend::TImpl: public TNonCopyable {
+public:
+ TImpl(const TString& path, size_t maxBufferSize, size_t maxPendingCacheSize)
+ : File_{OpenFile(path)}
+ , MaxBufferSize_{maxBufferSize}
+ , MaxPendingCacheSize_{maxPendingCacheSize}
+ , Buffer_{maxBufferSize}
+ {
+ ResetPtrs();
+ }
+
+ ~TImpl() noexcept {
+ try {
+ Write();
+ FlushSync(GuaranteedWrittenPtr_, WrittenPtr_);
+ } catch (...) {
+ }
+ }
+
+ void WriteData(const TLogRecord& rec) {
+ TGuard guard{Lock_};
+
+ Buffer_.Append(rec.Data, rec.Len);
+ if (Buffer_.size() >= MaxBufferSize_) {
+ const i64 prevAlignedEndPtr = PageAlignedWrittenPtr_;
+ Write();
+
+ if (prevAlignedEndPtr < PageAlignedWrittenPtr_) {
+ FlushAsync(prevAlignedEndPtr, PageAlignedWrittenPtr_);
+ }
+
+ const i64 minPendingCacheOffset = PageAlignedWrittenPtr_ - MaxPendingCacheSize_;
+ if (minPendingCacheOffset > GuaranteedWrittenPtr_) {
+ FlushSync(GuaranteedWrittenPtr_, minPendingCacheOffset);
+ }
+ }
+ }
+
+ void ReopenLog() {
+ TGuard guard{Lock_};
+
+ Write();
+ FlushSync(GuaranteedWrittenPtr_, WrittenPtr_);
+
+ File_.LinkTo(OpenFile(File_.GetName()));
+
+ ResetPtrs();
+ }
+
+private:
+ void ResetPtrs() {
+ WrittenPtr_ = File_.GetLength();
+ PageAlignedWrittenPtr_ = AlignDown(WrittenPtr_, GetPageSize());
+ GuaranteedWrittenPtr_ = WrittenPtr_;
+ }
+
+ static TFile OpenFile(const TString& path) {
+ return TFile{path, OpenAlways | WrOnly | ForAppend | Seq | NoReuse};
+ }
+
+ static i64 GetPageSize() {
+ static const i64 pageSize = NSystemInfo::GetPageSize();
+ Y_ASSUME(IsPowerOf2(pageSize));
+ return pageSize;
+ }
+
+ void Write() {
+ File_.Write(Buffer_.Data(), Buffer_.Size());
+ WrittenPtr_ += Buffer_.Size();
+ PageAlignedWrittenPtr_ = AlignDown(WrittenPtr_, GetPageSize());
+ Buffer_.Clear();
+ }
+
+ void FlushAsync(const i64 from, const i64 to) {
+ File_.FlushCache(from, to - from, /* wait = */ false);
+ }
+
+ void FlushSync(const i64 from, const i64 to) {
+ const i64 begin = AlignDown(from, GetPageSize());
+ const i64 end = AlignUp(to, GetPageSize());
+ const i64 length = end - begin;
+
+ File_.FlushCache(begin, length, /* wait = */ true);
+ File_.EvictCache(begin, length);
+
+ GuaranteedWrittenPtr_ = to;
+ }
+
+private:
+ TMutex Lock_;
+ TFile File_;
+
+ const size_t MaxBufferSize_ = 0;
+ const size_t MaxPendingCacheSize_ = 0;
+
+ TBuffer Buffer_;
+ i64 WrittenPtr_ = 0;
+ i64 PageAlignedWrittenPtr_ = 0;
+ i64 GuaranteedWrittenPtr_ = 0;
+};
+
+TSyncPageCacheFileLogBackend::TSyncPageCacheFileLogBackend(const TString& path, size_t maxBufferSize, size_t maxPengingCacheSize)
+ : Impl_(MakeHolder<TImpl>(path, maxBufferSize, maxPengingCacheSize))
+{}
+
+TSyncPageCacheFileLogBackend::~TSyncPageCacheFileLogBackend() {
+}
+
+void TSyncPageCacheFileLogBackend::WriteData(const TLogRecord& rec) {
+ Impl_->WriteData(rec);
+}
+
+void TSyncPageCacheFileLogBackend::ReopenLog() {
+ Impl_->ReopenLog();
+}
diff --git a/library/cpp/logger/sync_page_cache_file.h b/library/cpp/logger/sync_page_cache_file.h
index a909f01a64..a36340651c 100644
--- a/library/cpp/logger/sync_page_cache_file.h
+++ b/library/cpp/logger/sync_page_cache_file.h
@@ -1,19 +1,19 @@
-#pragma once
-
-#include "backend.h"
-
-#include <util/generic/fwd.h>
-#include <util/generic/ptr.h>
-
-class TSyncPageCacheFileLogBackend final: public TLogBackend {
-public:
- TSyncPageCacheFileLogBackend(const TString& path, size_t maxBufferSize, size_t maxPendingCacheSize);
- ~TSyncPageCacheFileLogBackend();
-
- void WriteData(const TLogRecord& rec) override;
- void ReopenLog() override;
-
-private:
- class TImpl;
- THolder<TImpl> Impl_;
-};
+#pragma once
+
+#include "backend.h"
+
+#include <util/generic/fwd.h>
+#include <util/generic/ptr.h>
+
+class TSyncPageCacheFileLogBackend final: public TLogBackend {
+public:
+ TSyncPageCacheFileLogBackend(const TString& path, size_t maxBufferSize, size_t maxPendingCacheSize);
+ ~TSyncPageCacheFileLogBackend();
+
+ void WriteData(const TLogRecord& rec) override;
+ void ReopenLog() override;
+
+private:
+ class TImpl;
+ THolder<TImpl> Impl_;
+};
diff --git a/library/cpp/logger/ya.make b/library/cpp/logger/ya.make
index 8c69ec0989..00a5263cba 100644
--- a/library/cpp/logger/ya.make
+++ b/library/cpp/logger/ya.make
@@ -33,7 +33,7 @@ SRCS(
GLOBAL rotating_file_creator.cpp
stream.cpp
GLOBAL stream_creator.cpp
- sync_page_cache_file.cpp
+ sync_page_cache_file.cpp
GLOBAL sync_page_cache_file_creator.cpp
system.cpp
GLOBAL system_creator.cpp
diff --git a/library/cpp/testing/benchmark/bench.h b/library/cpp/testing/benchmark/bench.h
index 96e80b038a..21551ad0dd 100644
--- a/library/cpp/testing/benchmark/bench.h
+++ b/library/cpp/testing/benchmark/bench.h
@@ -4,7 +4,7 @@
#include <util/system/types.h>
#include <utility>
-
+
namespace NBench {
namespace NCpu {
struct TParams {
@@ -47,11 +47,11 @@ namespace NBench {
:
: "memory");
}
-#elif defined(_MSC_VER)
- Y_FORCE_INLINE void Clobber() {
- _ReadWriteBarrier();
- }
-
+#elif defined(_MSC_VER)
+ Y_FORCE_INLINE void Clobber() {
+ _ReadWriteBarrier();
+ }
+
#else
Y_FORCE_INLINE void Clobber() {
}
diff --git a/library/cpp/testing/benchmark/dummy.cpp b/library/cpp/testing/benchmark/dummy.cpp
index 3c533ec52f..cdb05c19db 100644
--- a/library/cpp/testing/benchmark/dummy.cpp
+++ b/library/cpp/testing/benchmark/dummy.cpp
@@ -1,8 +1,8 @@
-#include "bench.h"
-
-namespace NBench {
- namespace NPrivate {
- void UseCharPointer(volatile const char*) {
- }
- }
-}
+#include "bench.h"
+
+namespace NBench {
+ namespace NPrivate {
+ void UseCharPointer(volatile const char*) {
+ }
+ }
+}
diff --git a/library/cpp/testing/benchmark/ya.make b/library/cpp/testing/benchmark/ya.make
index d4e6db0ee9..f42be80698 100644
--- a/library/cpp/testing/benchmark/ya.make
+++ b/library/cpp/testing/benchmark/ya.make
@@ -7,7 +7,7 @@ OWNER(
SRCS(
bench.cpp
- dummy.cpp
+ dummy.cpp
)
PEERDIR(
diff --git a/library/cpp/threading/skip_list/skiplist.h b/library/cpp/threading/skip_list/skiplist.h
index 03c6a33928..914a7c6ee7 100644
--- a/library/cpp/threading/skip_list/skiplist.h
+++ b/library/cpp/threading/skip_list/skiplist.h
@@ -78,8 +78,8 @@ namespace NThreading {
TNode* Next[]; // variable-size array maximum of MaxHeight values
public:
- TNode(T&& value)
- : Value(std::move(value))
+ TNode(T&& value)
+ : Value(std::move(value))
{
Y_UNUSED(Next);
}
@@ -192,13 +192,13 @@ namespace NThreading {
Init();
}
- bool Insert(T value) {
+ bool Insert(T value) {
TNode* node = PrepareInsert(value);
if (Y_UNLIKELY(node && Compare(node, value) == 0)) {
// we do not allow duplicates
return false;
}
- node = DoInsert(std::move(value));
+ node = DoInsert(std::move(value));
TCounter::OnInsert(node->GetValue());
return true;
}
@@ -277,11 +277,11 @@ namespace NThreading {
return static_cast<TNode*>(buffer);
}
- TNode* AllocateNode(T&& value, int height) {
+ TNode* AllocateNode(T&& value, int height) {
size_t size = sizeof(TNode) + sizeof(TNode*) * height;
void* buffer = Allocator.Allocate(size);
memset(buffer, 0, size);
- return new (buffer) TNode(std::move(value));
+ return new (buffer) TNode(std::move(value));
}
TNode* FindFirst() const {
@@ -382,7 +382,7 @@ namespace NThreading {
return next;
}
- TNode* DoInsert(T&& value) {
+ TNode* DoInsert(T&& value) {
// choose level to place new node
int currentHeight = AtomicGet(Height);
int height = RandomHeight();
@@ -394,7 +394,7 @@ namespace NThreading {
AtomicSet(Height, height);
}
- TNode* node = AllocateNode(std::move(value), height);
+ TNode* node = AllocateNode(std::move(value), height);
node->Link(height, Prev);
// keep last inserted node to optimize sequential inserts