File: Odb.pm

package info (click to toggle)
libgit-raw-perl 0.87%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,464 kB
  • sloc: perl: 5,404; ansic: 182; makefile: 6
file content (94 lines) | stat: -rw-r--r-- 2,554 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package Git::Raw::Odb;
$Git::Raw::Odb::VERSION = '0.87';
use strict;
use warnings;

use Git::Raw;
use Git::Raw::Odb::Backend;

=head1 NAME

Git::Raw::Odb - Git object database class

=head1 VERSION

version 0.87

=head1 DESCRIPTION

A L<Git::Raw::Odb> represents a git object database.

B<WARNING>: The API of this module is unstable and may change without warning
(any change will be appropriately documented in the changelog).

=head1 METHODS

=head2 new( )

Create a new object database.

=head2 open( $directory )

Create a new object database and automatically add the two default backends.
C<$directory> should be the path to the 'objects' directory.

=head2 backend_count( )

Get the number of ODB backend objects.

=head2 refresh( )

Refresh the object database to load newly added files. If the object databases
have changed on disk while the library is running, this function will force a
reload of the underlying indexes. Use this method when you're confident that an
external application has tampered with the ODB.

=head2 foreach( $repo, $callback )

Run C<$callback> for every object available in the database. The callback receives
a single argument, the OID of the object. A non-zero return value will terminate
the loop.

=head2 add_backend( $backend, $priority )

Add a custom backend to the ODB. The backends are checked in relative ordering,
based on the value of C<$priority>.

=head2 add_alternate( $backend, $priority )

Add an alternate custom backend to the ODB. Alternate backends are always
checked for objects after all the main backends have been exhausted. Writing is
disabled on alternate backends.

=head2 read( $id )

Read an object from the database. Returns a L<Git::Raw::Odb::Object> or C<undef>
if the object does not exist.

=head2 write( $data, type )

Write an object directly to the database. Returns the OID of the object. C<$type>
should be one of the values as defines in the constants section of L<Git::Raw::Object>.

=head2 hash( $data, $type )

Determine the object-ID (sha1 hash) of C<$data>. C<$type> should be one of the values
as defined in the constants section of L<Git::Raw::Object>.

=head1 AUTHOR

Jacques Germishuys <jacquesg@striata.com>

=head1 LICENSE AND COPYRIGHT

Copyright 2016 Jacques Germishuys.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

=cut

1; # End of Git::Raw::Odb