tdlight/td/telegram/logevent/LogEventHelper.h
levlam 9b42166c68 Explicitly include common.h.
GitOrigin-RevId: 5ae32c18d0ff18aac36334b494ea526ce7da4a9a
2019-02-13 00:26:36 +03:00

36 lines
926 B
C++

//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2019
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/actor/PromiseFuture.h"
#include "td/db/binlog/BinlogHelper.h"
#include "td/telegram/Global.h"
#include "td/telegram/TdDb.h"
#include "td/utils/common.h"
#include "td/utils/Status.h"
namespace td {
inline Promise<Unit> get_erase_logevent_promise(uint64 logevent_id, Promise<Unit> promise = Promise<Unit>()) {
if (logevent_id == 0) {
return promise;
}
return PromiseCreator::lambda([logevent_id, promise = std::move(promise)](Result<Unit> result) mutable {
if (!G()->close_flag()) {
binlog_erase(G()->td_db()->get_binlog(), logevent_id);
}
promise.set_result(std::move(result));
});
}
} // namespace td