| 1 | package Git::Raw::Mempack; | ||
| 2 | 87 | $Git::Raw::Mempack::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 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Git::Raw::Mempack - Git in-memory object database class | ||
| 11 | |||
| 12 | =head1 VERSION | ||
| 13 | |||
| 14 | version 0.90 | ||
| 15 | |||
| 16 | =head1 SYNOPSIS | ||
| 17 | |||
| 18 | use Git::Raw; | ||
| 19 | |||
| 20 | my $mempack = Git::Raw::Mempack -> new; | ||
| 21 | my $odb = $repo -> odb; | ||
| 22 | $odb -> add_backend($mempack, 99); | ||
| 23 | |||
| 24 | # Create blobs, trees and commits... | ||
| 25 | |||
| 26 | # Index the packfile and persist | ||
| 27 | my $odb_path = catfile($repo -> path, 'objects'); | ||
| 28 | my $tp = Git::Raw::TransferProgress -> new; | ||
| 29 | my $indexer = Git::Raw::Indexer -> new($odb_path, $odb); | ||
| 30 | |||
| 31 | my $pack = $mempack -> dump($repo); | ||
| 32 | $indexer -> append($pack, $tp); | ||
| 33 | $indexer -> commit($tp); | ||
| 34 | |||
| 35 | |||
| 36 | =head1 DESCRIPTION | ||
| 37 | |||
| 38 | A L<Git::Raw::Mempack> represents a git in-memory object database. | ||
| 39 | |||
| 40 | =head1 METHODS | ||
| 41 | |||
| 42 | =head2 new( ) | ||
| 43 | |||
| 44 | Create a new mempack backend. | ||
| 45 | |||
| 46 | =head2 dump( $repo ) | ||
| 47 | |||
| 48 | Dump all the queued in-memory writes to a packfile. Returns the contents of the | ||
| 49 | packfile. It is the caller's responsibility to ensure that the generated | ||
| 50 | packfile is available to the repository. | ||
| 51 | |||
| 52 | =head2 reset( ) | ||
| 53 | |||
| 54 | Reset the mempack by clearing all the queued objects. | ||
| 55 | |||
| 56 | =head1 AUTHOR | ||
| 57 | |||
| 58 | Jacques Germishuys <jacquesg@cpan.org> | ||
| 59 | |||
| 60 | =head1 LICENSE AND COPYRIGHT | ||
| 61 | |||
| 62 | Copyright 2016 Jacques Germishuys. | ||
| 63 | |||
| 64 | This program is free software; you can redistribute it and/or modify it | ||
| 65 | under the terms of either: the GNU General Public License as published | ||
| 66 | by the Free Software Foundation; or the Artistic License. | ||
| 67 | |||
| 68 | See http://dev.perl.org/licenses/ for more information. | ||
| 69 | |||
| 70 | =cut | ||
| 71 | |||
| 72 | 87 | 1; # End of Git::Raw::Mempack | |