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