mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-11 21:18:46 -05:00
We're including a couple of standard headers like <stdint.h> in a bunch
of locations, which makes it hard for a project to plug in their own
logic for making required functionality available. For us this is for
example via "compat/posix.h", which already includes all of the system
headers relevant to us.
Introduce a new "reftable-system.h" header that allows projects to
provide their own headers. This new header is supposed to contain all
the project-specific bits to provide the POSIX-like environment, and some
additional supporting code. With this change, we thus have the following
split in our system-specific code:
- "reftable/reftable-system.h" is the project-specific header that
provides a POSIX-like environment. Every project is expected to
provide their own implementation.
- "reftable/system.h" contains the project-independent definition of
the interfaces that a project needs to implement. This file should
not be touched by a project.
- "reftable/system.c" contains the project-specific implementation of
the interfaces defined in "system.h". Again, every project is
expected to provide their own implementation.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
63 lines
2.1 KiB
C
63 lines
2.1 KiB
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 REFTABLE_MERGED_H
|
|
#define REFTABLE_MERGED_H
|
|
|
|
#include "reftable-system.h"
|
|
#include "reftable-iterator.h"
|
|
|
|
/*
|
|
* Merged tables
|
|
*
|
|
* A ref database kept in a sequence of table files. The merged_table presents a
|
|
* unified view to reading (seeking, iterating) a sequence of immutable tables.
|
|
*
|
|
* The merged tables are on purpose kept disconnected from their actual storage
|
|
* (eg. files on disk), because it is useful to merge tables aren't files. For
|
|
* example, the per-workspace and global ref namespace can be implemented as a
|
|
* merged table of two stacks of file-backed reftables.
|
|
*/
|
|
|
|
/* A merged table is implements seeking/iterating over a stack of tables. */
|
|
struct reftable_merged_table;
|
|
|
|
struct reftable_table;
|
|
|
|
/*
|
|
* reftable_merged_table_new creates a new merged table. The tables must be
|
|
* kept alive as long as the merged table is still in use.
|
|
*/
|
|
int reftable_merged_table_new(struct reftable_merged_table **dest,
|
|
struct reftable_table **tables, size_t n,
|
|
enum reftable_hash hash_id);
|
|
|
|
/* Initialize a merged table iterator for reading refs. */
|
|
int reftable_merged_table_init_ref_iterator(struct reftable_merged_table *mt,
|
|
struct reftable_iterator *it);
|
|
|
|
/* Initialize a merged table iterator for reading logs. */
|
|
int reftable_merged_table_init_log_iterator(struct reftable_merged_table *mt,
|
|
struct reftable_iterator *it);
|
|
|
|
/* returns the max update_index covered by this merged table. */
|
|
uint64_t
|
|
reftable_merged_table_max_update_index(struct reftable_merged_table *mt);
|
|
|
|
/* returns the min update_index covered by this merged table. */
|
|
uint64_t
|
|
reftable_merged_table_min_update_index(struct reftable_merged_table *mt);
|
|
|
|
/* releases memory for the merged_table */
|
|
void reftable_merged_table_free(struct reftable_merged_table *m);
|
|
|
|
/* return the hash ID of the merged table. */
|
|
enum reftable_hash reftable_merged_table_hash_id(struct reftable_merged_table *m);
|
|
|
|
#endif
|