Instead of lengthy blurbs, switch to single-line, machine-readable standardized (https://spdx.dev) license identifiers. The Linux kernel switched long ago, so there is strong precedent. Three cases are handled: AGPL-only, Apache-only, and dual licensed. For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0), reasoning that our changes are extensive enough to apply our license. The changes we applied mechanically with a script, except to licenses/README.md. Closes #9937
41 lines
956 B
C++
41 lines
956 B
C++
/*
|
|
* Copyright 2016-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <seastar/core/sstring.hh>
|
|
#include <seastar/core/on_internal_error.hh>
|
|
|
|
#include <functional>
|
|
#include <system_error>
|
|
|
|
namespace seastar { class logger; }
|
|
|
|
typedef std::function<bool (const std::system_error &)> system_error_lambda_t;
|
|
|
|
bool check_exception(system_error_lambda_t f);
|
|
bool is_system_error_errno(int err_no);
|
|
bool is_timeout_exception(std::exception_ptr e);
|
|
|
|
class storage_io_error : public std::exception {
|
|
private:
|
|
std::error_code _code;
|
|
std::string _what;
|
|
public:
|
|
storage_io_error(std::system_error& e) noexcept
|
|
: _code{e.code()}
|
|
, _what{std::string("Storage I/O error: ") + std::to_string(e.code().value()) + ": " + e.what()}
|
|
{ }
|
|
|
|
virtual const char* what() const noexcept override {
|
|
return _what.c_str();
|
|
}
|
|
|
|
const std::error_code& code() const { return _code; }
|
|
};
|