summaryrefslogtreecommitdiff
path: root/include/git2/sys/odb_backend.h
Commit message (Collapse)AuthorAgeFilesLines
* Update documentation for ODB backend refresh logicJosh Triplett2021-11-081-5/+2
| | | | | | | Commit b1a6c316a6070fac4ab1ec5792979838f7145c39 moved auto-refresh into the pack backend, and added a comment accordingly. Commit 43820f204ea32503b4083e3b6b83f30a0a0031c9 moved auto-refresh back *out* of backends into the ODB layer, but didn't update the comment.
* midx: Introduce git_odb_write_multi_pack_index()lhchavez2021-08-271-0/+7
| | | | | | | | This change introduces git_odb_write_multi_pack_index(), which creates a `multi-pack-index` file from all the `.pack` files that have been loaded in the ODB. Fixes: #5399
* odb: use `git_object_size_t` for object sizeEdward Thomson2019-11-221-1/+1
| | | | | Instead of using a signed type (`off_t`) use a new `git_object_size_t` for the sizes of objects.
* odb: provide a free function for custom backendsethomson/odb_backend_allocationsEdward Thomson2019-02-231-0/+11
| | | | | | | | | | | | Custom backends can allocate memory when reading objects and providing them to libgit2. However, if an error occurs in the custom backend after the memory has been allocated for the custom object but before it's returned to libgit2, the custom backend has no way to free that memory and it must be leaked. Provide a free function that corresponds to the alloc function so that custom backends have an opportunity to free memory before they return an error.
* odb: rename git_odb_backend_malloc for consistencyEdward Thomson2019-02-231-2/+35
| | | | | | | | | | | | The `git_odb_backend_malloc` name is a system function that is provided for custom ODB backends and allows them to allocate memory for an ODB object in the read callback. This is important so that libgit2 can later free the memory used by an ODB object that was read from the custom backend. However, the name _suggests_ that it actually allocates a `git_odb_backend`. It does not; rename it to make it clear that it actually allocates backend _data_.
* indexer: use git_indexer_progress throughoutEdward Thomson2019-02-221-1/+1
| | | | | Update internal usage of `git_transfer_progress` to `git_indexer_progreses`.
* Introduce GIT_CALLBACK macro to enforce cdeclEdward Thomson2019-01-171-13/+13
| | | | | | | | | Since we now always build the library with cdecl calling conventions, our callbacks should be decorated as such so that users will not be able to provide callbacks defined with other calling conventions. The `GIT_CALLBACK` macro will inject the `__cdecl` attribute as appropriate.
* object_type: update public API to use git_object_tEdward Thomson2018-12-011-6/+6
| | | | | | git_object_t is the future; update the public API to use it. This will also ensure that we can build our tests which make use of the old API without modification (and without compiler warnings).
* odb: provide length and type with streaming readEdward Thomson2018-02-011-1/+2
| | | | | The streaming read functionality should provide the length and the type of the object, like the normal read functionality does.
* odb: freshen existing objects when writingEdward Thomson2016-08-041-0/+11
| | | | | | When writing an object, we calculate its OID and see if it exists in the object database. If it does, we need to freshen the file that contains it.
* refdb and odb backends must provide `free` functionArthur Schreiber2015-10-011-0/+4
| | | | | | | | | As refdb and odb backends can be allocated by client code, libgit2 can’t know whether an alternative memory allocator was used, and thus should not try to call `git__free` on those objects. Instead, odb and refdb backend implementations must always provide their own `free` functions to ensure memory gets freed correctly.
* Fix @param names in doc commentsBen Chatelain2015-07-271-1/+1
|
* odb: make the writestream's size a git_off_tcmn/stream-sizeCarlos Martín Nieto2015-05-131-1/+1
| | | | | | | | | | Restricting files to size_t is a silly limitation. The loose backend writes to a file directly, so there is no issue in using 63 bits for the size. We still assume that the header is going to fit in 64 bytes, which does mean quite a bit smaller files due to the run-length encoding, but it's still a much larger size than you would want Git to handle.
* Fix remaining init_options inconsistenciesRussell Belfer2014-05-021-5/+4
| | | | | There were a couple of "init_opts()" functions a few more cases of structure initialization that I somehow missed.
* Don't redefine the same callback types, their signatures may changeJacques Germishuys2014-04-211-1/+1
|
* Added function-based initializers for every options struct.Matthew Bowen2014-03-051-0/+13
| | | | The basic structure of each function is courtesy of arrbee.
* Add exists_prefix to ODB backend and ODB APIRussell Belfer2014-03-041-5/+5
|
* indexer: fix thin packsCarlos Martín Nieto2013-10-041-1/+1
| | | | | | When given an ODB from which to read objects, the indexer will attempt to inject the missing bases at the end of the pack and update the header and trailer to reflect the new contents.
* odb: Move the auto refresh logic to the pack backendnulltoken2013-09-041-0/+10
| | | | | | | | | | | | Previously, `git_object_read()`, `git_object_read_prefix()` and `git_object_exists()` were implementing an auto refresh logic. When the expected object couldn't be found in any backend, a call to `git_odb_refresh()` was triggered and the lookup was once again performed against all backends. This commit removes this auto-refresh logic from the odb layer and pushes it down into the pack-backend (as it's the only one currently exposing a `refresh()` endpoint).
* odb: document git_odb_streamCarlos Martín Nieto2013-08-171-0/+4
| | | | | | Clarify the role of each function and in particular mention that there is no need for the backend or stream to worry about the object's id, as it will be given when `finalize_write` is called.
* odb: make it clearer that the id is calculated in the frontendCarlos Martín Nieto2013-08-171-5/+1
| | | | | | | | | | The frontend is in charge of calculating the id of the objects. Thus the backends should treat it as a read-only value. The positioning in the function signature made it seem as though it was an output parameter. Make the id const and move it from the front to behind the subject (backend or stream).
* Move odb_backend implementors stuff into git2/sysRussell Belfer2013-04-211-0/+86
This moves some of the odb_backend stuff that is related to the internals of an odb_backend implementation into include/git2/sys. Some of the stuff related to streaming I left in include/git2 because it seemed like it would be reasonably needed by a normal user who wanted to stream objects into and out of the ODB. Also, I added APIs for traversing the list of backends so that some of the tests would not need to access ODB internals.