
The merged table provides access to a reftable stack by merging the contents of those tables into a virtual table. These subtables are being tracked via `struct reftable_table`, which is a generic interface for accessing either a single reftable or a merged reftable. So in theory, it would be possible for the merged table to merge together other merged tables. This is somewhat nonsensical though: we only ever set up a merged table over normal reftables, and there is no reason to do otherwise. This generic interface thus makes the code way harder to follow and reason about than really necessary. The abstraction layer may also have an impact on performance, even though the extra set of vtable function calls probably doesn't really matter. Refactor the merged tables to use a `struct reftable_reader` for each of the subtables instead, which gives us direct access to the underlying tables. Adjust names accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
34 lines
691 B
C
34 lines
691 B
C
/*
|
|
Copyright 2020 Google LLC
|
|
|
|
Use of this source code is governed by a BSD-style
|
|
license that can be found in the LICENSE file or at
|
|
https://developers.google.com/open-source/licenses/bsd
|
|
*/
|
|
|
|
#ifndef MERGED_H
|
|
#define MERGED_H
|
|
|
|
#include "system.h"
|
|
|
|
struct reftable_merged_table {
|
|
struct reftable_reader **readers;
|
|
size_t readers_len;
|
|
uint32_t hash_id;
|
|
|
|
/* If unset, produce deletions. This is useful for compaction. For the
|
|
* full stack, deletions should be produced. */
|
|
int suppress_deletions;
|
|
|
|
uint64_t min;
|
|
uint64_t max;
|
|
};
|
|
|
|
struct reftable_iterator;
|
|
|
|
void merged_table_init_iter(struct reftable_merged_table *mt,
|
|
struct reftable_iterator *it,
|
|
uint8_t typ);
|
|
|
|
#endif
|