mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 11:10:40 +00:00
s/the_reactor/engine/g
Things named "engine" are 20% faster.
This commit is contained in:
@@ -40,7 +40,7 @@ public:
|
||||
void listen(ipv4_addr addr) {
|
||||
listen_options lo;
|
||||
lo.reuse_address = true;
|
||||
_listeners.push_back(the_reactor.listen(make_ipv4_address(addr), lo));
|
||||
_listeners.push_back(engine.listen(make_ipv4_address(addr), lo));
|
||||
do_accepts(_listeners.size() - 1);
|
||||
}
|
||||
void do_accepts(int which) {
|
||||
@@ -305,11 +305,11 @@ int main(int ac, char** av) {
|
||||
std::cout << opts << "\n";
|
||||
return 1;
|
||||
}
|
||||
the_reactor.configure(configuration);
|
||||
the_reactor.start().then([&server] {
|
||||
engine.configure(configuration);
|
||||
engine.start().then([&server] {
|
||||
server.listen({{}, 10000});
|
||||
});
|
||||
the_reactor.run();
|
||||
engine.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ file_desc readable_eventfd::try_create_eventfd(size_t initial) {
|
||||
}
|
||||
|
||||
future<size_t> readable_eventfd::wait() {
|
||||
return the_reactor.readable(*_fd._s).then([this] {
|
||||
return engine.readable(*_fd._s).then([this] {
|
||||
uint64_t count;
|
||||
int r = ::read(_fd.get_fd(), &count, sizeof(count));
|
||||
assert(r == sizeof(count));
|
||||
@@ -408,7 +408,7 @@ socket_address make_ipv4_address(ipv4_addr addr) {
|
||||
}
|
||||
|
||||
void schedule(std::unique_ptr<task> t) {
|
||||
the_reactor.add_task(std::move(t));
|
||||
engine.add_task(std::move(t));
|
||||
}
|
||||
|
||||
data_source posix_data_source(pollable_fd& fd) {
|
||||
@@ -450,7 +450,7 @@ posix_data_sink_impl::do_write(size_t idx) {
|
||||
|
||||
server_socket
|
||||
posix_network_stack::listen(socket_address sa, listen_options opt) {
|
||||
return server_socket(std::make_unique<posix_server_socket_impl>(the_reactor.posix_listen(sa, opt)));
|
||||
return server_socket(std::make_unique<posix_server_socket_impl>(engine.posix_listen(sa, opt)));
|
||||
}
|
||||
|
||||
void network_stack_registry::register_stack(sstring name,
|
||||
@@ -498,4 +498,4 @@ reactor::get_options_description() {
|
||||
|
||||
network_stack_registrator<posix_network_stack> nsr_posix{"posix", true};
|
||||
|
||||
reactor the_reactor;
|
||||
reactor engine;
|
||||
|
||||
@@ -407,11 +407,11 @@ private:
|
||||
friend class timer;
|
||||
};
|
||||
|
||||
extern reactor the_reactor;
|
||||
extern reactor engine;
|
||||
|
||||
inline
|
||||
pollable_fd_state::~pollable_fd_state() {
|
||||
the_reactor.forget(*this);
|
||||
engine.forget(*this);
|
||||
}
|
||||
|
||||
// A temporary_buffer either points inside a larger buffer, or, if the requested size
|
||||
@@ -594,24 +594,24 @@ public:
|
||||
file(file&& x) : _fd(x._fd) { x._fd = -1; }
|
||||
template <typename CharType>
|
||||
future<size_t> dma_read(uint64_t pos, CharType* buffer, size_t len) {
|
||||
return the_reactor.read_dma(*this, pos, buffer, len);
|
||||
return engine.read_dma(*this, pos, buffer, len);
|
||||
}
|
||||
|
||||
future<size_t> dma_read(uint64_t pos, std::vector<iovec> iov) {
|
||||
return the_reactor.read_dma(*this, pos, std::move(iov));
|
||||
return engine.read_dma(*this, pos, std::move(iov));
|
||||
}
|
||||
|
||||
template <typename CharType>
|
||||
future<size_t> dma_write(uint64_t pos, const CharType* buffer, size_t len) {
|
||||
return the_reactor.write_dma(*this, pos, buffer, len);
|
||||
return engine.write_dma(*this, pos, buffer, len);
|
||||
}
|
||||
|
||||
future<size_t> dma_write(uint64_t pos, std::vector<iovec> iov) {
|
||||
return the_reactor.write_dma(*this, pos, std::move(iov));
|
||||
return engine.write_dma(*this, pos, std::move(iov));
|
||||
}
|
||||
|
||||
future<> flush() {
|
||||
return the_reactor.flush(*this);
|
||||
return engine.flush(*this);
|
||||
}
|
||||
|
||||
friend class reactor;
|
||||
@@ -855,32 +855,32 @@ output_stream<CharType>::flush() {
|
||||
|
||||
inline
|
||||
future<size_t> pollable_fd::read_some(char* buffer, size_t size) {
|
||||
return the_reactor.read_some(*_s, buffer, size);
|
||||
return engine.read_some(*_s, buffer, size);
|
||||
}
|
||||
|
||||
inline
|
||||
future<size_t> pollable_fd::read_some(uint8_t* buffer, size_t size) {
|
||||
return the_reactor.read_some(*_s, buffer, size);
|
||||
return engine.read_some(*_s, buffer, size);
|
||||
}
|
||||
|
||||
inline
|
||||
future<size_t> pollable_fd::read_some(const std::vector<iovec>& iov) {
|
||||
return the_reactor.read_some(*_s, iov);
|
||||
return engine.read_some(*_s, iov);
|
||||
}
|
||||
|
||||
inline
|
||||
future<size_t> pollable_fd::write_all(const char* buffer, size_t size) {
|
||||
return the_reactor.write_all(*_s, buffer, size);
|
||||
return engine.write_all(*_s, buffer, size);
|
||||
}
|
||||
|
||||
inline
|
||||
future<size_t> pollable_fd::write_all(const uint8_t* buffer, size_t size) {
|
||||
return the_reactor.write_all(*_s, buffer, size);
|
||||
return engine.write_all(*_s, buffer, size);
|
||||
}
|
||||
|
||||
inline
|
||||
future<pollable_fd, socket_address> pollable_fd::accept() {
|
||||
return the_reactor.accept(*_s);
|
||||
return engine.accept(*_s);
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -894,7 +894,7 @@ future<> timer::expired() {
|
||||
inline
|
||||
timer::~timer() {
|
||||
if (_armed) {
|
||||
the_reactor.del_timer(this);
|
||||
engine.del_timer(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -903,7 +903,7 @@ void timer::arm(clock_type::time_point until) {
|
||||
assert(!_armed);
|
||||
_armed = true;
|
||||
_expiry = until;
|
||||
the_reactor.add_timer(this);
|
||||
engine.add_timer(this);
|
||||
}
|
||||
|
||||
inline
|
||||
@@ -915,7 +915,7 @@ inline
|
||||
void timer::suspend() {
|
||||
assert(_armed);
|
||||
_armed = false;
|
||||
the_reactor.del_timer(this);
|
||||
engine.del_timer(this);
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
@@ -14,7 +14,7 @@ struct file_test {
|
||||
|
||||
int main(int ac, char** av) {
|
||||
static constexpr auto max = 10000;
|
||||
the_reactor.open_file_dma("testfile.tmp").then([] (file f) {
|
||||
engine.open_file_dma("testfile.tmp").then([] (file f) {
|
||||
auto ft = new file_test{std::move(f)};
|
||||
for (size_t i = 0; i < max; ++i) {
|
||||
ft->par.wait().then([ft, i] {
|
||||
@@ -44,7 +44,7 @@ int main(int ac, char** av) {
|
||||
::exit(0);
|
||||
});
|
||||
});
|
||||
the_reactor.run();
|
||||
engine.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ int main(int ac, char** av) {
|
||||
netif.run();
|
||||
ipv4 inet(&netif);
|
||||
inet.set_host_address(ipv4_address(0xc0a87a02));
|
||||
the_reactor.run();
|
||||
engine.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ int main(int ac, char** av) {
|
||||
netif.run();
|
||||
l3_protocol arp(&netif, 0x0806);
|
||||
dump_arp_packets(arp);
|
||||
the_reactor.run();
|
||||
engine.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ int main(int ac, char** av) {
|
||||
ipv4 inet(&netif);
|
||||
inet.set_host_address(ipv4_address(0xc0a87a02));
|
||||
tcp_test tt(inet);
|
||||
the_reactor.start().then([&tt] { tt.run(); });
|
||||
the_reactor.run();
|
||||
engine.start().then([&tt] { tt.run(); });
|
||||
engine.run();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ int main(int ac, char** av)
|
||||
ipv4_addr addr{{}, 10000};
|
||||
listen_options lo;
|
||||
lo.reuse_address = true;
|
||||
test t(the_reactor.posix_listen(make_ipv4_address(addr), lo));
|
||||
test t(engine.posix_listen(make_ipv4_address(addr), lo));
|
||||
t.start_accept();
|
||||
the_reactor.run();
|
||||
engine.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ struct timer_test {
|
||||
|
||||
int main(int ac, char** av) {
|
||||
timer_test t;
|
||||
the_reactor.start().then([&t] { t.run(); });
|
||||
the_reactor.run();
|
||||
engine.start().then([&t] { t.run(); });
|
||||
engine.run();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ void echo_packets(net::device& netif) {
|
||||
int main(int ac, char** av) {
|
||||
auto vnet = create_virtio_net_device("tap0");
|
||||
echo_packets(*vnet);
|
||||
the_reactor.run();
|
||||
engine.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user