Files
scylladb/readers/reversing.hh
Ernest Zaslavsky d624413ddd treewide: Move query related files to a new query directory
As requested in #22120, moved the files and fixed other includes and build system.

Moved files:
- query.cc
- query-request.hh
- query-result.hh
- query-result-reader.hh
- query-result-set.cc
- query-result-set.hh
- query-result-writer.hh
- query_id.hh
- query_result_merger.hh

Fixes: #22120

This is a cleanup, no need to backport

Closes scylladb/scylladb#25105
2025-09-16 23:40:47 +03:00

48 lines
1.9 KiB
C++

/*
* Copyright (C) 2022-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#pragma once
#include <memory>
#include "query/query-request.hh"
class mutation_reader;
namespace query {
struct max_result_size;
}
/// A reader that emits partitions in native reverse order.
///
/// 1. The reader's schema() method will return a reversed schema (see
/// \ref schema::make_reversed()).
/// 2. Static row is still emitted first.
/// 3. Clustering elements are emitted in reverse order.
/// 3. Range tombstones changes' tombstones are shifted by one to the left to
/// account for the implicit null tombstone at the start of the stream moving
/// from start to end (due to reversing).
/// Ordering of partitions themselves remains unchanged.
/// For more details see docs/dev/reverse-reads.md.
///
/// The reader's schema (returned by `schema()`) is the reverse of `original`'s schema.
///
/// \param original the reader to be reversed.
/// \param max_size the maximum amount of memory the reader is allowed to use
/// for reversing and conversely the maximum size of the results. The
/// reverse reader reads entire partitions into memory, before reversing
/// them. Since partitions can be larger than the available memory, we need
/// to enforce a limit on memory consumption. When reaching the soft limit
/// a warning will be logged. When reaching the hard limit the read will be
/// aborted.
/// \param slice serves as a convenience slice storage for reads that have to
/// store an edited slice somewhere. This is common for reads that work
/// with a native-reversed slice and so have to convert the one used in the
/// query -- which is in reversed format.
mutation_reader
make_reversing_reader(mutation_reader original, query::max_result_size max_size, std::unique_ptr<query::partition_slice> slice = {});