Seastar
High performance C++ framework for concurrent servers
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
reactor.hh
1/*
2 * This file is open source software, licensed to you under the terms
3 * of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4 * distributed with this work for additional information regarding copyright
5 * ownership. You may not use this file except in compliance with the License.
6 *
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing,
12 * software distributed under the License is distributed on an
13 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 * KIND, either express or implied. See the License for the
15 * specific language governing permissions and limitations
16 * under the License.
17 */
18/*
19 * Copyright 2014 Cloudius Systems
20 */
21
22#pragma once
23
24#include <seastar/core/aligned_buffer.hh>
25#include <seastar/core/cacheline.hh>
26#include <seastar/core/circular_buffer.hh>
28#include <seastar/core/condition-variable.hh>
29#include <seastar/core/enum.hh>
30#include <seastar/core/file.hh>
31#include <seastar/core/future.hh>
33#include <seastar/core/internal/io_desc.hh>
34#include <seastar/core/internal/io_request.hh>
35#include <seastar/core/internal/io_sink.hh>
36#include <seastar/core/iostream.hh>
37#include <seastar/core/lowres_clock.hh>
38#include <seastar/core/make_task.hh>
39#include <seastar/core/manual_clock.hh>
40#include <seastar/core/memory.hh>
42#include <seastar/core/internal/estimated_histogram.hh>
43#include <seastar/core/posix.hh>
44#include <seastar/core/reactor_config.hh>
45#include <seastar/core/scattered_message.hh>
47#include <seastar/core/scheduling_specific.hh>
48#include <seastar/core/seastar.hh>
49#include <seastar/core/semaphore.hh>
50#include <seastar/core/shared_mutex.hh>
51#include <seastar/core/sstring.hh>
52#include <seastar/core/temporary_buffer.hh>
53#include <seastar/core/thread_cputime_clock.hh>
54#include <seastar/core/timer.hh>
55#include <seastar/core/gate.hh>
56#include <seastar/net/api.hh>
57#include <seastar/util/eclipse.hh>
58#include <seastar/util/log.hh>
59#include <seastar/util/modules.hh>
60#include <seastar/util/noncopyable_function.hh>
61#include <seastar/util/std-compat.hh>
62#include "internal/pollable_fd.hh"
63
64#ifndef SEASTAR_MODULE
65#include <boost/container/static_vector.hpp>
66#include <atomic>
67#include <cassert>
68#include <chrono>
69#include <cstring>
70#include <memory>
71#include <string_view>
72#include <unordered_map>
73#include <vector>
74#include <unistd.h>
75#include <sys/epoll.h>
76#include <sys/types.h>
77#include <sys/socket.h>
78#include <netinet/ip.h>
79
80#endif
81
82struct statfs;
83struct _Unwind_Exception;
84
85namespace seastar {
86
87using shard_id = unsigned;
88
89namespace alien {
90class instance;
91}
92SEASTAR_MODULE_EXPORT
93class reactor;
94
95}
96
97namespace std {
98
99template <>
100struct hash<::sockaddr_in> {
101 size_t operator()(::sockaddr_in a) const {
102 return a.sin_port ^ a.sin_addr.s_addr;
103 }
104};
105
106}
107
108bool operator==(const ::sockaddr_in a, const ::sockaddr_in b);
109
110namespace seastar {
111
112class thread_pool;
113class smp;
114
115class reactor_backend_selector;
116
117class reactor_backend;
118struct pollfn;
119
120namespace internal {
121
122class reactor_stall_sampler;
123class cpu_stall_detector;
124class buffer_allocator;
125class priority_class;
126class poller;
127
128size_t scheduling_group_count();
129
130void increase_thrown_exceptions_counter() noexcept;
131
132}
133
134class io_queue;
135SEASTAR_MODULE_EXPORT
136class io_intent;
137
139public:
140 virtual void complete_with(ssize_t res) final override;
141
142 virtual void complete(size_t res) noexcept = 0;
143 virtual void set_exception(std::exception_ptr eptr) noexcept = 0;
144};
145
146SEASTAR_MODULE_EXPORT
147class reactor {
148private:
149 struct task_queue;
150 using task_queue_list = circular_buffer_fixed_capacity<task_queue*, 1 << log2ceil(max_scheduling_groups())>;
151 using pollfn = seastar::pollfn;
152
153 class signal_pollfn;
154 class batch_flush_pollfn;
155 class smp_pollfn;
156 class drain_cross_cpu_freelist_pollfn;
157 class lowres_timer_pollfn;
158 class manual_timer_pollfn;
159 class epoll_pollfn;
160 class reap_kernel_completions_pollfn;
161 class kernel_submit_work_pollfn;
162 class io_queue_submission_pollfn;
163 class syscall_pollfn;
164 class execution_stage_pollfn;
165 friend class manual_clock;
166 friend class file_data_source_impl; // for fstream statistics
167 friend class internal::reactor_stall_sampler;
168 friend class preempt_io_context;
169 friend struct hrtimer_aio_completion;
170 friend class reactor_backend_epoll;
171 friend class reactor_backend_aio;
172 friend class reactor_backend_uring;
173 friend class reactor_backend_selector;
174 friend class io_queue; // for aio statistics
175 friend struct reactor_options;
176 friend class aio_storage_context;
177public:
178 using poller = internal::poller;
182
183 struct io_stats {
184 uint64_t aio_reads = 0;
185 uint64_t aio_read_bytes = 0;
186 uint64_t aio_writes = 0;
187 uint64_t aio_write_bytes = 0;
188 uint64_t aio_outsizes = 0;
189 uint64_t aio_errors = 0;
190 uint64_t fstream_reads = 0;
191 uint64_t fstream_read_bytes = 0;
192 uint64_t fstream_reads_blocked = 0;
193 uint64_t fstream_read_bytes_blocked = 0;
194 uint64_t fstream_read_aheads_discarded = 0;
195 uint64_t fstream_read_ahead_discarded_bytes = 0;
196 };
198 struct sched_stats {
202 uint64_t tasks_processed = 0;
203 };
204 friend void io_completion::complete_with(ssize_t);
205
208 alien::instance& alien() { return _alien; }
209
210private:
211 std::shared_ptr<smp> _smp;
212 alien::instance& _alien;
213 reactor_config _cfg;
214 file_desc _notify_eventfd;
215 file_desc _task_quota_timer;
216 std::unique_ptr<reactor_backend> _backend;
217 sigset_t _active_sigmask; // holds sigmask while sleeping with sig disabled
218 std::vector<pollfn*> _pollers;
219
220 static constexpr unsigned max_aio_per_queue = 128;
221 static constexpr unsigned max_queues = 8;
222 static constexpr unsigned max_aio = max_aio_per_queue * max_queues;
223
224 // Each mountpouint is controlled by its own io_queue, but ...
225 std::unordered_map<dev_t, std::unique_ptr<io_queue>> _io_queues;
226 // ... when dispatched all requests get into this single sink
227 internal::io_sink _io_sink;
228 unsigned _num_io_groups = 0;
229
230 std::vector<noncopyable_function<future<> ()>> _exit_funcs;
231 unsigned _id = 0;
232 bool _stopping = false;
233 bool _stopped = false;
234 bool _finished_running_tasks = false;
235 condition_variable _stop_requested;
236 std::optional<future<std::unique_ptr<network_stack>>> _network_stack_ready;
237 int _return = 0;
238 promise<> _start_promise;
239 semaphore _cpu_started;
240 internal::preemption_monitor _preemption_monitor{};
241 uint64_t _global_tasks_processed = 0;
242 uint64_t _polls = 0;
243 metrics::internal::time_estimated_histogram _stalls_histogram;
244 std::unique_ptr<internal::cpu_stall_detector> _cpu_stall_detector;
245
246 timer<>::set_t _timers;
247 timer<>::set_t::timer_list_t _expired_timers;
248 timer<lowres_clock>::set_t _lowres_timers;
249 timer<lowres_clock>::set_t::timer_list_t _expired_lowres_timers;
250 timer<manual_clock>::set_t _manual_timers;
251 timer<manual_clock>::set_t::timer_list_t _expired_manual_timers;
252 io_stats _io_stats;
253 uint64_t _fsyncs = 0;
254 uint64_t _cxx_exceptions = 0;
255 uint64_t _abandoned_failed_futures = 0;
256 struct task_queue {
257 explicit task_queue(unsigned id, sstring name, sstring shortname, float shares);
258 int64_t _vruntime = 0;
259 float _shares;
260 int64_t _reciprocal_shares_times_2_power_32;
261 bool _active = false;
262 uint8_t _id;
263 sched_clock::time_point _ts; // to help calculating wait/starve-times
264 sched_clock::duration _runtime = {};
265 sched_clock::duration _waittime = {};
266 sched_clock::duration _starvetime = {};
267 uint64_t _tasks_processed = 0;
268 circular_buffer<task*> _q;
269 sstring _name;
270 // the shortened version of scheduling_gruop's name, only the first 4
271 // chars are used.
272 static constexpr size_t shortname_size = 4;
273 sstring _shortname;
274 int64_t to_vruntime(sched_clock::duration runtime) const;
275 void set_shares(float shares) noexcept;
276 struct indirect_compare;
277 sched_clock::duration _time_spent_on_task_quota_violations = {};
279 void rename(sstring new_name, sstring new_shortname);
280 private:
281 void register_stats();
282 };
283
284 boost::container::static_vector<std::unique_ptr<task_queue>, max_scheduling_groups()> _task_queues;
285 internal::scheduling_group_specific_thread_local_data _scheduling_group_specific_data;
286 shared_mutex _scheduling_group_keys_mutex;
287 int64_t _last_vruntime = 0;
288 task_queue_list _active_task_queues;
289 task_queue_list _activating_task_queues;
290 task_queue* _at_destroy_tasks;
291 task* _current_task = nullptr;
301 std::unique_ptr<network_stack> _network_stack;
302 lowres_clock::time_point _lowres_next_timeout = lowres_clock::time_point::max();
303 std::optional<pollable_fd> _aio_eventfd;
304 const bool _reuseport;
305 circular_buffer<double> _loads;
306 double _load = 0;
307 // Next two fields are required to enforce the monotonicity of total_steal_time()
308 // see that method for details.
309
310 // Last measured accumulated steal time, i.e., the simple difference of accumulated
311 // awake time and consumed thread CPU time.
312 sched_clock::duration _last_true_steal{0};
313 // Accumulated steal time forced to be monotinic by rejecting any updates that would
314 // decrease it. See total_steal_time() for details.
315 sched_clock::duration _last_mono_steal{0};
316 sched_clock::duration _total_idle{0};
317 sched_clock::duration _total_sleep{0};
318 sched_clock::time_point _start_time = now();
319 output_stream<char>::batch_flush_list_t _flush_batching;
320 std::atomic<bool> _sleeping alignas(seastar::cache_line_size){0};
321 pthread_t _thread_id alignas(seastar::cache_line_size) = pthread_self();
322 std::atomic<bool> _dying{false};
323 gate _background_gate;
324
325private:
326 static std::chrono::nanoseconds calculate_poll_time();
327 static void block_notifier(int);
328 bool flush_pending_aio();
329 steady_clock_type::time_point next_pending_aio() const noexcept;
330 bool reap_kernel_completions();
331 bool flush_tcp_batches();
332 void update_lowres_clocks() noexcept;
333 bool do_expire_lowres_timers() noexcept;
334 bool do_check_lowres_timers() const noexcept;
335 void expire_manual_timers() noexcept;
336 void start_aio_eventfd_loop();
337 void stop_aio_eventfd_loop();
338
345 bool poll_once();
346 bool pure_poll_once();
347public:
349 [[deprecated("Use seastar::handle_signal(signo, handler, once); instead")]]
350 void handle_signal(int signo, noncopyable_function<void ()>&& handler);
351 void wakeup();
353 bool stopped() const noexcept { return _stopped; }
355 uint64_t polls() const noexcept { return _polls; }
356
357private:
358 class signals {
359 public:
360 signals();
361 ~signals();
362
363 bool poll_signal();
364 bool pure_poll_signal() const;
365 void handle_signal(int signo, noncopyable_function<void ()>&& handler);
366 void handle_signal_once(int signo, noncopyable_function<void ()>&& handler);
367 static void action(int signo, siginfo_t* siginfo, void* ignore);
368 static void failed_to_handle(int signo);
369 private:
370 struct signal_handler {
371 signal_handler(int signo, noncopyable_function<void ()>&& handler);
372 noncopyable_function<void ()> _handler;
373 };
374 std::atomic<uint64_t> _pending_signals;
375 std::unordered_map<int, signal_handler> _signal_handlers;
376 };
377
378 signals _signals;
379 std::unique_ptr<thread_pool> _thread_pool;
380 friend class thread_pool;
381 friend class thread_context;
382 friend class internal::cpu_stall_detector;
383
384 friend void handle_signal(int signo, noncopyable_function<void ()>&& handler, bool once);
385
386 uint64_t pending_task_count() const;
387 void run_tasks(task_queue& tq);
388 bool have_more_tasks() const;
389 bool posix_reuseport_detect();
390 void run_some_tasks();
391 void activate(task_queue& tq);
392 void insert_active_task_queue(task_queue* tq);
393 task_queue* pop_active_task_queue(sched_clock::time_point now);
394 void insert_activating_task_queues();
395 void account_runtime(task_queue& tq, sched_clock::duration runtime);
396 void allocate_scheduling_group_specific_data(scheduling_group sg, unsigned long key_id);
397 future<> rename_scheduling_group_specific_data(scheduling_group sg);
398 future<> init_scheduling_group(scheduling_group sg, sstring name, sstring shortname, float shares);
399 future<> init_new_scheduling_group_key(scheduling_group_key key, scheduling_group_key_config cfg);
401 uint64_t tasks_processed() const;
402 uint64_t min_vruntime() const;
403 void request_preemption();
404 void start_handling_signal();
405 void reset_preemption_monitor();
406 void service_highres_timer() noexcept;
407
409 do_accept(pollable_fd_state& listen_fd);
410 future<> do_connect(pollable_fd_state& pfd, socket_address& sa);
411
412 future<size_t>
413 do_read(pollable_fd_state& fd, void* buffer, size_t size);
414 future<size_t>
415 do_recvmsg(pollable_fd_state& fd, const std::vector<iovec>& iov);
417 do_read_some(pollable_fd_state& fd, internal::buffer_allocator* ba);
418
419 future<size_t>
420 do_send(pollable_fd_state& fd, const void* buffer, size_t size);
421 future<size_t>
422 do_sendmsg(pollable_fd_state& fd, net::packet& p);
423
425 do_recv_some(pollable_fd_state& fd, internal::buffer_allocator* ba);
426
427 void configure(const reactor_options& opts);
428 int do_run();
429 // Waits for all background tasks on all shards
430 static future<> drain();
431
432public:
433 explicit reactor(std::shared_ptr<smp> smp, alien::instance& alien, unsigned id, reactor_backend_selector rbs, reactor_config cfg);
434 reactor(const reactor&) = delete;
435 ~reactor();
436 void operator=(const reactor&) = delete;
437
438 static sched_clock::time_point now() noexcept {
439 return sched_clock::now();
440 }
441 sched_clock::duration uptime() {
442 return now() - _start_time;
443 }
444
445 io_queue& get_io_queue(dev_t devid = 0) {
446 auto queue = _io_queues.find(devid);
447 if (queue == _io_queues.end()) {
448 return *_io_queues.at(0);
449 } else {
450 return *(queue->second);
451 }
452 }
453
455 future<> update_bandwidth_for_queues(internal::priority_class pc, uint64_t bandwidth);
457 void rename_queues(internal::priority_class pc, sstring new_name);
459 void update_shares_for_queues(internal::priority_class pc, uint32_t shares);
460
461 server_socket listen(socket_address sa, listen_options opts = {});
462
463 future<connected_socket> connect(socket_address sa);
464 future<connected_socket> connect(socket_address, socket_address, transport proto = transport::TCP);
465
466 pollable_fd posix_listen(socket_address sa, listen_options opts = {});
467
468 bool posix_reuseport_available() const { return _reuseport; }
469
470 pollable_fd make_pollable_fd(socket_address sa, int proto);
471
472 future<> posix_connect(pollable_fd pfd, socket_address sa, socket_address local);
473
474 future<> send_all(pollable_fd_state& fd, const void* buffer, size_t size);
475
476 future<file> open_file_dma(std::string_view name, open_flags flags, file_open_options options = {}) noexcept;
477 future<file> open_directory(std::string_view name) noexcept;
478 future<> make_directory(std::string_view name, file_permissions permissions = file_permissions::default_dir_permissions) noexcept;
479 future<> touch_directory(std::string_view name, file_permissions permissions = file_permissions::default_dir_permissions) noexcept;
480 future<std::optional<directory_entry_type>> file_type(std::string_view name, follow_symlink = follow_symlink::yes) noexcept;
481 future<stat_data> file_stat(std::string_view pathname, follow_symlink) noexcept;
482 future<> chown(std::string_view filepath, uid_t owner, gid_t group);
483 future<std::optional<struct group_details>> getgrnam(std::string_view name);
484 future<uint64_t> file_size(std::string_view pathname) noexcept;
485 future<bool> file_accessible(std::string_view pathname, access_flags flags) noexcept;
486 future<bool> file_exists(std::string_view pathname) noexcept {
487 return file_accessible(pathname, access_flags::exists);
488 }
489 future<fs_type> file_system_at(std::string_view pathname) noexcept;
490 future<std::filesystem::space_info> file_system_space(std::string_view pathname) noexcept;
491 future<struct statvfs> statvfs(std::string_view pathname) noexcept;
492 future<> remove_file(std::string_view pathname) noexcept;
493 future<> rename_file(std::string_view old_pathname, std::string_view new_pathname) noexcept;
494 future<> link_file(std::string_view oldpath, std::string_view newpath) noexcept;
495 future<> chmod(std::string_view name, file_permissions permissions) noexcept;
496
497 future<size_t> read_directory(int fd, char* buffer, size_t buffer_size);
498
499 future<int> inotify_add_watch(int fd, std::string_view path, uint32_t flags);
500
501 future<std::tuple<file_desc, file_desc>> make_pipe();
502 future<std::tuple<pid_t, file_desc, file_desc, file_desc>>
503 spawn(std::string_view pathname,
504 std::vector<sstring> argv,
505 std::vector<sstring> env = {});
506 future<int> waitpid(pid_t pid);
507 void kill(pid_t pid, int sig);
508
509 int run() noexcept;
510 void exit(int ret);
511 future<> when_started() { return _start_promise.get_future(); }
512 // The function waits for timeout period for reactor stop notification
513 // which happens on termination signals or call for exit().
514 template <typename Rep, typename Period>
515 future<> wait_for_stop(std::chrono::duration<Rep, Period> timeout) {
516 return _stop_requested.wait(timeout, [this] { return _stopping; });
517 }
518
519 void at_exit(noncopyable_function<future<> ()> func);
520
521 template <typename Func>
522 void at_destroy(Func&& func) {
523 _at_destroy_tasks->_q.push_back(make_task(default_scheduling_group(), std::forward<Func>(func)));
524 }
525
526 task* current_task() const { return _current_task; }
527 // If a task wants to resume a different task instead of returning control to the reactor,
528 // it should set _current_task to the resumed task.
529 // In particular, this is mandatory if the task is going to die before control is returned
530 // to the reactor -- otherwise _current_task will be left dangling.
531 void set_current_task(task* t) { _current_task = t; }
532
533 void add_task(task* t) noexcept;
534 void add_urgent_task(task* t) noexcept;
535
536 void run_in_background(future<> f);
537
538 template <typename Func>
539 void run_in_background(Func&& func) {
540 run_in_background(futurize_invoke(std::forward<Func>(func)));
541 }
542
552 _idle_cpu_handler = std::move(handler);
553 }
554 void force_poll();
555
556 void add_high_priority_task(task*) noexcept;
557
558 network_stack& net() { return *_network_stack; }
559
560 [[deprecated("Use this_shard_id")]]
561 shard_id cpu_id() const;
562
563 void try_sleep();
564
565 steady_clock_type::duration total_idle_time();
566 steady_clock_type::duration total_busy_time();
567 steady_clock_type::duration total_awake_time() const;
568 std::chrono::nanoseconds total_cpu_time() const;
569 std::chrono::nanoseconds total_steal_time();
570
571 const io_stats& get_io_stats() const { return _io_stats; }
578 uint64_t abandoned_failed_futures() const { return _abandoned_failed_futures; }
579private:
588 void register_poller(pollfn* p);
589 void unregister_poller(pollfn* p);
590 void replace_poller(pollfn* old, pollfn* neww);
591 void register_metrics();
592 future<> send_all_part(pollable_fd_state& fd, const void* buffer, size_t size, size_t completed);
593
594 future<> fdatasync(int fd) noexcept;
595
596 void add_timer(timer<steady_clock_type>*) noexcept;
597 bool queue_timer(timer<steady_clock_type>*) noexcept;
598 void del_timer(timer<steady_clock_type>*) noexcept;
599 void add_timer(timer<lowres_clock>*) noexcept;
600 bool queue_timer(timer<lowres_clock>*) noexcept;
601 void del_timer(timer<lowres_clock>*) noexcept;
602 void add_timer(timer<manual_clock>*) noexcept;
603 bool queue_timer(timer<manual_clock>*) noexcept;
604 void del_timer(timer<manual_clock>*) noexcept;
605
606 future<> run_exit_tasks();
607 void stop();
608 friend class pollable_fd;
609 friend class pollable_fd_state;
610 friend class posix_file_impl;
611 friend class blockdev_file_impl;
612 friend class timer<>;
613 friend class timer<lowres_clock>;
614 friend class timer<manual_clock>;
615 friend class smp;
616 friend class internal::poller;
617 friend class scheduling_group;
618 friend void internal::add_to_flush_poller(output_stream<char>& os) noexcept;
619 friend void seastar::internal::increase_thrown_exceptions_counter() noexcept;
620 friend void report_failed_future(const std::exception_ptr& eptr) noexcept;
621 metrics::metric_groups _metric_groups;
622 friend future<scheduling_group> create_scheduling_group(sstring name, sstring shortname, float shares) noexcept;
624 friend future<> seastar::rename_scheduling_group(scheduling_group sg, sstring new_name, sstring new_shortname) noexcept;
626 friend seastar::internal::log_buf::inserter_iterator do_dump_task_queue(seastar::internal::log_buf::inserter_iterator it, const task_queue& tq);
627
628 future<struct statfs> fstatfs(int fd) noexcept;
629 friend future<shared_ptr<file_impl>> make_file_impl(int fd, file_open_options options, int flags, struct stat st) noexcept;
630public:
631 future<> readable(pollable_fd_state& fd);
632 future<> writeable(pollable_fd_state& fd);
633 future<> readable_or_writeable(pollable_fd_state& fd);
634 future<> poll_rdhup(pollable_fd_state& fd);
635 void enable_timer(steady_clock_type::time_point when) noexcept;
645 void set_strict_dma(bool value);
646 void set_bypass_fsync(bool value);
647 void update_blocked_reactor_notify_ms(std::chrono::milliseconds ms);
648 std::chrono::milliseconds get_blocked_reactor_notify_ms() const;
649
650 class test {
651 public:
652 static void with_allow_abandoned_failed_futures(unsigned count, noncopyable_function<void ()> func);
653
657 static void set_stall_detector_report_function(std::function<void ()> report);
658 static std::function<void ()> get_stall_detector_report_function();
659 };
660};
661
662extern __thread reactor* local_engine;
663extern __thread size_t task_quota;
664
665SEASTAR_MODULE_EXPORT
666inline reactor& engine() {
667 return *local_engine;
668}
669
670SEASTAR_MODULE_EXPORT
671inline bool engine_is_ready() {
672 return local_engine != nullptr;
673}
674
675inline int hrtimer_signal() {
676 // We don't want to use SIGALRM, because the boost unit test library
677 // also plays with it.
678 return SIGRTMIN;
679}
680
681
682extern logger seastar_logger;
683
684}
Definition: alien.hh:119
Definition: circular_buffer_fixed_capacity.hh:53
Conditional variable.
Definition: condition-variable.hh:73
future wait() noexcept
Definition: condition-variable.hh:214
Definition: posix.hh:85
Definition: file.hh:127
A representation of a possibly not-yet-computed value.
Definition: future.hh:1219
Definition: reactor.hh:138
Definition: io_queue.hh:77
Definition: io_desc.hh:28
Low-resolution and efficient steady clock.
Definition: lowres_clock.hh:56
Definition: manual_clock.hh:35
holds the metric definition.
Definition: metrics_registration.hh:94
Definition: api.hh:447
Definition: pollable_fd.hh:62
Definition: pollable_fd.hh:136
Definition: reactor.hh:650
static void set_stall_detector_report_function(std::function< void()> report)
Definition: reactor.hh:147
sched_stats get_sched_stats() const
friend void handle_signal(int signo, noncopyable_function< void()> &&handler, bool once)
Sets a signal handler for the specified signal.
void set_idle_cpu_handler(idle_cpu_handler &&handler)
Definition: reactor.hh:551
alien::instance & alien()
Definition: reactor.hh:208
Definition: reactor.hh:183
Scheduling statistics.
Definition: reactor.hh:198
Definition: scheduling.hh:183
Identifies function calls that are accounted as a group.
Definition: scheduling.hh:285
Definition: shared_ptr.hh:507
Definition: smp.hh:314
Definition: socket_defs.hh:47
Definition: task.hh:34
Definition: temporary_buffer.hh:67
Definition: timer.hh:83
future touch_directory(std::string_view name, file_permissions permissions=file_permissions::default_dir_permissions) noexcept
future remove_file(std::string_view name) noexcept
future rename_file(std::string_view old_name, std::string_view new_name) noexcept
future chmod(std::string_view name, file_permissions permissions) noexcept
future< uint64_t > file_size(std::string_view name) noexcept
future< std::optional< struct group_details > > getgrnam(std::string_view name)
future< bool > file_exists(std::string_view name) noexcept
future< fs_type > file_system_at(std::string_view name) noexcept
future< bool > file_accessible(std::string_view name, access_flags flags) noexcept
future link_file(std::string_view oldpath, std::string_view newpath) noexcept
future chown(std::string_view filepath, uid_t owner, gid_t group)
future< std::optional< directory_entry_type > > file_type(std::string_view name, follow_symlink follow=follow_symlink::yes) noexcept
open_flags
Definition: file-types.hh:41
future< stat_data > file_stat(std::string_view name, follow_symlink fs=follow_symlink::yes) noexcept
future make_directory(std::string_view name, file_permissions permissions=file_permissions::default_dir_permissions) noexcept
future< T > get_future() noexcept
Gets the promise's associated future.
Definition: future.hh:1905
future now()
Returns a ready future.
Definition: later.hh:35
future< std::tuple< file_desc, file_desc > > make_pipe()
server_socket listen(socket_address sa)
future< connected_socket > connect(socket_address sa)
holds the metric_groups definition needed by class that reports metrics
future configure(const options &opts)
set the metrics configuration
Seastar API namespace.
Definition: abort_on_ebadf.hh:26
const noncopyable_function< bool()> & work_waiting_on_reactor
Definition: idle_cpu_handler.hh:46
void handle_signal(int signo, noncopyable_function< void()> &&handler, bool once=false)
Sets a signal handler for the specified signal.
future destroy_scheduling_group(scheduling_group sg) noexcept
future rename_scheduling_group(scheduling_group sg, sstring new_name) noexcept
idle_cpu_handler_result
Definition: idle_cpu_handler.hh:37
@ no_more_work
The user callback has no more work to perform.
future< std::filesystem::space_info > file_system_space(std::string_view name) noexcept
noncopyable_function< idle_cpu_handler_result(work_waiting_on_reactor poll)> idle_cpu_handler
Definition: idle_cpu_handler.hh:52
future< scheduling_group > create_scheduling_group(sstring name, float shares) noexcept
future< scheduling_group_key > scheduling_group_key_create(scheduling_group_key_config cfg) noexcept
Definition: noncopyable_function.hh:37
STL namespace.
Definition: file.hh:96
Definition: poll.hh:26
Configuration for the reactor.
Definition: reactor_config.hh:53
Definition: scheduling.hh:143