CDS
view release on metacpan or search on metacpan
my $value = shift;
$o->{store} = $value;
}
sub collectWatch {
my $o = shift;
my $label = shift;
my $value = shift;
$o->{watchTimeout} = 60000;
}
sub new {
my $class = shift;
my $actor = shift;
bless {actor => $actor, ui => $actor->ui} }
# END AUTOGENERATED
# HTML FOLDER NAME curl
my $o = shift;
my $cmd = shift;
$cmd->collect($o);
$o->{keyPairToken} = $o->{actor}->preferredKeyPairToken if ! $o->{keyPairToken};
$o->{store} = $o->{actor}->preferredStore if ! $o->{store};
$o->{actorHash} = $o->{actor}->preferredActorHash if ! $o->{actorHash};
my $boxToken = CDS::BoxToken->new(CDS::AccountToken->new($o->{store}, $o->{actorHash}), $o->{boxLabel});
my $args = ['--output', '.cds-curl-list'];
push @$args, '-H', 'Condensation-Watch: '.$o->{watchTimeout}.' ms' if $o->{watchTimeout};
$o->curlRequest('GET', $boxToken->url, $args);
}
sub curlModify {
my $o = shift;
my $cmd = shift;
$o->{currentBatch} = {
addHashes => [],
addEnvelopes => [],
my $value = shift;
$o->{store} = $value;
}
sub collectWatch {
my $o = shift;
my $label = shift;
my $value = shift;
$o->{watchTimeout} = 60000;
}
sub new {
my $class = shift;
my $actor = shift;
bless {actor => $actor, ui => $actor->ui} }
# END AUTOGENERATED
# HTML FOLDER NAME store-list
sub listBox {
my $o = shift;
my $boxToken = shift;
$o->{ui}->space;
$o->{ui}->title($o->{actor}->blueBoxReference($boxToken));
# Query the store
my $store = $boxToken->accountToken->cliStore;
my ($hashes, $storeError) = $store->list($boxToken->accountToken->actorHash, $boxToken->boxLabel, $o->{watchTimeout} // 0, $o->{keyPairToken}->keyPair);
return if defined $storeError;
# Print the result
my $count = scalar @$hashes;
return if ! $count;
my $context = $boxToken->boxLabel eq 'messages' ? $o->{ui}->gray(' on ', $o->{actor}->storeReference($store)) : $o->{ui}->gray(' from ', $o->{actor}->accountReference($boxToken->accountToken));
my $keyPairContext = $boxToken->boxLabel eq 'public' ? '' : $o->{keyPairContext} // '';
foreach my $hash (sort { $a->bytes cmp $b->bytes } @$hashes) {
$o->{ui}->line($o->{ui}->gold('cds open envelope ', $hash->hex), $context, $keyPairContext);
my $store = shift;
my $checkPutHash = shift;
my $checkSignatures = shift // 1;
return bless {
root => $root,
store => $store,
checkPutHash => $checkPutHash,
checkEnvelopeHash => $checkPutHash,
checkSignatures => $checkSignatures,
maximumWatchTimeout => 0,
};
}
sub process {
my $o = shift;
my $request = shift;
my $path = $request->pathAbove($o->{root}) // return;
# Objects request
# List box
if ($request->method eq 'HEAD' || $request->method eq 'GET') {
if ($o->{checkSignatures}) {
my $actorHash = $request->checkSignature($o->{store});
return $request->reply403 if ! $o->verifyList($actorHash, $accountHash, $boxLabel);
}
my $watch = $request->headers->{'condensation-watch'} // '';
my $timeout = $watch =~ /^(\d+)\s*ms$/ ? $1 + 0 : 0;
$timeout = $o->{maximumWatchTimeout} if $timeout > $o->{maximumWatchTimeout};
my ($hashes, $error) = $o->{store}->list($accountHash, $boxLabel, $timeout);
return $request->replyFatalError($error) if defined $error;
return $request->reply200Bytes(join('', map { $_->bytes } @$hashes));
}
return $request->reply405;
}
sub boxEntry {
my $o = shift;
return substr($s, 0, $len - 6).' '.substr($s, $len - 6, 3).' '.substr($s, $len - 3, 3);
}
# Reads the message box of an actor.
package CDS::MessageBoxReader;
sub new {
my $class = shift;
my $pool = shift;
my $actorOnStore = shift; die 'wrong type '.ref($actorOnStore).' for $actorOnStore' if defined $actorOnStore && ref $actorOnStore ne 'CDS::ActorOnStore';
my $streamTimeout = shift;
return bless {
pool => $pool,
actorOnStore => $actorOnStore,
streamCache => CDS::StreamCache->new($pool, $actorOnStore, $streamTimeout // CDS->MINUTE),
entries => {},
};
}
sub pool { shift->{pool} }
sub actorOnStore { shift->{actorOnStore} }
sub read {
my $o = shift;
my $timeout = shift // 0;
( run in 0.539 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )