Files
libgit2/group__git__odb.html
Carlos Martín Nieto 8c7ff8a765 generated docs
2011-04-07 13:27:55 +02:00

810 lines
41 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libgit2: Git object database routines</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">libgit2</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li id="searchli">
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Git object database routines</div> </div>
</div>
<div class="contents">
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#gad91d934c491d84cd947f5b0f2bf4ff73">git_odb_new</a> (<a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> **out)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new object database with no backends. <a href="#gad91d934c491d84cd947f5b0f2bf4ff73"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#gaf0934f0ecee120156645d191ad8f37c3">git_odb_open</a> (<a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> **out, const char *objects_dir)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new object database and automatically add the two default backends: <a href="#gaf0934f0ecee120156645d191ad8f37c3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#ga46b6534b2d4d733f0495154a419d551d">git_odb_add_backend</a> (<a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *odb, <a class="el" href="structgit__odb__backend.html">git_odb_backend</a> *backend, int priority)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a custom backend to an existing Object DB. <a href="#ga46b6534b2d4d733f0495154a419d551d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#ga43980323860b470a9f841267d042f479">git_odb_add_alternate</a> (<a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *odb, <a class="el" href="structgit__odb__backend.html">git_odb_backend</a> *backend, int priority)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a custom backend to an existing Object DB; this backend will work as an alternate. <a href="#ga43980323860b470a9f841267d042f479"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#ga27d3ff8e01c7d533849ff5144b1b4841">git_odb_close</a> (<a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *db)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Close an open object database. <a href="#ga27d3ff8e01c7d533849ff5144b1b4841"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#ga302afa67d03d63f122f9cecbda48e09c">git_odb_read</a> (<a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> **out, <a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *db, const <a class="el" href="structgit__oid.html">git_oid</a> *id)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Read an object from the database. <a href="#ga302afa67d03d63f122f9cecbda48e09c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#ga63791acb580779fe72cc49a6c1718c22">git_odb_read_header</a> (size_t *len_p, <a class="el" href="types_8h.html#a5c9a2783d4fc110bc6a4f5355d20fedb">git_otype</a> *type_p, <a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *db, const <a class="el" href="structgit__oid.html">git_oid</a> *id)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Read the header of an object from the database, without reading its full contents. <a href="#ga63791acb580779fe72cc49a6c1718c22"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#gae216becda5d6274da15193b0c34e2dce">git_odb_exists</a> (<a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *db, const <a class="el" href="structgit__oid.html">git_oid</a> *id)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Determine if the given object can be found in the object database. <a href="#gae216becda5d6274da15193b0c34e2dce"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#gaae8634ec5cd6d5126f13b3a3ed543b8f">git_odb_write</a> (<a class="el" href="structgit__oid.html">git_oid</a> *oid, <a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *odb, const void *data, size_t len, <a class="el" href="types_8h.html#a5c9a2783d4fc110bc6a4f5355d20fedb">git_otype</a> type)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Write an object directly into the ODB. <a href="#gaae8634ec5cd6d5126f13b3a3ed543b8f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#ga9cc1cb11fe8ee54612ca3198c5ced5e6">git_odb_open_wstream</a> (<a class="el" href="structgit__odb__stream.html">git_odb_stream</a> **stream, <a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *db, size_t size, <a class="el" href="types_8h.html#a5c9a2783d4fc110bc6a4f5355d20fedb">git_otype</a> type)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Open a stream to write an object into the ODB. <a href="#ga9cc1cb11fe8ee54612ca3198c5ced5e6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#ga5bed67fc83555ee362d4e22a1b36eba2">git_odb_open_rstream</a> (<a class="el" href="structgit__odb__stream.html">git_odb_stream</a> **stream, <a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *db, const <a class="el" href="structgit__oid.html">git_oid</a> *oid)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Open a stream to read an object from the ODB. <a href="#ga5bed67fc83555ee362d4e22a1b36eba2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#ga369baa7719b13cc97c18bb7a7c69709d">git_odb_hash</a> (<a class="el" href="structgit__oid.html">git_oid</a> *id, const void *data, size_t len, <a class="el" href="types_8h.html#a5c9a2783d4fc110bc6a4f5355d20fedb">git_otype</a> type)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Determine the object-ID (sha1 hash) of a data buffer. <a href="#ga369baa7719b13cc97c18bb7a7c69709d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#ga5f85a8852e44197555bc486ed1ec714b">git_odb_object_close</a> (<a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> *object)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Close an ODB object. <a href="#ga5f85a8852e44197555bc486ed1ec714b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="structgit__oid.html">git_oid</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#gaa87c8f685ae164619bb5e29e850f1b5a">git_odb_object_id</a> (<a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> *object)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the OID of an ODB object. <a href="#gaa87c8f685ae164619bb5e29e850f1b5a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#gafd3cc7225cb9b3c58d249d308bb1fa6e">git_odb_object_data</a> (<a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> *object)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the data of an ODB object. <a href="#gafd3cc7225cb9b3c58d249d308bb1fa6e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#ga13b74a5b23c04e2157ca69b049635ddb">git_odb_object_size</a> (<a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> *object)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the size of an ODB object. <a href="#ga13b74a5b23c04e2157ca69b049635ddb"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="types_8h.html#a5c9a2783d4fc110bc6a4f5355d20fedb">git_otype</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__git__odb.html#gaadf93a816dcbe0d78c6ae793e4566597">git_odb_object_type</a> (<a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> *object)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the type of an ODB object. <a href="#gaadf93a816dcbe0d78c6ae793e4566597"></a><br/></td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga43980323860b470a9f841267d042f479"></a><!-- doxytag: member="odb.h::git_odb_add_alternate" ref="ga43980323860b470a9f841267d042f479" args="(git_odb *odb, git_odb_backend *backend, int priority)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_add_alternate </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *&#160;</td>
<td class="paramname"><em>odb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structgit__odb__backend.html">git_odb_backend</a> *&#160;</td>
<td class="paramname"><em>backend</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>priority</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Add a custom backend to an existing Object DB; this backend will work as an alternate. </p>
<p>Alternate backends are always checked for objects *after* all the main backends have been exhausted.</p>
<p>Writing is disabled on alternate backends.</p>
<p>Read &lt;odb_backends.h&gt; for more information.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">odb</td><td>database to add the backend to backend pointer to a <a class="el" href="structgit__odb__backend.html" title="An instance for a custom backend.">git_odb_backend</a> instance </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on sucess; error code otherwise </dd></dl>
</div>
</div>
<a class="anchor" id="ga46b6534b2d4d733f0495154a419d551d"></a><!-- doxytag: member="odb.h::git_odb_add_backend" ref="ga46b6534b2d4d733f0495154a419d551d" args="(git_odb *odb, git_odb_backend *backend, int priority)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_add_backend </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *&#160;</td>
<td class="paramname"><em>odb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structgit__odb__backend.html">git_odb_backend</a> *&#160;</td>
<td class="paramname"><em>backend</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>priority</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Add a custom backend to an existing Object DB. </p>
<p>Read &lt;odb_backends.h&gt; for more information.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">odb</td><td>database to add the backend to backend pointer to a <a class="el" href="structgit__odb__backend.html" title="An instance for a custom backend.">git_odb_backend</a> instance </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on sucess; error code otherwise </dd></dl>
</div>
</div>
<a class="anchor" id="ga27d3ff8e01c7d533849ff5144b1b4841"></a><!-- doxytag: member="odb.h::git_odb_close" ref="ga27d3ff8e01c7d533849ff5144b1b4841" args="(git_odb *db)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void git_odb_close </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *&#160;</td>
<td class="paramname"><em>db</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Close an open object database. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">db</td><td>database pointer to close. If NULL no action is taken. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gae216becda5d6274da15193b0c34e2dce"></a><!-- doxytag: member="odb.h::git_odb_exists" ref="gae216becda5d6274da15193b0c34e2dce" args="(git_odb *db, const git_oid *id)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_exists </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *&#160;</td>
<td class="paramname"><em>db</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structgit__oid.html">git_oid</a> *&#160;</td>
<td class="paramname"><em>id</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Determine if the given object can be found in the object database. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">db</td><td>database to be searched for the given object. </td></tr>
<tr><td class="paramname">id</td><td>the object to search for. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>1, if the object was found</li>
<li>0, otherwise </li>
</ul>
</dd></dl>
</div>
</div>
<a class="anchor" id="ga369baa7719b13cc97c18bb7a7c69709d"></a><!-- doxytag: member="odb.h::git_odb_hash" ref="ga369baa7719b13cc97c18bb7a7c69709d" args="(git_oid *id, const void *data, size_t len, git_otype type)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_hash </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structgit__oid.html">git_oid</a> *&#160;</td>
<td class="paramname"><em>id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a5c9a2783d4fc110bc6a4f5355d20fedb">git_otype</a>&#160;</td>
<td class="paramname"><em>type</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Determine the object-ID (sha1 hash) of a data buffer. </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.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">id</td><td>the resulting object-ID. </td></tr>
<tr><td class="paramname">data</td><td>data to hash </td></tr>
<tr><td class="paramname">len</td><td>size of the data </td></tr>
<tr><td class="paramname">type</td><td>of the data to hash </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success; error code otherwise </dd></dl>
</div>
</div>
<a class="anchor" id="gad91d934c491d84cd947f5b0f2bf4ff73"></a><!-- doxytag: member="odb.h::git_odb_new" ref="gad91d934c491d84cd947f5b0f2bf4ff73" args="(git_odb **out)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_new </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> **&#160;</td>
<td class="paramname"><em>out</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Create a new object database with no backends. </p>
<p>Before the ODB can be used for read/writing, a custom database backend must be manually added using `git_odb_add_backend()`</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">out</td><td>location to store the database pointer, if opened. Set to NULL if the open failed. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>GIT_SUCCESS if the database was created; otherwise an error code describing why the open was not possible. </dd></dl>
</div>
</div>
<a class="anchor" id="ga5f85a8852e44197555bc486ed1ec714b"></a><!-- doxytag: member="odb.h::git_odb_object_close" ref="ga5f85a8852e44197555bc486ed1ec714b" args="(git_odb_object *object)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void git_odb_object_close </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> *&#160;</td>
<td class="paramname"><em>object</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Close an ODB object. </p>
<p>This method must always be called once a `git_odb_object` is no longer needed, otherwise memory will leak.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">object</td><td>object to close </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gafd3cc7225cb9b3c58d249d308bb1fa6e"></a><!-- doxytag: member="odb.h::git_odb_object_data" ref="gafd3cc7225cb9b3c58d249d308bb1fa6e" args="(git_odb_object *object)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const void* git_odb_object_data </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> *&#160;</td>
<td class="paramname"><em>object</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the data of an ODB object. </p>
<p>This is the uncompressed, raw data as read from the ODB, without the leading header.</p>
<p>This pointer is owned by the object and shall not be free'd.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">object</td><td>the object </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a pointer to the data </dd></dl>
</div>
</div>
<a class="anchor" id="gaa87c8f685ae164619bb5e29e850f1b5a"></a><!-- doxytag: member="odb.h::git_odb_object_id" ref="gaa87c8f685ae164619bb5e29e850f1b5a" args="(git_odb_object *object)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="structgit__oid.html">git_oid</a>* git_odb_object_id </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> *&#160;</td>
<td class="paramname"><em>object</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the OID of an ODB object. </p>
<p>This is the OID from which the object was read from</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">object</td><td>the object </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a pointer to the OID </dd></dl>
</div>
</div>
<a class="anchor" id="ga13b74a5b23c04e2157ca69b049635ddb"></a><!-- doxytag: member="odb.h::git_odb_object_size" ref="ga13b74a5b23c04e2157ca69b049635ddb" args="(git_odb_object *object)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t git_odb_object_size </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> *&#160;</td>
<td class="paramname"><em>object</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the size of an ODB object. </p>
<p>This is the real size of the `data` buffer, not the actual size of the object.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">object</td><td>the object </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the size </dd></dl>
</div>
</div>
<a class="anchor" id="gaadf93a816dcbe0d78c6ae793e4566597"></a><!-- doxytag: member="odb.h::git_odb_object_type" ref="gaadf93a816dcbe0d78c6ae793e4566597" args="(git_odb_object *object)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="types_8h.html#a5c9a2783d4fc110bc6a4f5355d20fedb">git_otype</a> git_odb_object_type </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> *&#160;</td>
<td class="paramname"><em>object</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the type of an ODB object. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">object</td><td>the object </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the type </dd></dl>
</div>
</div>
<a class="anchor" id="gaf0934f0ecee120156645d191ad8f37c3"></a><!-- doxytag: member="odb.h::git_odb_open" ref="gaf0934f0ecee120156645d191ad8f37c3" args="(git_odb **out, const char *objects_dir)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_open </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> **&#160;</td>
<td class="paramname"><em>out</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>objects_dir</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Create a new object database and automatically add the two default backends: </p>
<ul>
<li>git_odb_backend_loose: read and write loose object files from disk, assuming `objects_dir` as the Objects folder</li>
</ul>
<ul>
<li>git_odb_backend_pack: read objects from packfiles, assuming `objects_dir` as the Objects folder which contains a 'pack/' folder with the corresponding data</li>
</ul>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">out</td><td>location to store the database pointer, if opened. Set to NULL if the open failed. </td></tr>
<tr><td class="paramname">objects_dir</td><td>path of the backends' "objects" directory. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>GIT_SUCCESS if the database opened; otherwise an error code describing why the open was not possible. </dd></dl>
</div>
</div>
<a class="anchor" id="ga5bed67fc83555ee362d4e22a1b36eba2"></a><!-- doxytag: member="odb.h::git_odb_open_rstream" ref="ga5bed67fc83555ee362d4e22a1b36eba2" args="(git_odb_stream **stream, git_odb *db, const git_oid *oid)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_open_rstream </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structgit__odb__stream.html">git_odb_stream</a> **&#160;</td>
<td class="paramname"><em>stream</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *&#160;</td>
<td class="paramname"><em>db</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structgit__oid.html">git_oid</a> *&#160;</td>
<td class="paramname"><em>oid</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Open a stream to read an object from the ODB. </p>
<p>Note that most backends do *not* support streaming reads because they store their objects as compressed/delta'ed blobs.</p>
<p>It's recommended to use `git_odb_read` instead, which is assured to work on all backends.</p>
<p>The returned stream will be of type `GIT_STREAM_RDONLY` and will have the following methods:</p>
<ul>
<li>stream-&gt;read: read `n` bytes from the stream</li>
<li>stream-&gt;free: free the stream</li>
</ul>
<p>The stream must always be free'd or will leak memory.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="structgit__odb__stream.html" title="A stream to read/write from a backend.">git_odb_stream</a></dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">stream</td><td>pointer where to store the stream </td></tr>
<tr><td class="paramname">db</td><td>object database where the stream will read from </td></tr>
<tr><td class="paramname">oid</td><td>oid of the object the stream will read from </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if the stream was created; error code otherwise </dd></dl>
</div>
</div>
<a class="anchor" id="ga9cc1cb11fe8ee54612ca3198c5ced5e6"></a><!-- doxytag: member="odb.h::git_odb_open_wstream" ref="ga9cc1cb11fe8ee54612ca3198c5ced5e6" args="(git_odb_stream **stream, git_odb *db, size_t size, git_otype type)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_open_wstream </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structgit__odb__stream.html">git_odb_stream</a> **&#160;</td>
<td class="paramname"><em>stream</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *&#160;</td>
<td class="paramname"><em>db</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a5c9a2783d4fc110bc6a4f5355d20fedb">git_otype</a>&#160;</td>
<td class="paramname"><em>type</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Open a stream to write an object into the ODB. </p>
<p>The type and final length of the object must be specified when opening the stream.</p>
<p>The returned stream will be of type `GIT_STREAM_WRONLY` and will have the following methods:</p>
<ul>
<li>stream-&gt;write: write `n` bytes into the stream</li>
<li>stream-&gt;finalize_write: close the stream and store the object in the odb</li>
<li>stream-&gt;free: free the stream</li>
</ul>
<p>The streaming write won't be effective until `stream-&gt;finalize_write` is called and returns without an error</p>
<p>The stream must always be free'd or will leak memory.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="structgit__odb__stream.html" title="A stream to read/write from a backend.">git_odb_stream</a></dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">stream</td><td>pointer where to store the stream </td></tr>
<tr><td class="paramname">db</td><td>object database where the stream will write </td></tr>
<tr><td class="paramname">size</td><td>final size of the object that will be written </td></tr>
<tr><td class="paramname">type</td><td>type of the object that will be written </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if the stream was created; error code otherwise </dd></dl>
</div>
</div>
<a class="anchor" id="ga302afa67d03d63f122f9cecbda48e09c"></a><!-- doxytag: member="odb.h::git_odb_read" ref="ga302afa67d03d63f122f9cecbda48e09c" args="(git_odb_object **out, git_odb *db, const git_oid *id)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_read </td>
<td>(</td>
<td class="paramtype"><a class="el" href="types_8h.html#a9a308e55d5bfa8b50f4d9f3c4b820c58">git_odb_object</a> **&#160;</td>
<td class="paramname"><em>out</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *&#160;</td>
<td class="paramname"><em>db</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structgit__oid.html">git_oid</a> *&#160;</td>
<td class="paramname"><em>id</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Read an object from the database. </p>
<p>This method queries all avaiable ODB backends trying to read the given OID.</p>
<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>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">out</td><td>pointer where to store the read object </td></tr>
<tr><td class="paramname">db</td><td>database to search for the object in. </td></tr>
<tr><td class="paramname">id</td><td>identity of the object to read. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>GIT_SUCCESS if the object was read;</li>
<li>GIT_ENOTFOUND if the object is not in the database. </li>
</ul>
</dd></dl>
</div>
</div>
<a class="anchor" id="ga63791acb580779fe72cc49a6c1718c22"></a><!-- doxytag: member="odb.h::git_odb_read_header" ref="ga63791acb580779fe72cc49a6c1718c22" args="(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_read_header </td>
<td>(</td>
<td class="paramtype">size_t *&#160;</td>
<td class="paramname"><em>len_p</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a5c9a2783d4fc110bc6a4f5355d20fedb">git_otype</a> *&#160;</td>
<td class="paramname"><em>type_p</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *&#160;</td>
<td class="paramname"><em>db</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structgit__oid.html">git_oid</a> *&#160;</td>
<td class="paramname"><em>id</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Read the header of an object from the database, without reading its full contents. </p>
<p>The header includes the length and the type of an object.</p>
<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>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">len_p</td><td>pointer where to store the length </td></tr>
<tr><td class="paramname">type_p</td><td>pointer where to store the type </td></tr>
<tr><td class="paramname">db</td><td>database to search for the object in. </td></tr>
<tr><td class="paramname">id</td><td>identity of the object to read. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>GIT_SUCCESS if the object was read;</li>
<li>GIT_ENOTFOUND if the object is not in the database. </li>
</ul>
</dd></dl>
</div>
</div>
<a class="anchor" id="gaae8634ec5cd6d5126f13b3a3ed543b8f"></a><!-- doxytag: member="odb.h::git_odb_write" ref="gaae8634ec5cd6d5126f13b3a3ed543b8f" args="(git_oid *oid, git_odb *odb, const void *data, size_t len, git_otype type)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int git_odb_write </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structgit__oid.html">git_oid</a> *&#160;</td>
<td class="paramname"><em>oid</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a787d49b60ab769b98c10bc4133b53f8a">git_odb</a> *&#160;</td>
<td class="paramname"><em>odb</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t&#160;</td>
<td class="paramname"><em>len</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a5c9a2783d4fc110bc6a4f5355d20fedb">git_otype</a>&#160;</td>
<td class="paramname"><em>type</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Write an object directly into the ODB. </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>
<p>This method is provided for compatibility with custom backends which are not able to support streaming writes</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">oid</td><td>pointer to store the OID result of the write </td></tr>
<tr><td class="paramname">odb</td><td>object database where to store the object </td></tr>
<tr><td class="paramname">data</td><td>buffer with the data to storr </td></tr>
<tr><td class="paramname">len</td><td>size of the buffer </td></tr>
<tr><td class="paramname">type</td><td>type of the data to store </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success; error code otherwise </dd></dl>
</div>
</div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Thu Apr 7 2011 13:27:55 for libgit2 by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>