Browse Source

Restoring authorship annotation for <sskvor@yandex-team.ru>. Commit 2 of 2.

sskvor 3 years ago
parent
commit
10ade5dcb9

+ 1 - 1
build/ya.conf.json

@@ -7887,7 +7887,7 @@
         },
         "cs": {
             "formula": {
-                "sandbox_id": 1206856496, 
+                "sandbox_id": 1206856496,
                 "match": "cs"
             },
             "executable": {

+ 2 - 2
contrib/libs/hyperscan/src/rose/rose_graph.h

@@ -112,7 +112,7 @@ struct LeftEngInfo {
     }
     size_t hash() const;
     void reset(void);
-    explicit operator bool() const; 
+    explicit operator bool() const;
     bool tracksSom() const { return !!haig; }
 };
 
@@ -133,7 +133,7 @@ struct RoseSuffixInfo {
     bool operator<(const RoseSuffixInfo &b) const;
     size_t hash() const;
     void reset(void);
-    explicit operator bool() const { return graph || castle || haig || rdfa || tamarama; } 
+    explicit operator bool() const { return graph || castle || haig || rdfa || tamarama; }
 };
 
 /** \brief Properties attached to each Rose graph vertex. */

+ 1 - 1
contrib/libs/hyperscan/src/util/ue2_graph.h

@@ -176,7 +176,7 @@ public:
     vertex_descriptor() : p(nullptr), serial(0) {}
     explicit vertex_descriptor(vertex_node *pp) : p(pp), serial(pp->serial) {}
 
-    explicit operator bool() const { return p; } 
+    explicit operator bool() const { return p; }
     bool operator<(const vertex_descriptor b) const {
         if (p && b.p) {
             /* no vertices in the same graph can have the same serial */

+ 4 - 4
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

+ 11 - 11
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))
 {
 }
 

+ 1 - 1
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();
 

+ 8 - 8
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)

+ 1 - 1
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"

+ 125 - 125
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();
+}

+ 19 - 19
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_;
+};

Some files were not shown because too many files changed in this diff