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
46 lines
892 B
C++
46 lines
892 B
C++
/*
|
|
* Copyright (C) 2014-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <ostream>
|
|
#include <filesystem>
|
|
#include <seastar/core/sstring.hh>
|
|
#include <seastar/core/future.hh>
|
|
|
|
#include "seastarx.hh"
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
namespace utils {
|
|
class file_lock {
|
|
public:
|
|
file_lock() = delete;
|
|
file_lock(const file_lock&) = delete;
|
|
file_lock(file_lock&&) noexcept;
|
|
~file_lock();
|
|
|
|
file_lock& operator=(file_lock&&) = default;
|
|
|
|
static future<file_lock> acquire(fs::path);
|
|
|
|
fs::path path() const;
|
|
sstring to_string() const {
|
|
return path().native();
|
|
}
|
|
private:
|
|
class impl;
|
|
file_lock(fs::path);
|
|
std::unique_ptr<impl> _impl;
|
|
};
|
|
|
|
std::ostream& operator<<(std::ostream& out, const file_lock& f);
|
|
}
|
|
|