Files
scylladb/utils/file_lock.hh
Kefu Chai 7215d4bfe9 utils: do not include unused headers
these unused includes were identifier by clang-include-cleaner. after
auditing these source files, all of the reports have been confirmed.

please note, because quite a few source files relied on
`utils/to_string.hh` to pull in the specialization of
`fmt::formatter<std::optional<T>>`, after removing
`#include <fmt/std.h>` from `utils/to_string.hh`, we have to
include `fmt/std.h` directly.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2025-01-14 07:56:39 -05:00

43 lines
826 B
C++

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