Added recursion test, hoisted staleness() to Sector.pm, and refactored to write_bucke...
[dbsrgits/DBM-Deep.git] / lib / DBM / Deep / Sector.pm
CommitLineData
2c70efe1 1package DBM::Deep::Sector;
2
3use 5.006_000;
4
5use strict;
6use warnings FATAL => 'all';
7
8use Scalar::Util ();
9
10sub new {
11 my $self = bless $_[1], $_[0];
12 Scalar::Util::weaken( $self->{engine} );
13 $self->_init;
14 return $self;
15}
16
17sub _init {}
641aa32d 18#sub clone { die "clone must be implemented in a child class" }
19sub clone {
20 my $self = shift;
21 return ref($self)->new({
22 engine => $self->engine,
23 type => $self->type,
24 data => $self->data,
25 });
26}
27
2c70efe1 28
29sub engine { $_[0]{engine} }
30sub offset { $_[0]{offset} }
31sub type { $_[0]{type} }
d3aaaf5e 32sub staleness { $_[0]{staleness} }
2c70efe1 33
34sub load { die "load must be implemented in a child class" }
35
361;
37__END__