1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

celldb in-memory mode (--celldb-in-memory option)

This commit is contained in:
birydrad 2024-09-09 18:08:15 +02:00
parent 420029b056
commit 1723562748
48 changed files with 1966 additions and 201 deletions

View file

@ -18,6 +18,7 @@
*/
#pragma once
#include "absl/strings/internal/str_format/parser.h"
#include "td/actor/actor.h"
namespace ton {
@ -49,4 +50,29 @@ template <typename T>
void delay_action(T promise, td::Timestamp timeout) {
DelayedAction<T>::create(std::move(promise), timeout);
}
template <typename PromiseT, typename ValueT>
class AsyncApply : public td::actor::Actor {
public:
AsyncApply(PromiseT promise, ValueT value) : promise_(std::move(promise)), value_(std::move(value)){
}
void start_up() override {
promise_(std::move(value_));
stop();
}
static void create(td::Slice name, PromiseT promise, ValueT value ) {
td::actor::create_actor<AsyncApply>(PSLICE() << "async:" << name, std::move(promise), std::move(value)).release();
}
private:
PromiseT promise_;
ValueT value_;
};
template <class PromiseT, class ValueT>
void async_apply(td::Slice name, PromiseT &&promise, ValueT &&value) {
AsyncApply<PromiseT, ValueT>::create(name, std::forward<PromiseT>(promise), std::forward<ValueT>(value));
}
} // namespace ton