File Coverage

blib/lib/Git/Raw/Odb.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Git::Raw::Odb;
2             $Git::Raw::Odb::VERSION = '0.90';
3 36     36   217 use strict;
  36         60  
  36         938  
4 36     36   158 use warnings;
  36         59  
  36         817  
5              
6 36     36   152 use Git::Raw;
  36         60  
  36         706  
7 36     36   13785 use Git::Raw::Odb::Backend;
  36         79  
  36         1253  
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 represents a git object database.
20              
21             B: 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 or C
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.
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.
77              
78             =head1 AUTHOR
79              
80             Jacques Germishuys
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             1; # End of Git::Raw::Odb