| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package AnyData2::Storage; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
54
|
use 5.008001; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
124
|
|
|
4
|
4
|
|
|
4
|
|
13
|
use strict; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
102
|
|
|
5
|
4
|
|
|
4
|
|
14
|
use warnings FATAL => 'all'; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
145
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
17
|
use Carp 'croak'; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
706
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
AnyData2::Storage - AnyData2 storage base class |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 METHODS |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
AnyData2::Storage is intended to handle the data I/O for Ls. |
|
20
|
|
|
|
|
|
|
Thus implies, an C instance has requirements for it's |
|
21
|
|
|
|
|
|
|
storage backend. Not every tuple might work well together. |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 new |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
constructs a storage. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
3
|
|
|
3
|
1
|
4
|
my ($class) = @_; |
|
32
|
3
|
|
|
|
|
11
|
bless {}, $class; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 read |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $buf = $stor->read() |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Use binmode for characters as synonymous for bytes. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub read |
|
44
|
|
|
|
|
|
|
{ |
|
45
|
0
|
|
|
0
|
1
|
|
croak "missing overwritten method"; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 write |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$stor->write($buf) |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Writes the buf out |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub write |
|
57
|
|
|
|
|
|
|
{ |
|
58
|
0
|
|
|
0
|
1
|
|
croak "missing overwritten method"; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 seek |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$stor->seek(pos,whence) |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Moves the storage pointer to given position |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub seek |
|
70
|
|
|
|
|
|
|
{ |
|
71
|
0
|
|
|
0
|
1
|
|
croak "missing overwritten method"; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 truncate |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$stor->truncate |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Truncates the underlying storage backend at it's current position. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub truncate |
|
83
|
|
|
|
|
|
|
{ |
|
84
|
0
|
|
|
0
|
1
|
|
croak "missing overwritten method"; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 meta |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Experimental |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Returns a meta storage - if any. Imaging it as an object dealing with |
|
92
|
|
|
|
|
|
|
underlying filesystem for a file storage. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub meta |
|
97
|
|
|
|
|
|
|
{ |
|
98
|
0
|
|
|
0
|
1
|
|
croak "missing overwritten method"; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Copyright 2015 Jens Rehsack. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
106
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
107
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
|
112
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
|
113
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
|
116
|
|
|
|
|
|
|
mark, tradename, or logo of the Copyright Holder. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
|
119
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
|
120
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
|
121
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
|
122
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
|
123
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
|
124
|
|
|
|
|
|
|
direct or contributory patent infringement, then this License |
|
125
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
|
128
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
|
129
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
|
130
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
|
131
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
|
132
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
|
133
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
|
134
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; |