1 /*
2  * Copyright (C) the libgit2 contributors. All rights reserved.
3  *
4  * This file is part of libgit2, distributed under the GNU GPL v2 with
5  * a Linking Exception. For full terms see the included COPYING file.
6  */
7 /**
8  * License: GPL-2.0(Linking Exception)
9  */
10 module libgit2.sys.midx;
11 
12 
13 private static import libgit2.buffer;
14 private static import libgit2.types;
15 private import libgit2.common: GIT_EXTERN;
16 
17 /*
18  * @file git2/midx.h
19  * @brief Git multi-pack-index routines
20  * @defgroup git_midx Git multi-pack-index routines
21  * @ingroup Git
22  * @{
23  */
24 extern (C):
25 nothrow @nogc:
26 
27 /**
28  * Create a new writer for `multi-pack-index` files.
29  *
30  * Params:
31  *      out_ = location to store the writer pointer.
32  *      pack_dir = the directory where the `.pack` and `.idx` files are. The `multi-pack-index` file will be written in this directory, too.
33  *
34  * Returns: 0 or an error code
35  */
36 @GIT_EXTERN
37 int git_midx_writer_new(libgit2.types.git_midx_writer** out_, const (char)* pack_dir);
38 
39 /**
40  * Free the multi-pack-index writer and its resources.
41  *
42  * Params:
43  *      w = the writer to free. If null no action is taken.
44  */
45 @GIT_EXTERN
46 void git_midx_writer_free(libgit2.types.git_midx_writer* w);
47 
48 /**
49  * Add an `.idx` file to the writer.
50  *
51  * Params:
52  *      w = the writer
53  *      idx_path = the path of an `.idx` file.
54  *
55  * Returns: 0 or an error code
56  */
57 @GIT_EXTERN
58 int git_midx_writer_add(libgit2.types.git_midx_writer* w, const (char)* idx_path);
59 
60 /**
61  * Write a `multi-pack-index` file to a file.
62  *
63  * Params:
64  *      w = the writer
65  *
66  * Returns: 0 or an error code
67  */
68 @GIT_EXTERN
69 int git_midx_writer_commit(libgit2.types.git_midx_writer* w);
70 
71 /**
72  * Dump the contents of the `multi-pack-index` to an in-memory buffer.
73  *
74  * Params:
75  *      midx = Buffer where to store the contents of the `multi-pack-index`.
76  *      w = the writer
77  *
78  * Returns: 0 or an error code
79  */
80 @GIT_EXTERN
81 int git_midx_writer_dump(libgit2.buffer.git_buf* midx, libgit2.types.git_midx_writer* w);
82 
83 /* @} */