Blame include/git2/indexer.h

Packit ae9e2a
/*
Packit ae9e2a
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit ae9e2a
 *
Packit ae9e2a
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit ae9e2a
 * a Linking Exception. For full terms see the included COPYING file.
Packit ae9e2a
 */
Packit ae9e2a
#ifndef _INCLUDE_git_indexer_h__
Packit ae9e2a
#define _INCLUDE_git_indexer_h__
Packit ae9e2a
Packit ae9e2a
#include "common.h"
Packit ae9e2a
#include "types.h"
Packit ae9e2a
#include "oid.h"
Packit ae9e2a
Packit ae9e2a
GIT_BEGIN_DECL
Packit ae9e2a
Packit ae9e2a
typedef struct git_indexer git_indexer;
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Create a new indexer instance
Packit ae9e2a
 *
Packit ae9e2a
 * @param out where to store the indexer instance
Packit ae9e2a
 * @param path to the directory where the packfile should be stored
Packit ae9e2a
 * @param mode permissions to use creating packfile or 0 for defaults
Packit ae9e2a
 * @param odb object database from which to read base objects when
Packit ae9e2a
 * fixing thin packs. Pass NULL if no thin pack is expected (an error
Packit ae9e2a
 * will be returned if there are bases missing)
Packit ae9e2a
 * @param progress_cb function to call with progress information
Packit ae9e2a
 * @param progress_cb_payload payload for the progress callback
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(int) git_indexer_new(
Packit ae9e2a
		git_indexer **out,
Packit ae9e2a
		const char *path,
Packit ae9e2a
		unsigned int mode,
Packit ae9e2a
		git_odb *odb,
Packit ae9e2a
		git_transfer_progress_cb progress_cb,
Packit ae9e2a
		void *progress_cb_payload);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Add data to the indexer
Packit ae9e2a
 *
Packit ae9e2a
 * @param idx the indexer
Packit ae9e2a
 * @param data the data to add
Packit ae9e2a
 * @param size the size of the data in bytes
Packit ae9e2a
 * @param stats stat storage
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(int) git_indexer_append(git_indexer *idx, const void *data, size_t size, git_transfer_progress *stats);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Finalize the pack and index
Packit ae9e2a
 *
Packit ae9e2a
 * Resolve any pending deltas and write out the index file
Packit ae9e2a
 *
Packit ae9e2a
 * @param idx the indexer
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(int) git_indexer_commit(git_indexer *idx, git_transfer_progress *stats);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Get the packfile's hash
Packit ae9e2a
 *
Packit ae9e2a
 * A packfile's name is derived from the sorted hashing of all object
Packit ae9e2a
 * names. This is only correct after the index has been finalized.
Packit ae9e2a
 *
Packit ae9e2a
 * @param idx the indexer instance
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(const git_oid *) git_indexer_hash(const git_indexer *idx);
Packit ae9e2a
Packit ae9e2a
/**
Packit ae9e2a
 * Free the indexer and its resources
Packit ae9e2a
 *
Packit ae9e2a
 * @param idx the indexer to free
Packit ae9e2a
 */
Packit ae9e2a
GIT_EXTERN(void) git_indexer_free(git_indexer *idx);
Packit ae9e2a
Packit ae9e2a
GIT_END_DECL
Packit ae9e2a
Packit ae9e2a
#endif