Minor improvements.

GitOrigin-RevId: b4e5073248377d84cb8acdf4a032970ec5cf5df9
This commit is contained in:
levlam 2020-07-14 20:54:38 +03:00
parent d701e17cc6
commit 060c01ace3
6 changed files with 15 additions and 15 deletions

View File

@ -114,7 +114,7 @@ class BinlogKeyValue : public KeyValueSyncInterface {
void close() {
*this = BinlogKeyValue();
}
void close(td::Promise<> promise) override {
void close(Promise<> promise) override {
binlog_->close(std::move(promise));
}

View File

@ -234,7 +234,7 @@ class TQueueImpl : public TQueue {
return do_get(queue_id, q, q.events.front().event_id, true, Time::now(), span);
}
void close(td::Promise<> promise) override {
void close(Promise<> promise) override {
callback_->close(std::move(promise));
callback_ = nullptr;
}
@ -442,7 +442,7 @@ Status TQueueBinlog<BinlogT>::replay(const BinlogEvent &binlog_event, TQueue &q)
}
template <class BinlogT>
void TQueueBinlog<BinlogT>::close(td::Promise<> promise) {
void TQueueBinlog<BinlogT>::close(Promise<> promise) {
binlog_->close(std::move(promise));
}
@ -467,7 +467,7 @@ void TQueueMemoryStorage::replay(TQueue &q) const {
CHECK(is_added);
}
}
void TQueueMemoryStorage::close(td::Promise<> promise) {
void TQueueMemoryStorage::close(Promise<> promise) {
promise.set_value({});
}

View File

@ -6,14 +6,14 @@
//
#pragma once
#include "td/actor/PromiseFuture.h"
#include "td/utils/common.h"
#include "td/utils/Slice.h"
#include "td/utils/Span.h"
#include "td/utils/Status.h"
#include "td/utils/StringBuilder.h"
#include "td/actor/PromiseFuture.h"
#include <map>
#include <memory>
#include <utility>
@ -83,7 +83,7 @@ class TQueue {
virtual uint64 push(QueueId queue_id, const RawEvent &event) = 0;
virtual void pop(uint64 logevent_id) = 0;
virtual void close(td::Promise<> promise) = 0;
virtual void close(Promise<> promise) = 0;
};
static unique_ptr<TQueue> create();
@ -114,7 +114,7 @@ class TQueue {
virtual size_t get_size(QueueId queue_id) = 0;
virtual void run_gc(double now) = 0;
virtual void close(td::Promise<> promise) = 0;
virtual void close(Promise<> promise) = 0;
};
StringBuilder &operator<<(StringBuilder &string_builder, const TQueue::EventId id);
@ -133,7 +133,7 @@ class TQueueBinlog : public TQueue::StorageCallback {
void set_binlog(std::shared_ptr<BinlogT> binlog) {
binlog_ = std::move(binlog);
}
virtual void close(td::Promise<> promise) override;
virtual void close(Promise<> promise) override;
private:
std::shared_ptr<BinlogT> binlog_;
@ -146,7 +146,7 @@ class TQueueMemoryStorage : public TQueue::StorageCallback {
uint64 push(QueueId queue_id, const RawEvent &event) override;
void pop(uint64 logevent_id) override;
void replay(TQueue &q) const;
virtual void close(td::Promise<> promise) override;
virtual void close(Promise<> promise) override;
private:
uint64 next_logevent_id_{1};

View File

@ -293,7 +293,7 @@ Status Binlog::close(bool need_sync) {
return Status::OK();
}
void Binlog::close(td::Promise<> promise) {
void Binlog::close(Promise<> promise) {
TRY_STATUS_PROMISE(promise, close());
promise.set_value({});
}

View File

@ -9,6 +9,8 @@
#include "td/db/binlog/BinlogEvent.h"
#include "td/db/DbKey.h"
#include "td/actor/PromiseFuture.h"
#include "td/utils/AesCtrByteFlow.h"
#include "td/utils/buffer.h"
#include "td/utils/BufferedFd.h"
@ -21,8 +23,6 @@
#include "td/utils/StorerBase.h"
#include "td/utils/UInt.h"
#include "td/actor/PromiseFuture.h"
#include <functional>
namespace td {
@ -105,7 +105,7 @@ class Binlog {
void change_key(DbKey new_db_key);
Status close(bool need_sync = true) TD_WARN_UNUSED_RESULT;
void close(td::Promise<>);
void close(Promise<> promise);
Status close_and_destroy() TD_WARN_UNUSED_RESULT;
static Status destroy(Slice path) TD_WARN_UNUSED_RESULT;

View File

@ -529,7 +529,7 @@ void IPAddress::clear_ipv6_interface() {
auto *begin = ipv6_addr_.sin6_addr.s6_addr;
static_assert(sizeof(ipv6_addr_.sin6_addr.s6_addr) == 16, "expected 16 bytes buffer for ipv6");
static_assert(sizeof(*begin) == 1, "expected array of bytes");
std::fill(begin + 8, begin + 16, 0);
std::memset(begin + 8, 0, 8 * sizeof(*begin));
}
string IPAddress::ipv4_to_str(uint32 ipv4) {