midx.hon commit Merge branch 'cb/fetch-set-upstream' (9437394)
   1#ifndef MIDX_H
   2#define MIDX_H
   3
   4#include "repository.h"
   5
   6struct object_id;
   7struct pack_entry;
   8struct repository;
   9
  10#define GIT_TEST_MULTI_PACK_INDEX "GIT_TEST_MULTI_PACK_INDEX"
  11
  12struct multi_pack_index {
  13        struct multi_pack_index *next;
  14
  15        int fd;
  16
  17        const unsigned char *data;
  18        size_t data_len;
  19
  20        uint32_t signature;
  21        unsigned char version;
  22        unsigned char hash_len;
  23        unsigned char num_chunks;
  24        uint32_t num_packs;
  25        uint32_t num_objects;
  26
  27        int local;
  28
  29        const unsigned char *chunk_pack_names;
  30        const uint32_t *chunk_oid_fanout;
  31        const unsigned char *chunk_oid_lookup;
  32        const unsigned char *chunk_object_offsets;
  33        const unsigned char *chunk_large_offsets;
  34
  35        const char **pack_names;
  36        struct packed_git **packs;
  37        char object_dir[FLEX_ARRAY];
  38};
  39
  40struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local);
  41int prepare_midx_pack(struct repository *r, struct multi_pack_index *m, uint32_t pack_int_id);
  42int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result);
  43struct object_id *nth_midxed_object_oid(struct object_id *oid,
  44                                        struct multi_pack_index *m,
  45                                        uint32_t n);
  46int fill_midx_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e, struct multi_pack_index *m);
  47int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name);
  48int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local);
  49
  50int write_midx_file(const char *object_dir);
  51void clear_midx_file(struct repository *r);
  52int verify_midx_file(struct repository *r, const char *object_dir);
  53int expire_midx_packs(struct repository *r, const char *object_dir);
  54int midx_repack(struct repository *r, const char *object_dir, size_t batch_size);
  55
  56void close_midx(struct multi_pack_index *m);
  57
  58#endif