git/pack-revindex.c

#define USE_THE_REPOSITORY_VARIABLE

#include "git-compat-util.h"
#include "gettext.h"
#include "pack-revindex.h"
#include "object-file.h"
#include "object-store-ll.h"
#include "packfile.h"
#include "strbuf.h"
#include "trace2.h"
#include "parse.h"
#include "midx.h"
#include "csum-file.h"

struct revindex_entry {};

/*
 * Pack index for existing packs give us easy access to the offsets into
 * corresponding pack file where each object's data starts, but the entries
 * do not store the size of the compressed representation (uncompressed
 * size is easily available by examining the pack entry header).  It is
 * also rather expensive to find the sha1 for an object given its offset.
 *
 * The pack index file is sorted by object name mapping to offset;
 * this revindex array is a list of offset/index_nr pairs
 * ordered by offset, so if you know the offset of an object, next offset
 * is where its packed representation ends and the index_nr can be used to
 * get the object sha1 from the main index.
 */

/*
 * This is a least-significant-digit radix sort.
 *
 * It sorts each of the "n" items in "entries" by its offset field. The "max"
 * parameter must be at least as large as the largest offset in the array,
 * and lets us quit the sort early.
 */
static void sort_revindex(struct revindex_entry *entries, unsigned n, off_t max)
{}

/*
 * Ordered list of offsets of objects in the pack.
 */
static void create_pack_revindex(struct packed_git *p)
{}

static int create_pack_revindex_in_memory(struct packed_git *p)
{}

static char *pack_revindex_filename(struct packed_git *p)
{}

#define RIDX_HEADER_SIZE
#define RIDX_MIN_SIZE

struct revindex_header {};

static int load_revindex_from_disk(char *revindex_name,
				   uint32_t num_objects,
				   const uint32_t **data_p, size_t *len_p)
{}

int load_pack_revindex_from_disk(struct packed_git *p)
{}

int load_pack_revindex(struct repository *r, struct packed_git *p)
{}

/*
 * verify_pack_revindex verifies that the on-disk rev-index for the given
 * pack-file is the same that would be created if written from scratch.
 *
 * A negative number is returned on error.
 */
int verify_pack_revindex(struct packed_git *p)
{}

static int can_use_midx_ridx_chunk(struct multi_pack_index *m)
{}

int load_midx_revindex(struct multi_pack_index *m)
{}

int close_midx_revindex(struct multi_pack_index *m)
{}

int offset_to_pack_pos(struct packed_git *p, off_t ofs, uint32_t *pos)
{}

uint32_t pack_pos_to_index(struct packed_git *p, uint32_t pos)
{}

off_t pack_pos_to_offset(struct packed_git *p, uint32_t pos)
{}

uint32_t pack_pos_to_midx(struct multi_pack_index *m, uint32_t pos)
{}

struct midx_pack_key {};

static int midx_pack_order_cmp(const void *va, const void *vb)
{}

static int midx_key_to_pack_pos(struct multi_pack_index *m,
				struct midx_pack_key *key,
				uint32_t *pos)
{}

int midx_to_pack_pos(struct multi_pack_index *m, uint32_t at, uint32_t *pos)
{}

int midx_pair_to_pack_pos(struct multi_pack_index *m, uint32_t pack_int_id,
			  off_t ofs, uint32_t *pos)
{}