Files
scylladb/utils/file_lock.hh
Avi Kivity f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
Drop the AGPL license in favor of a source-available license.
See the blog post [1] for details.

[1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
2024-12-18 17:45:13 +02:00

44 lines
845 B
C++

/*
* Copyright (C) 2014-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#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;
};
}