| 1 | package Git::Raw::Odb; | ||
| 2 | 87 | $Git::Raw::Odb::VERSION = '0.90'; | |
| 3 | 87 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 87 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 87 | ▶ | use Git::Raw; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 87 | ▶ | use Git::Raw::Odb::Backend; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | Git::Raw::Odb - Git object database class | ||
| 12 | |||
| 13 | =head1 VERSION | ||
| 14 | |||
| 15 | version 0.90 | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | A L<Git::Raw::Odb> represents a git object database. | ||
| 20 | |||
| 21 | B<WARNING>: The API of this module is unstable and may change without warning | ||
| 22 | (any change will be appropriately documented in the changelog). | ||
| 23 | |||
| 24 | =head1 METHODS | ||
| 25 | |||
| 26 | =head2 new( ) | ||
| 27 | |||
| 28 | Create a new object database. | ||
| 29 | |||
| 30 | =head2 open( $directory ) | ||
| 31 | |||
| 32 | Create a new object database and automatically add the two default backends. | ||
| 33 | C<$directory> should be the path to the 'objects' directory. | ||
| 34 | |||
| 35 | =head2 backend_count( ) | ||
| 36 | |||
| 37 | Get the number of ODB backend objects. | ||
| 38 | |||
| 39 | =head2 refresh( ) | ||
| 40 | |||
| 41 | Refresh the object database to load newly added files. If the object databases | ||
| 42 | have changed on disk while the library is running, this function will force a | ||
| 43 | reload of the underlying indexes. Use this method when you're confident that an | ||
| 44 | external application has tampered with the ODB. | ||
| 45 | |||
| 46 | =head2 foreach( $repo, $callback ) | ||
| 47 | |||
| 48 | Run C<$callback> for every object available in the database. The callback receives | ||
| 49 | a single argument, the OID of the object. A non-zero return value will terminate | ||
| 50 | the loop. | ||
| 51 | |||
| 52 | =head2 add_backend( $backend, $priority ) | ||
| 53 | |||
| 54 | Add a custom backend to the ODB. The backends are checked in relative ordering, | ||
| 55 | based on the value of C<$priority>. | ||
| 56 | |||
| 57 | =head2 add_alternate( $backend, $priority ) | ||
| 58 | |||
| 59 | Add an alternate custom backend to the ODB. Alternate backends are always | ||
| 60 | checked for objects after all the main backends have been exhausted. Writing is | ||
| 61 | disabled on alternate backends. | ||
| 62 | |||
| 63 | =head2 read( $id ) | ||
| 64 | |||
| 65 | Read an object from the database. Returns a L<Git::Raw::Odb::Object> or C<undef> | ||
| 66 | if the object does not exist. | ||
| 67 | |||
| 68 | =head2 write( $data, type ) | ||
| 69 | |||
| 70 | Write an object directly to the database. Returns the OID of the object. C<$type> | ||
| 71 | should be one of the values as defines in the constants section of L<Git::Raw::Object>. | ||
| 72 | |||
| 73 | =head2 hash( $data, $type ) | ||
| 74 | |||
| 75 | Determine the object-ID (sha1 hash) of C<$data>. C<$type> should be one of the values | ||
| 76 | as defined in the constants section of L<Git::Raw::Object>. | ||
| 77 | |||
| 78 | =head1 AUTHOR | ||
| 79 | |||
| 80 | Jacques Germishuys <jacquesg@cpan.org> | ||
| 81 | |||
| 82 | =head1 LICENSE AND COPYRIGHT | ||
| 83 | |||
| 84 | Copyright 2016 Jacques Germishuys. | ||
| 85 | |||
| 86 | This program is free software; you can redistribute it and/or modify it | ||
| 87 | under the terms of either: the GNU General Public License as published | ||
| 88 | by the Free Software Foundation; or the Artistic License. | ||
| 89 | |||
| 90 | See http://dev.perl.org/licenses/ for more information. | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | 87 | 1; # End of Git::Raw::Odb | |