return p;
}
-void packfile_store_add_pack(struct packfile_store *store,
+void packfile_store_add_pack(struct odb_source_packed *store,
struct packed_git *pack)
{
if (pack->pack_fd != -1)
strmap_put(&store->packs_by_path, pack->pack_name, pack);
}
-struct packed_git *packfile_store_load_pack(struct packfile_store *store,
+struct packed_git *packfile_store_load_pack(struct odb_source_packed *store,
const char *idx_path, int local)
{
struct strbuf key = STRBUF_INIT;
return -1;
}
-void packfile_store_prepare(struct packfile_store *store)
+void packfile_store_prepare(struct odb_source_packed *store)
{
if (store->initialized)
return;
store->initialized = true;
}
-void packfile_store_reprepare(struct packfile_store *store)
+void packfile_store_reprepare(struct odb_source_packed *store)
{
store->initialized = false;
packfile_store_prepare(store);
}
-struct packfile_list_entry *packfile_store_get_packs(struct packfile_store *store)
+struct packfile_list_entry *packfile_store_get_packs(struct odb_source_packed *store)
{
packfile_store_prepare(store);
return store->packs.head;
}
-int packfile_store_count_objects(struct packfile_store *store,
+int packfile_store_count_objects(struct odb_source_packed *store,
enum odb_count_objects_flags flags UNUSED,
unsigned long *out)
{
return 1;
}
-static int find_pack_entry(struct packfile_store *store,
+static int find_pack_entry(struct odb_source_packed *store,
const struct object_id *oid,
struct pack_entry *e)
{
return 0;
}
-int packfile_store_freshen_object(struct packfile_store *store,
+int packfile_store_freshen_object(struct odb_source_packed *store,
const struct object_id *oid)
{
struct pack_entry e;
return 1;
}
-int packfile_store_read_object_info(struct packfile_store *store,
+int packfile_store_read_object_info(struct odb_source_packed *store,
const struct object_id *oid,
struct object_info *oi,
enum object_info_flags flags)
return 0;
}
-static void maybe_invalidate_kept_pack_cache(struct packfile_store *store,
+static void maybe_invalidate_kept_pack_cache(struct odb_source_packed *store,
unsigned flags)
{
if (!store->kept_cache.packs)
store->kept_cache.flags = 0;
}
-struct packed_git **packfile_store_get_kept_pack_cache(struct packfile_store *store,
+struct packed_git **packfile_store_get_kept_pack_cache(struct odb_source_packed *store,
unsigned flags)
{
maybe_invalidate_kept_pack_cache(store, flags);
return r;
}
-struct packfile_store_for_each_object_wrapper_data {
- struct packfile_store *store;
+struct odb_source_packed_for_each_object_wrapper_data {
+ struct odb_source_packed *store;
const struct object_info *request;
odb_for_each_object_cb cb;
void *cb_data;
uint32_t index_pos,
void *cb_data)
{
- struct packfile_store_for_each_object_wrapper_data *data = cb_data;
+ struct odb_source_packed_for_each_object_wrapper_data *data = cb_data;
if (data->request) {
off_t offset = nth_packed_object_offset(pack, index_pos);
}
static int for_each_prefixed_object_in_midx(
- struct packfile_store *store,
+ struct odb_source_packed *store,
struct multi_pack_index *m,
const struct odb_for_each_object_options *opts,
- struct packfile_store_for_each_object_wrapper_data *data)
+ struct odb_source_packed_for_each_object_wrapper_data *data)
{
int ret;
}
static int for_each_prefixed_object_in_pack(
- struct packfile_store *store,
+ struct odb_source_packed *store,
struct packed_git *p,
const struct odb_for_each_object_options *opts,
- struct packfile_store_for_each_object_wrapper_data *data)
+ struct odb_source_packed_for_each_object_wrapper_data *data)
{
uint32_t num, i, first = 0;
int len = opts->prefix_hex_len > p->repo->hash_algo->hexsz ?
}
static int packfile_store_for_each_prefixed_object(
- struct packfile_store *store,
+ struct odb_source_packed *store,
const struct odb_for_each_object_options *opts,
- struct packfile_store_for_each_object_wrapper_data *data)
+ struct odb_source_packed_for_each_object_wrapper_data *data)
{
struct packfile_list_entry *e;
struct multi_pack_index *m;
return ret;
}
-int packfile_store_for_each_object(struct packfile_store *store,
+int packfile_store_for_each_object(struct odb_source_packed *store,
const struct object_info *request,
odb_for_each_object_cb cb,
void *cb_data,
const struct odb_for_each_object_options *opts)
{
- struct packfile_store_for_each_object_wrapper_data data = {
+ struct odb_source_packed_for_each_object_wrapper_data data = {
.store = store,
.request = request,
.cb = cb,
*out = len;
}
-int packfile_store_find_abbrev_len(struct packfile_store *store,
+int packfile_store_find_abbrev_len(struct odb_source_packed *store,
const struct object_id *oid,
unsigned min_len,
unsigned *out)
return 0;
}
-struct packfile_store *packfile_store_new(struct odb_source *source)
+struct odb_source_packed *packfile_store_new(struct odb_source *source)
{
- struct packfile_store *store;
+ struct odb_source_packed *store;
CALLOC_ARRAY(store, 1);
store->source = source;
strmap_init(&store->packs_by_path);
return store;
}
-void packfile_store_free(struct packfile_store *store)
+void packfile_store_free(struct odb_source_packed *store)
{
for (struct packfile_list_entry *e = store->packs.head; e; e = e->next)
free(e->pack);
free(store);
}
-void packfile_store_close(struct packfile_store *store)
+void packfile_store_close(struct odb_source_packed *store)
{
for (struct packfile_list_entry *e = store->packs.head; e; e = e->next) {
if (e->pack->do_not_close)
}
int packfile_store_read_object_stream(struct odb_read_stream **out,
- struct packfile_store *store,
+ struct odb_source_packed *store,
const struct object_id *oid)
{
struct pack_entry e;
/*
* A store that manages packfiles for a given object database.
*/
-struct packfile_store {
+struct odb_source_packed {
struct odb_source *source;
/*
* Allocate and initialize a new empty packfile store for the given object
* database source.
*/
-struct packfile_store *packfile_store_new(struct odb_source *source);
+struct odb_source_packed *packfile_store_new(struct odb_source *source);
/*
* Free the packfile store and all its associated state. All packfiles
* tracked by the store will be closed.
*/
-void packfile_store_free(struct packfile_store *store);
+void packfile_store_free(struct odb_source_packed *store);
/*
* Close all packfiles associated with this store. The packfiles won't be
* free'd, so they can be re-opened at a later point in time.
*/
-void packfile_store_close(struct packfile_store *store);
+void packfile_store_close(struct odb_source_packed *store);
/*
* Prepare the packfile store by loading packfiles and multi-pack indices for
* It shouldn't typically be necessary to call this function directly, as
* functions that access the store know to prepare it.
*/
-void packfile_store_prepare(struct packfile_store *store);
+void packfile_store_prepare(struct odb_source_packed *store);
/*
* Clear the packfile caches and try to look up any new packfiles that have
*
* This function must be called under the `odb_read_lock()`.
*/
-void packfile_store_reprepare(struct packfile_store *store);
+void packfile_store_reprepare(struct odb_source_packed *store);
/*
* Add the pack to the store so that contained objects become accessible via
* the store. This moves ownership into the store.
*/
-void packfile_store_add_pack(struct packfile_store *store,
+void packfile_store_add_pack(struct odb_source_packed *store,
struct packed_git *pack);
/*
* Get all packs managed by the given store, including packfiles that are
* referenced by multi-pack indices.
*/
-struct packfile_list_entry *packfile_store_get_packs(struct packfile_store *store);
+struct packfile_list_entry *packfile_store_get_packs(struct odb_source_packed *store);
struct repo_for_each_pack_data {
struct odb_source *source;
repo_for_each_pack_data_next(&eack_pack_data))
int packfile_store_read_object_stream(struct odb_read_stream **out,
- struct packfile_store *store,
+ struct odb_source_packed *store,
const struct object_id *oid);
/*
* not found, 0 if it was and read successfully, and a negative error code in
* case the object was corrupted.
*/
-int packfile_store_read_object_info(struct packfile_store *store,
+int packfile_store_read_object_info(struct odb_source_packed *store,
const struct object_id *oid,
struct object_info *oi,
enum object_info_flags flags);
* either the newly opened packfile or the preexisting packfile. Returns a
* `NULL` pointer in case the packfile could not be opened.
*/
-struct packed_git *packfile_store_load_pack(struct packfile_store *store,
+struct packed_git *packfile_store_load_pack(struct odb_source_packed *store,
const char *idx_path, int local);
-int packfile_store_freshen_object(struct packfile_store *store,
+int packfile_store_freshen_object(struct odb_source_packed *store,
const struct object_id *oid);
enum kept_pack_type {
*
* Return 0 on success, a negative error code otherwise.
*/
-int packfile_store_count_objects(struct packfile_store *store,
+int packfile_store_count_objects(struct odb_source_packed *store,
enum odb_count_objects_flags flags,
unsigned long *out);
* combination of `kept_pack_type` flags. The cache is computed on demand and
* will be recomputed whenever the flags change.
*/
-struct packed_git **packfile_store_get_kept_pack_cache(struct packfile_store *store,
+struct packed_git **packfile_store_get_kept_pack_cache(struct odb_source_packed *store,
unsigned flags);
struct pack_window {
*
* The flags parameter is a combination of `odb_for_each_object_flags`.
*/
-int packfile_store_for_each_object(struct packfile_store *store,
+int packfile_store_for_each_object(struct odb_source_packed *store,
const struct object_info *request,
odb_for_each_object_cb cb,
void *cb_data,
const struct odb_for_each_object_options *opts);
-int packfile_store_find_abbrev_len(struct packfile_store *store,
+int packfile_store_find_abbrev_len(struct odb_source_packed *store,
const struct object_id *oid,
unsigned min_len,
unsigned *out);