blib/lib/Git/Raw/Odb.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 18 / 18 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Git/Raw/Note.pm ↑ Summary blib/lib/Git/Raw/Odb/Backend.pm »
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
« blib/lib/Git/Raw/Note.pm ↑ Summary blib/lib/Git/Raw/Odb/Backend.pm »