Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: v0.4.1
_commit: v0.4.2a6
_src_path: gh:deeplex/copier-cpp
email: [email protected]
full_name: Henrik Gaßmann
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"toolsToInstall": "copier,pipenv"
}
},
"postCreateCommand": "cd ${containerWorkspaceFolder}/docs && pipenv sync --dev",
"postCreateCommand": "cd '${containerWorkspaceFolder}' && mkdir -p build && ln -s -f x64-linux-clang/compile_commands.json ./build/compile_commands.json && cd ./docs && pipenv sync --dev",
}
14 changes: 7 additions & 7 deletions .github/workflows/cpp-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-2022]
os: [ubuntu-24.04, windows-2025]
compiler: [gcc, clang, msvc]
exclude:
- os: ubuntu-24.04
compiler: msvc
- os: windows-2022
- os: windows-2025
compiler: gcc
include:
- os: macos-13
- os: macos-15-intel
compiler: gcc
triplet: x64-macos
install: |
Expand All @@ -45,8 +45,8 @@ jobs:
sudo cp tools/llvm-snapshot.gpg.key.asc /etc/apt/trusted.gpg.d/llvm-snapshot.asc
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main"
sudo apt-get -qq update
sudo apt-get -qq install clang-19 nasm
- os: windows-2022
sudo apt-get -qq -y install clang-19 nasm
- os: windows-2025
triplet: x64-windows

permissions:
Expand All @@ -56,7 +56,7 @@ jobs:
CTEST_OUTPUT_ON_FAILURE: "1"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Install go (boringSSL build dependency)
uses: actions/setup-go@v4
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
actions: read

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Install go (boringSSL build dependency)
uses: actions/setup-go@v4
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
name: Build docs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: "3.11"
python-version: "3.12"
cache: 'pipenv'
cache-dependency-path: docs/Pipfile.lock

Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# http://creativecommons.org/publicdomain/zero/1.0/
#
########################################################################
cmake_minimum_required(VERSION 3.23...4.0)
cmake_minimum_required(VERSION 3.25)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/tools/cmake/")

########################################################################
Expand Down Expand Up @@ -62,7 +62,7 @@ find_package(base64 CONFIG REQUIRED)

find_package(fmt CONFIG REQUIRED)

find_package(unofficial-concurrentqueue CONFIG REQUIRED)
find_package(concurrentqueue CONFIG REQUIRED)

find_package(libb2-reforged REQUIRED CONFIG)

Expand Down Expand Up @@ -157,7 +157,7 @@ target_link_libraries(vefs
fmt::fmt
llfio::${VEFS_LLFIO_TARGET}
outcome::hl
unofficial::concurrentqueue::concurrentqueue
concurrentqueue::concurrentqueue
libcuckoo::libcuckoo
stduuid
)
Expand Down
10 changes: 5 additions & 5 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,18 @@
}
},
{
"name": "x64-linux-gcc-12",
"name": "x64-linux-gcc-14",
"inherits": [
"x64-linux-gcc"
],
"cacheVariables": {
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-gcc-12.cmake"
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-gcc-14.cmake"
}
},
{
"name": "x64-linux-gcc-ci",
"inherits": [
"x64-linux-gcc-12"
"x64-linux-gcc-14"
]
},
{
Expand Down Expand Up @@ -233,8 +233,8 @@
"base"
],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-macos-gcc-14",
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-macos-gcc-14.cmake"
"VCPKG_TARGET_TRIPLET": "x64-macos-gcc-15",
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-macos-gcc-15.cmake"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
Expand Down
172 changes: 25 additions & 147 deletions apps/vefs/cli/error.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#pragma once

#include <dplx/cncr/data_defined_status_domain.hpp>
#include <dplx/predef/compiler.h>

#include <status-code/status_code.hpp>

#include <vefs/disappointment.hpp>
#include <vefs/disappointment/fwd.hpp>

#if defined(DPLX_COMP_GNUC_AVAILABLE)
#pragma GCC diagnostic push
Expand Down Expand Up @@ -44,159 +48,33 @@ enum class cli_errc : error_code
wrong_password,
};

class cli_domain_type;
using cli_code = system_error::status_code<cli_domain_type>;
using cli_error = system_error::status_error<cli_domain_type>;
} // namespace vefs::cli

class cli_domain_type : public system_error::status_code_domain
template <>
struct dplx::cncr::status_enum_definition<vefs::cli::cli_errc>
: status_enum_definition_defaults<vefs::cli::cli_errc>
{
using base = system_error::status_code_domain;
template <class DomainType>
friend class system_error::status_code;

public:
static constexpr std::string_view uuid
= "F62C53F1-F5AC-4732-B3E3-16FC715A89FD";

constexpr ~cli_domain_type() noexcept = default;
constexpr cli_domain_type() noexcept
: base(uuid.data(), base::_uuid_size<uuid.size()>{})
{
}
constexpr cli_domain_type(cli_domain_type const &) noexcept = default;
constexpr auto operator=(cli_domain_type const &) noexcept
-> cli_domain_type & = default;

using value_type = cli_errc;
using base::string_ref;

constexpr virtual auto name() const noexcept -> string_ref override
{
return string_ref("cli-domain");
}
constexpr virtual auto payload_info() const noexcept
-> payload_info_t override
{
return {sizeof(value_type),
sizeof(value_type) + sizeof(cli_domain_type *),
std::max(alignof(value_type), alignof(cli_domain_type *))};
}

static constexpr auto get() noexcept -> cli_domain_type const &;

protected:
constexpr virtual auto
_do_failure(system_error::status_code<void> const &code) const noexcept
-> bool override
{
(void)code;
return true;
}

constexpr auto map_to_generic(value_type const value) const noexcept
-> system_error::errc
{
using enum cli_errc;
using sys_errc = system_error::errc;
switch (value)
{
case exit_error:
return sys_errc::unknown;
case bad_key_size:
case bad_base64_payload:
case malformed_mdc_key_box:
return sys_errc::invalid_argument;
case unsupported_mdc_key_type:
return sys_errc::function_not_supported;
case wrong_password:
return sys_errc::unknown;

default:
return sys_errc::unknown;
}
}

constexpr auto map_to_message(value_type const value) const noexcept
-> std::string_view
{
using enum cli_errc;
using namespace std::string_view_literals;

switch (value)
{
case exit_error:
return "Terminate the program with return value 1 now."sv;
case bad_key_size:
return "The storage key used to encrypt the archive must be exactly 32 bytes."sv;
case bad_base64_payload:
return "Failed to decode a base64 payload"sv;
case malformed_mdc_key_box:
return "The mdc key box couldn't be parsed."sv;
case unsupported_mdc_key_type:
return "The mdc key type is not supported.";
case wrong_password:
return "The supplied password cannot be used to open the box.";

default:
return "unknown vefs cli error code"sv;
}
}

constexpr virtual auto
_do_equivalent(system_error::status_code<void> const &lhs,
system_error::status_code<void> const &rhs) const noexcept
-> bool override
{
auto const &alhs = static_cast<cli_code const &>(lhs);
if (rhs.domain() == *this)
{
return alhs.value() == static_cast<cli_code const &>(rhs).value();
}
else if (rhs.domain() == system_error::generic_code_domain)
{
system_error::errc sysErrc
= static_cast<system_error::generic_code const &>(rhs)
.value();

return system_error::errc::unknown != sysErrc
&& map_to_generic(alhs.value()) == sysErrc;
}
return false;
}
constexpr virtual auto
_generic_code(system_error::status_code<void> const &code) const noexcept
-> system_error::generic_code override
{
return map_to_generic(static_cast<cli_code const &>(code).value());
}

constexpr virtual auto
_do_message(system_error::status_code<void> const &code) const noexcept
-> string_ref override
{
auto const archiveCode = static_cast<cli_code const &>(code);
auto const message = map_to_message(archiveCode.value());
return string_ref(message.data(), message.size());
}

SYSTEM_ERROR2_NORETURN virtual void _do_throw_exception(
system_error::status_code<void> const &code) const override
{
throw system_error::status_error<cli_domain_type>(
static_cast<cli_code const &>(code).clone());
}
static constexpr char domain_id[]
= "{F62C53F1-F5AC-4732-B3E3-16FC715A89FD}";
static constexpr char domain_name[] = "vefs-cli-domain";

static constexpr value_descriptor values[] = {
// clang-format off
{ code::exit_error, generic_errc::unknown, "Terminate the program with return value 1 now." },
{ code::bad_key_size, generic_errc::invalid_argument, "The storage key used to encrypt the archive must be exactly 32 bytes." },
{ code::bad_base64_payload, generic_errc::invalid_argument, "Failed to decode a base64 payload." },
{ code::malformed_mdc_key_box, generic_errc::invalid_argument, "The mdc key box couldn't be parsed." },
{ code::unsupported_mdc_key_type, generic_errc::function_not_supported, "The mdc key type is not supported." },
{ code::wrong_password, generic_errc::unknown, "The supplied password cannot be used to open the box." },
// clang-format on
};
};
inline constexpr cli_domain_type cli_domain{};

constexpr auto cli_domain_type::get() noexcept -> cli_domain_type const &
namespace vefs::cli
{
return cli_domain;
}

constexpr auto make_status_code(cli_errc c) noexcept -> cli_code
{
return cli_code{system_error::in_place, c};
}
using cli_code = dplx::cncr::data_defined_status_code<cli_errc>;
using cli_error = system_error::status_error<cli_code::domain_type>;

namespace
{
Expand Down
4 changes: 2 additions & 2 deletions docs/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ verify_ssl = true
name = "pypi"

[packages]
sphinx = "~=7.0"
sphinx = "~=8.2.3"
sphinx-copybutton = "~=0.5.2"
sphinx-multiversion = "~=0.2.4"
furo = "==2023.5.20"
furo = "==2025.9.25"

[dev-packages]
esbonio = "*"
Expand Down
Loading
Loading