1 module deimos.git2.sys.refdb_backend;
2 
3 import deimos.git2.common;
4 import deimos.git2.oid;
5 import deimos.git2.types;
6 
7 extern (C):
8 
9 struct git_reference_iterator {
10 	git_refdb *db;
11 	int function(
12 		git_reference **ref_,
13 		git_reference_iterator *iter) next;
14 	int function(
15 		const(char)** ref_name,
16 		git_reference_iterator *iter) next_name;
17 	void function(
18 		git_reference_iterator *iter) free;
19 }
20 
21 struct git_refdb_backend {
22 	uint version_ = GIT_REFDB_BACKEND_VERSION;
23 	int function(
24 		int *exists,
25 		git_refdb_backend *backend,
26 		const(char)* ref_name) exists;
27 	int function(
28 		git_reference **out_,
29 		git_refdb_backend *backend,
30 		const(char)* ref_name) lookup;
31 	int function(
32 		git_reference_iterator **iter,
33 		git_refdb_backend *backend,
34 		const(char)* glob) iterator;
35 	int function(git_refdb_backend *backend,
36 		const(git_reference)* ref_, int force) write;
37 	int function(
38 		git_reference **out_, git_refdb_backend *backend,
39 		const(char)* old_name, const(char)* new_name, int force) rename;
40 	int function(git_refdb_backend *backend, const(char)* ref_name) del;
41 	int function(git_refdb_backend *backend) compress;
42 	void function(git_refdb_backend *backend) free;
43 	int function(git_reflog **out_, git_refdb_backend *backend, const(char)* name) reflog_read;
44 	int function(git_refdb_backend *backend, git_reflog *reflog) reflog_write;
45 	int function(git_refdb_backend *_backend, const(char)* old_name, const(char)* new_name) reflog_rename;
46 	int function(git_refdb_backend *backend, const(char)* name) reflog_delete;
47 }
48 
49 enum GIT_REFDB_BACKEND_VERSION = 1;
50 enum git_refdb_backend GIT_REFDB_BACKEND_INIT = { GIT_REFDB_BACKEND_VERSION };
51 
52 int git_refdb_backend_fs(
53 	git_refdb_backend **backend_out,
54 	git_repository *repo);
55 int git_refdb_set_backend(
56 	git_refdb *refdb,
57 	git_refdb_backend *backend);