Seastar
High performance C++ framework for concurrent servers
seastar.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/*
20 * Copyright (C) 2015 Cloudius Systems, Ltd.
21 */
22
23#pragma once
24
49
50#include <seastar/core/sstring.hh>
51#include <seastar/core/future.hh>
52#include <seastar/core/file-types.hh>
53#include <seastar/core/posix.hh>
54#include <seastar/util/bool_class.hh>
55#include <seastar/util/std-compat.hh>
56#include <seastar/util/modules.hh>
57#include "./internal/api-level.hh"
58#ifndef SEASTAR_MODULE
59#include <cstdint>
60#include <filesystem>
61#include <optional>
62#include <string_view>
63#endif
64
65namespace seastar {
66
67SEASTAR_MODULE_EXPORT_BEGIN
68
69// iostream.hh
70template <class CharType> class input_stream;
71template <class CharType> class output_stream;
72
73class server_socket;
74class socket;
75class connected_socket;
76class socket_address;
77struct listen_options;
78enum class transport;
79
80// file.hh
81class file;
82struct file_open_options;
83struct stat_data;
84
85namespace net {
86
87using udp_channel = class datagram_channel;
88
89}
90
91namespace experimental {
92// process.hh
93class process;
94struct spawn_parameters;
95}
96
97// Networking API
98
110
113
124
136
145
156
157
162
169[[deprecated("Use `make_unbound_datagram_channel` instead")]]
171
172
178[[deprecated("Use `make_bound_datagram_channel` instead")]]
180
197
207
209
222
225
238future<file> open_file_dma(std::string_view name, open_flags flags) noexcept;
239
253future<file> open_file_dma(std::string_view name, open_flags flags, file_open_options options) noexcept;
254
269future<> check_direct_io_support(std::string_view path) noexcept;
270
280future<file> open_directory(std::string_view name) noexcept;
281
290future<> make_directory(std::string_view name, file_permissions permissions = file_permissions::default_dir_permissions) noexcept;
291
304future<> touch_directory(std::string_view name, file_permissions permissions = file_permissions::default_dir_permissions) noexcept;
305
318future<> recursive_touch_directory(std::string_view name, file_permissions permissions = file_permissions::default_dir_permissions) noexcept;
319
327future<> sync_directory(std::string_view name) noexcept;
328
329
337future<> remove_file(std::string_view name) noexcept;
338
347future<> rename_file(std::string_view old_name, std::string_view new_name) noexcept;
348
351
360future<stat_data> file_stat(std::string_view name, follow_symlink fs = follow_symlink::yes) noexcept;
361
370
376future<> chown(std::string_view filepath, uid_t owner, gid_t group);
384future<uint64_t> file_size(std::string_view name) noexcept;
385
400future<bool> file_accessible(std::string_view name, access_flags flags) noexcept;
401
405future<bool> file_exists(std::string_view name) noexcept;
406
415future<std::optional<directory_entry_type>> file_type(std::string_view name, follow_symlink follow = follow_symlink::yes) noexcept;
416
417
423future<> link_file(std::string_view oldpath, std::string_view newpath) noexcept;
424
430future<> chmod(std::string_view name, file_permissions permissions) noexcept;
431
435future<fs_type> file_system_at(std::string_view name) noexcept;
436
440future<uint64_t> fs_avail(std::string_view name) noexcept;
441
445future<uint64_t> fs_free(std::string_view name) noexcept;
447
448namespace experimental {
452
455
461
471future<process> spawn_process(const std::filesystem::path& pathname,
472 spawn_parameters params);
481future<process> spawn_process(const std::filesystem::path& pathname);
483}
484
485SEASTAR_MODULE_EXPORT_END
486
487}
Type-safe boolean.
Definition: bool_class.hh:58
A representation of a possibly not-yet-computed value.
Definition: future.hh:1240
Definition: api.hh:116
A listening socket, waiting to accept incoming network connections.
Definition: api.hh:326
Definition: socket_defs.hh:47
Definition: api.hh:283
future touch_directory(std::string_view name, file_permissions permissions=file_permissions::default_dir_permissions) noexcept
future< file > open_file_dma(std::string_view name, open_flags flags, file_open_options options) noexcept
future remove_file(std::string_view name) noexcept
future rename_file(std::string_view old_name, std::string_view new_name) noexcept
future< uint64_t > fs_avail(std::string_view 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 recursive_touch_directory(std::string_view name, file_permissions permissions=file_permissions::default_dir_permissions) noexcept
future< uint64_t > fs_free(std::string_view name) noexcept
future check_direct_io_support(std::string_view path) noexcept
future< file > open_directory(std::string_view name) noexcept
future< file > open_file_dma(std::string_view name, open_flags flags) 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 sync_directory(std::string_view name) noexcept
future make_directory(std::string_view name, file_permissions permissions=file_permissions::default_dir_permissions) noexcept
future< std::tuple< file_desc, file_desc > > make_pipe()
future< process > spawn_process(const std::filesystem::path &pathname)
server_socket listen(socket_address sa)
net::udp_channel make_udp_channel()
net::datagram_channel make_unbound_datagram_channel(sa_family_t family)
socket make_socket()
future< connected_socket > connect(socket_address sa)
net::datagram_channel make_bound_datagram_channel(const socket_address &local)
::seastar::socket socket(shared_ptr< certificate_credentials >, sstring name)
Seastar API namespace.
Definition: abort_on_ebadf.hh:26
Definition: file.hh:96
Definition: api.hh:392