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 module libgit2_d.refdb;
8 
9 
10 private static import libgit2_d.types;
11 
12 /**
13  * @file git2/refdb.h
14  * @brief Git custom refs backend functions
15  * @defgroup git_refdb Git custom refs backend API
16  * @ingroup Git
17  * @{
18  */
19 extern (C):
20 nothrow @nogc:
21 public:
22 
23 /**
24  * Create a new reference database with no backends.
25  *
26  * Before the Ref DB can be used for read/writing, a custom database
27  * backend must be manually set using `git_refdb_set_backend()`
28  *
29  * @param out_ location to store the database pointer, if opened.
30  *			Set to null if the open failed.
31  * @param repo the repository
32  * @return 0 or an error code
33  */
34 //GIT_EXTERN
35 int git_refdb_new(libgit2_d.types.git_refdb** out_, libgit2_d.types.git_repository* repo);
36 
37 /**
38  * Create a new reference database and automatically add
39  * the default backends:
40  *
41  *  - git_refdb_dir: read and write loose and packed refs
42  *      from disk, assuming the repository dir as the folder
43  *
44  * @param out_ location to store the database pointer, if opened.
45  *			Set to null if the open failed.
46  * @param repo the repository
47  * @return 0 or an error code
48  */
49 //GIT_EXTERN
50 int git_refdb_open(libgit2_d.types.git_refdb** out_, libgit2_d.types.git_repository* repo);
51 
52 /**
53  * Suggests that the given refdb compress or optimize its references.
54  * This mechanism is implementation specific.  For on-disk reference
55  * databases, for example, this may pack all loose references.
56  */
57 //GIT_EXTERN
58 int git_refdb_compress(libgit2_d.types.git_refdb* refdb);
59 
60 /**
61  * Close an open reference database.
62  *
63  * @param refdb reference database pointer or null
64  */
65 //GIT_EXTERN
66 void git_refdb_free(libgit2_d.types.git_refdb* refdb);
67 
68 /** @} */