summaryrefslogtreecommitdiff
path: root/docs/git2/ODB.luadoc
blob: 6e060ee004ba28aed03b4f392c45d3482459e087 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
--
-- Warning: AUTOGENERATED DOCS.
--

--- Class "ODB".
--
module("ODB")

--- Create a new ODB object.
--
-- <p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/odb/git_odb_new">git_odb_new</a>:<p><p>Before the ODB can be used for read/writing, a custom database
--  backend must be manually added using `git_odb_add_backend()`
-- @return <a href="ODB.html">ODB</a> or <code>nil</code> on error.
-- @return Error string.
-- @name ODB.new
function ODB.new()
end

--- Create a new ODB object.
--
-- <p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/odb/git_odb_open">git_odb_open</a>:<p><p>- git_odb_backend_loose: read and write loose object files
-- 		from disk, assuming `objects_dir` as the Objects folder<p>	- git_odb_backend_pack: read objects from packfiles,
-- 		assuming `objects_dir` as the Objects folder which
-- 		contains a 'pack/' folder with the corresponding data
-- @param object_dir Must be of type <code>string</code>.
-- @return <a href="ODB.html">ODB</a> or <code>nil</code> on error.
-- @return Error string.
-- @name ODB.open
function ODB.open(object_dir)
end

--- Destroy this object (will be called by Garbage Collector).
--
-- <p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/odb/git_odb_free">git_odb_free</a>:<p><p>
-- @name ODB:free
function ODB:free()
end

--- object method.
--
-- @param backend Must be of type <a href="ODBBackend.html">ODBBackend</a>.
-- @param priority Must be of type <code>integer</code>.
-- @return <code>true</code> if no error.
-- @return Error string.
-- @name ODB:add_backend
function ODB:add_backend(backend, priority)
end

--- object method.
--
-- @param backend Must be of type <a href="ODBBackend.html">ODBBackend</a>.
-- @param priority Must be of type <code>integer</code>.
-- @return <code>true</code> if no error.
-- @return Error string.
-- @name ODB:add_alternate
function ODB:add_alternate(backend, priority)
end

--- object method.
--
-- <p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/odb/git_odb_read">git_odb_read</a>:<p><p>This method queries all available ODB backends
--  trying to read the given OID.<p> The returned object is reference counted and
--  internally cached, so it should be closed
--  by the user once it's no longer in use.<p> @return
--  - 0 if the object was read;
--  - GIT_ENOTFOUND if the object is not in the database.
-- @param id identity of the object to read..  Must be of type <a href="OID.html">OID</a>.
-- @return <a href="OdbObject.html">OdbObject</a> or <code>nil</code> on error.
-- @return Error string.
-- @name ODB:read
function ODB:read(id)
end

--- object method.
--
-- <p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/odb/git_odb_read_prefix">git_odb_read_prefix</a>:<p><p>This method queries all available ODB backends
--  trying to match the 'len' first hexadecimal
--  characters of the 'short_id'.
--  The remaining (GIT_OID_HEXSZ-len)*4 bits of
--  'short_id' must be 0s.
--  'len' must be at least GIT_OID_MINPREFIXLEN,
--  and the prefix must be long enough to identify
--  a unique object in all the backends; the
--  method will fail otherwise.<p> The returned object is reference counted and
--  internally cached, so it should be closed
--  by the user once it's no longer in use.
-- @param short_id a prefix of the id of the object to read..  Must be of type <a href="OID.html">OID</a>.
-- @param len the length of the prefix.  Must be of type <code>integer</code>.
-- @return <a href="OdbObject.html">OdbObject</a> or <code>nil</code> on error.
-- @return Error string.
-- @name ODB:read_prefix
function ODB:read_prefix(short_id, len)
end

--- object method.
--
-- <p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/odb/git_odb_read_header">git_odb_read_header</a>:<p><p>The header includes the length and the type of an object.<p> Note that most backends do not support reading only the header
--  of an object, so the whole object will be read and then the
--  header will be returned.<p> @return
--  - 0 if the object was read;
--  - GIT_ENOTFOUND if the object is not in the database.
-- @param id identity of the object to read..  Must be of type <a href="OID.html">OID</a>.
-- @return <code>integer</code> or <code>nil</code> on error.
-- @return <code>string</code> or <code>nil</code> on error.
-- @return Error string.
-- @name ODB:read_header
function ODB:read_header(id)
end

--- object method.
--
-- <p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/odb/git_odb_exists">git_odb_exists</a>:<p><p>@return
--  - 1, if the object was found
--  - 0, otherwise
-- @param id the object to search for..  Must be of type <a href="OID.html">OID</a>.
-- @return <code>true</code> if no error.
-- @return Error string.
-- @name ODB:exists
function ODB:exists(id)
end

--- object method.
--
-- <p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/odb/git_odb_write">git_odb_write</a>:<p><p>This method writes a full object straight into the ODB.
--  For most cases, it is preferred to write objects through a write
--  stream, which is both faster and less memory intensive, specially
--  for big objects.<p> This method is provided for compatibility with custom backends
--  which are not able to support streaming writes
-- @param data buffer with the data to storr.  Must be of type <code>string</code>.
-- @param type type of the data to store.  Must be of type <code>string</code>.
-- @return <a href="OID.html">OID</a> or <code>nil</code> on error.
-- @return Error string.
-- @name ODB:write
function ODB:write(data, type)
end

--- module function.
--
-- <p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/odb/git_odb_hash">git_odb_hash</a>:<p><p>The resulting SHA-1 OID will the itentifier for the data
--  buffer as if the data buffer it were to written to the ODB.
-- @param data data to hash.  Must be of type <code>string</code>.
-- @param otype Must be of type <code>integer</code>.
-- @return <a href="OID.html">OID</a> or <code>nil</code> on error.
-- @return Error string.
-- @name ODB.hash
function ODB.hash(data, otype)
end

--- module function.
--
-- <p>Calls <a href="http://libgit2.github.com/libgit2/#HEAD/group/odb/git_odb_hashfile">git_odb_hashfile</a>:<p><p>
-- @param path file to read and determine object id for.  Must be of type <code>string</code>.
-- @param otype Must be of type <code>integer</code>.
-- @return <a href="OID.html">OID</a> or <code>nil</code> on error.
-- @return Error string.
-- @name ODB.hashfile
function ODB.hashfile(path, otype)
end