line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyData2::Storage; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
53
|
use 5.008001; |
|
4
|
|
|
|
|
8
|
|
4
|
4
|
|
|
4
|
|
11
|
use strict; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
63
|
|
5
|
4
|
|
|
4
|
|
9
|
use warnings FATAL => 'all'; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
87
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
11
|
use Carp 'croak'; |
|
4
|
|
|
|
|
2
|
|
|
4
|
|
|
|
|
620
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
AnyData2::Storage - AnyData2 storage base class |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
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
|
5
|
my ($class) = @_; |
32
|
3
|
|
|
|
|
10
|
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 drop |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
$stor->drop |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Drops the underlying storage (e.g. delete file) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub drop |
96
|
|
|
|
|
|
|
{ |
97
|
0
|
|
|
0
|
1
|
|
croak "missing overwritten method"; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 meta |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Experimental |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Returns a meta storage - if any. Imaging it as an object dealing with |
105
|
|
|
|
|
|
|
underlying filesystem for a file storage. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub meta |
110
|
|
|
|
|
|
|
{ |
111
|
0
|
|
|
0
|
1
|
|
croak "missing overwritten method"; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Copyright 2015,2016 Jens Rehsack. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
119
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
120
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
125
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
126
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
129
|
|
|
|
|
|
|
mark, tradename, or logo of the Copyright Holder. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
132
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
133
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
134
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
135
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
136
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
137
|
|
|
|
|
|
|
direct or contributory patent infringement, then this License |
138
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
141
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
142
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
143
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
144
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
145
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
146
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
147
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
1; |