« blib/lib/KinoSearch1/Search/BooleanQuery.pm
↑ Summary
blib/lib/KinoSearch1/Index/CompoundFileReader.pm »
| 1 | package KinoSearch1::Store::InvIndex; | ||||||||||
| 2 | 40 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 40 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 40 | ▶ | use KinoSearch1::Util::ToolSet; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 40 | ▶ | use base qw( KinoSearch1::Util::Class ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 40 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 40 | __PACKAGE__->init_instance_vars( | |||||||||
| 9 | create => 0, | ||||||||||
| 10 | path => undef, | ||||||||||
| 11 | ); | ||||||||||
| 12 | } | ||||||||||
| 13 | |||||||||||
| 14 | 40 | __PACKAGE__->ready_get(qw( create path )); | |||||||||
| 15 | |||||||||||
| 16 | =begin comment | ||||||||||
| 17 | |||||||||||
| 18 | my $outstream = $invindex->open_outstream($filename); | ||||||||||
| 19 | |||||||||||
| 20 | Given a filename, return an OutStream object. | ||||||||||
| 21 | |||||||||||
| 22 | =end comment | ||||||||||
| 23 | =cut | ||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | sub open_outstream { shift->abstract_death } | ||||||||
|
Subroutine
open_outstream: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 26 | |||||||||||
| 27 | =begin comment | ||||||||||
| 28 | |||||||||||
| 29 | my $instream = $invindex->open_instream($filename); | ||||||||||
| 30 | |||||||||||
| 31 | Given a filename, return an InStream object. | ||||||||||
| 32 | |||||||||||
| 33 | =end comment | ||||||||||
| 34 | =cut | ||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | sub open_instream { shift->abstract_death } | ||||||||
|
Subroutine
open_instream: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 37 | |||||||||||
| 38 | =begin comment | ||||||||||
| 39 | |||||||||||
| 40 | my @files = $invindex->list; | ||||||||||
| 41 | |||||||||||
| 42 | Return a list of all the files in the InvIndex | ||||||||||
| 43 | |||||||||||
| 44 | =end comment | ||||||||||
| 45 | =cut | ||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub list { shift->abstract_death } | ||||||||
|
Subroutine
list: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 48 | |||||||||||
| 49 | =begin comment | ||||||||||
| 50 | |||||||||||
| 51 | my $truth = $invindex->file_exists($filename); | ||||||||||
| 52 | |||||||||||
| 53 | Indicate whether the invindex contains a file with the given filename. | ||||||||||
| 54 | |||||||||||
| 55 | =end comment | ||||||||||
| 56 | =cut | ||||||||||
| 57 | |||||||||||
| 58 | 0 | ▶ | sub file_exists { shift->abstract_death } | ||||||||
|
Subroutine
file_exists: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 59 | |||||||||||
| 60 | =begin comment | ||||||||||
| 61 | |||||||||||
| 62 | $invindex->rename_file( $from, $to ); | ||||||||||
| 63 | |||||||||||
| 64 | Rename a file. | ||||||||||
| 65 | |||||||||||
| 66 | =end comment | ||||||||||
| 67 | =cut | ||||||||||
| 68 | |||||||||||
| 69 | 0 | ▶ | sub rename_file { shift->abstract_death } | ||||||||
|
Subroutine
rename_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 70 | |||||||||||
| 71 | =begin comment | ||||||||||
| 72 | |||||||||||
| 73 | $invindex->delete_file($filename); | ||||||||||
| 74 | |||||||||||
| 75 | Delete a file from the invindex. | ||||||||||
| 76 | |||||||||||
| 77 | =end comment | ||||||||||
| 78 | =cut | ||||||||||
| 79 | |||||||||||
| 80 | 0 | ▶ | sub delete_file { shift->abstract_death } | ||||||||
|
Subroutine
delete_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 81 | |||||||||||
| 82 | =begin comment | ||||||||||
| 83 | |||||||||||
| 84 | my $file_contents = $invindex->slurp_file($filename); | ||||||||||
| 85 | |||||||||||
| 86 | Return a scalar with the file's contents. Only for small files, obviously. | ||||||||||
| 87 | |||||||||||
| 88 | =end comment | ||||||||||
| 89 | =cut | ||||||||||
| 90 | |||||||||||
| 91 | 0 | ▶ | sub slurp_file { shift->abstract_death } | ||||||||
|
Subroutine
slurp_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 92 | |||||||||||
| 93 | =begin comment | ||||||||||
| 94 | |||||||||||
| 95 | my $lock = $invindex->make_lock( | ||||||||||
| 96 | lock_name => $name, | ||||||||||
| 97 | timeout => $timeout, # milliseconds | ||||||||||
| 98 | ); | ||||||||||
| 99 | |||||||||||
| 100 | Factory method for creating a KinoSearch1::Store::Lock subclassed object. | ||||||||||
| 101 | |||||||||||
| 102 | =end comment | ||||||||||
| 103 | =cut | ||||||||||
| 104 | |||||||||||
| 105 | 0 | ▶ | sub make_lock { shift->abstract_death } | ||||||||
|
Subroutine
make_lock: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 106 | |||||||||||
| 107 | =begin comment | ||||||||||
| 108 | |||||||||||
| 109 | $invindex->run_while_locked( | ||||||||||
| 110 | lock_name => $name, | ||||||||||
| 111 | timeout => $timeout, # milliseconds | ||||||||||
| 112 | do_body => \&do_some_stuff, | ||||||||||
| 113 | ); | ||||||||||
| 114 | |||||||||||
| 115 | Create a Lock object and obtain a lock, run the subroutine specified by | ||||||||||
| 116 | the do_body parameter, then release the lock and discard the Lock object. | ||||||||||
| 117 | The hash-style argument labels include all the arguments to make_lock, plus | ||||||||||
| 118 | do_body. | ||||||||||
| 119 | |||||||||||
| 120 | =end comment | ||||||||||
| 121 | =cut | ||||||||||
| 122 | |||||||||||
| 123 | 192 | ▶ | sub run_while_locked { | ||||||||
|
Subroutine
run_while_locked: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||
| 124 | 192 | my ( $self, %args ) = @_; | |||||||||
| 125 | 192 | my $do_body = delete $args{do_body}; | |||||||||
| 126 | 192 | my $lock = $self->make_lock( %args, invindex => $self, ); | |||||||||
| 127 | 192 | my $locked; | |||||||||
| 128 | 192 | eval { | |||||||||
| 129 | 192 | $locked = $lock->obtain; | |||||||||
| 130 | 192 | $do_body->(); | |||||||||
| 131 | }; | ||||||||||
| 132 | 192 | ▶ | $lock->release if $lock->is_locked; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 133 | 192 | ▶ | confess $@ if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 134 | } | ||||||||||
| 135 | |||||||||||
| 136 | =begin comment | ||||||||||
| 137 | |||||||||||
| 138 | $invindex->close() | ||||||||||
| 139 | |||||||||||
| 140 | Release any reserved resources. | ||||||||||
| 141 | |||||||||||
| 142 | =end comment | ||||||||||
| 143 | =cut | ||||||||||
| 144 | |||||||||||
| 145 | 0 | ▶ | sub close { shift->abstract_death } | ||||||||
|
Subroutine
close: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 146 | |||||||||||
| 147 | 40 | 1; | |||||||||
| 148 | |||||||||||
| 149 | __END__ | ||||||||||