ObjStore
view release on metacpan or search on metacpan
lib/ObjStore/AppInstance.pm view on Meta::CPAN
}
sub top {
# fold back into ObjStore::HV? 'partition'?
my ($o) = @_;
if ($o->{'ref'}) {
my $r = $o->{'ref'};
# deleted? XXX
return $r->focus();
}
my $h = $o->{wdb}->hash;
my $skey = $o->{'skey'};
if (! $h->{$skey}) {
my $s = $o->{wdb}->create_segment($skey);
my $i = ObjStore::HV->new($s, 30);
$i->{SELF} = $i;
$i->{ctime} = &now;
$h->{ $skey } = $i->new_ref($h, 'hard');
}
$o->{'ref'} = $h->{ $skey }->focus()->new_ref('transient','hard');
my $top = $o->{'ref'}->focus();
$top;
}
sub global {
my ($o) = @_;
if ($o->{'gref'}) {
my $r = $o->{'gref'};
return $r->focus();
}
my $gl = $o->{wdb}->root('global');
if (!$gl) {
my $s = $o->{wdb}->create_segment('GLOBAL');
$gl = $o->{wdb}->root('global', ObjStore::HV->new($s, 30));
}
$o->{'gref'} = $gl->new_ref('transient','hard');
$gl;
}
sub modified {
my ($o) = @_;
my $t = $o->top;
$t->{mtime} = &now;
}
sub prune {
my ($o, $oldest) = @_;
# delete stuff older than $oldest XXX
}
1;
=head1 NAME
ObjStore::AppInstance - helper class for interactive tools
=head1 SYNOPSIS
use ObjStore::AppInstance;
my $app = ObjStore::AppInstance->new('posh', scalar(getpwuid($>)));
my $hash = $app->top(); # fetch the top level hash for this key
$app->modified(); # set the modification time
$app->prune($oldest); # delete instances older than $oldest
=head1 DESCRIPTION
I'm not sure if this will be depreciated...
=cut
( run in 3.390 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )