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/
60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
/*
|
|
* Copyright (C) 2017-present ScyllaDB
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <utility>
|
|
#include <functional>
|
|
#include <unordered_set>
|
|
|
|
#include <fmt/format.h>
|
|
|
|
#include <seastar/core/shared_ptr.hh>
|
|
|
|
namespace sstables {
|
|
|
|
class sstable;
|
|
|
|
};
|
|
|
|
// Customize deleter so that lw_shared_ptr can work with an incomplete sstable class
|
|
namespace seastar {
|
|
|
|
template <>
|
|
struct lw_shared_ptr_deleter<sstables::sstable> {
|
|
static void dispose(sstables::sstable* sst);
|
|
};
|
|
|
|
}
|
|
|
|
namespace sstables {
|
|
|
|
using shared_sstable = seastar::lw_shared_ptr<sstable>;
|
|
using sstable_list = std::unordered_set<shared_sstable>;
|
|
|
|
std::string to_string(const shared_sstable& sst, bool include_origin = true);
|
|
|
|
} // namespace sstables
|
|
|
|
template <>
|
|
struct fmt::formatter<sstables::shared_sstable> : fmt::formatter<string_view> {
|
|
template <typename FormatContext>
|
|
auto format(const sstables::shared_sstable& sst, FormatContext& ctx) const {
|
|
return fmt::format_to(ctx.out(), "{}", sstables::to_string(sst));
|
|
}
|
|
};
|
|
|
|
namespace std {
|
|
|
|
inline std::ostream& operator<<(std::ostream& os, const sstables::shared_sstable& sst) {
|
|
return os << fmt::format("{}", sst);
|
|
}
|
|
|
|
} // namespace std
|