CDS
    
    
  
  
  
view release on metacpan or search on metacpan
	$ui->space;
	$ui->command('cds join ACCOUNT*');
	$ui->command('cds join ACTOR on STORE');
	$ui->p('Adds a member to our actor group. To complete the association, the new member must join us, too.');
	$ui->space;
	$ui->command('cds set member ACTOR* active');
	$ui->command('cds set member ACTOR* backup');
	$ui->command('cds set member ACTOR* idle');
	$ui->command('cds set member ACTOR* revoked');
	$ui->p('Changes the status of a member to one of the following:');
	$ui->p($ui->bold('Active members'), ' share the group data among themselves, and are advertised to receive messages.');
	$ui->p($ui->bold('Backup members'), ' share the group data (like active members), but are publicly advertised as not processing messages (like idle members). This is suitable for backup actors.');
	$ui->p($ui->bold('Idle members'), ' are part of the group, but advertised as not processing messages. They generally do not have the latest group data, and may have no group data at all. Idle members may reactivate themselves, or get reactivated by ...
	$ui->p($ui->bold('Revoked members'), ' have explicitly been removed from the group, e.g. because their private key (or device) got lost. Revoked members can be reactivated by any active member of the group.');
	$ui->p('Note that changing the status does not start or stop the corresponding actor, but just change how it is regarded by others. The status of each member should reflect its actual behavior.');
	$ui->space;
	$ui->p('After modifying the actor group members, you should "cds announce" yourself to publish the changes.');
	$ui->space;
}
sub show {
	my $o = shift;
	my $cmd = shift;
			$o->{ui}->space;
			$o->process($hash, $store);
		}
	}
	# Report the total size
	my $totalSize = 0;
	my $totalDataSize = 0;
	map { $totalSize += $_->{size} ; $totalDataSize += $_->{dataSize} } values %{$o->{objects}};
	$o->{ui}->space;
	$o->{ui}->p(scalar keys %{$o->{objects}}, ' unique objects ', $o->{ui}->bold($o->{ui}->niceFileSize($totalSize)), $o->{ui}->gray(' (', $o->{ui}->niceFileSize($totalSize - $totalDataSize), ' header and ', $o->{ui}->niceFileSize($totalDataSize), ' dat...
	$o->{ui}->pRed(scalar keys %{$o->{missingObjects}}, ' or more objects are missing') if scalar keys %{$o->{missingObjects}};
	$o->{ui}->space;
}
sub process {
	my $o = shift;
	my $hash = shift; die 'wrong type '.ref($hash).' for $hash' if defined $hash && ref $hash ne 'CDS::Hash';
	my $store = shift;
	my $hashHex = $hash->hex;
	return if defined $storeError;
	if (! $object) {
		$o->{missingObjects}->{$hashHex} = 1;
		return $o->{ui}->line($hashHex, ' ', $o->{ui}->red('is missing'));
	}
	# Display
	my $size = $object->byteLength;
	$o->{objects}->{$hashHex} = {size => $size, dataSize => length $object->data};
	$o->{ui}->line($hashHex, ' ', $o->{ui}->bold($o->{ui}->niceFileSize($size)), ' ', $o->{ui}->gray($object->hashesCount, ' hashes'));
	# Process all children
	$o->{ui}->pushIndent;
	foreach my $hash ($object->hashes) {
		$o->process($hash, $store) // return;
	}
	$o->{ui}->popIndent;
	return 1;
}
	my $ui = $o->{ui};
	$ui->line($o->{ui}->gray($ui->niceDateTimeLocal), '  ', $ui->blue($ui->left(15, $request->peerAddress)), '  ', $request->method, ' ', $request->path, '  ', $ui->red(@_));
}
sub onRequestDone {
	my $o = shift;
	my $request = shift;
	my $responseCode = shift;
	my $ui = $o->{ui};
	$ui->line($o->{ui}->gray($ui->niceDateTimeLocal), '  ', $ui->blue($ui->left(15, $request->peerAddress)), '  ', $request->method, ' ', $request->path, '  ', $ui->bold($responseCode));
}
# BEGIN AUTOGENERATED
package CDS::Commands::Transfer;
sub register {
	my $class = shift;
	my $cds = shift;
	my $help = shift;
	for my $i (reverse 0 .. $n - 1) {
		my $toStore = $toStores->[$i];
		$o->{ui}->line($o->{ui}->gray(' â' x $i, ' â', 'ââ' x ($n - $i), ' ', $toStore->{store}->url), ' ', defined $toStore->{storeError} ? $o->{ui}->red($toStore->{storeError}) : '');
	}
	# Report the total size
	my $totalSize = 0;
	my $totalDataSize = 0;
	map { $totalSize += $_->{size} ; $totalDataSize += $_->{dataSize} } values %{$o->{objects}};
	$o->{ui}->space;
	$o->{ui}->p(scalar keys %{$o->{objects}}, ' unique objects ', $o->{ui}->bold($o->{ui}->niceFileSize($totalSize)), ' ', $o->{ui}->gray($o->{ui}->niceFileSize($totalDataSize), ' data'));
	$o->{ui}->pOrange(scalar keys %{$o->{missingObjects}}, ' or more objects are missing') if scalar keys %{$o->{missingObjects}};
	$o->{ui}->space;
}
sub process {
	my $o = shift;
	my $hash = shift; die 'wrong type '.ref($hash).' for $hash' if defined $hash && ref $hash ne 'CDS::Hash';
	my $fromStore = shift;
	my $toStores = shift;
	my $depth = shift;
	if (! defined $object) {
		$o->{missingObjects}->{$hashHex} = 1;
		$o->report($hashHex, $toStores, $depth, $o->{ui}->orange('is missing'));
		return if ! $o->{leniently};
	}
	# Display
	my $size = $object->byteLength;
	$o->{objects}->{$hashHex} = {needed => $countNeeded, size => $size, dataSize => length $object->data};
	$o->report($hashHex, $toStores, $depth, $o->{ui}->bold($o->{ui}->niceFileSize($size)), ' ', $o->{ui}->gray($object->hashesCount, ' hashes'));
	# Process all children
	foreach my $hash ($object->hashes) {
		$o->process($hash, $fromStore, $toStores, $depth + 1) // return;
	}
	# Write the object to all active stores
	for my $toStore (@$toStores) {
		next if defined $toStore->{storeError};
		next if ! $toStore->{needed}->[$depth];
	$o->{hasProgress} = 0;
	$| = 0;
}
### Low-level (non-semantic) formatting
sub span {
	my $o = shift;
	 CDS::UI::Span->new(@_) }
sub bold {
	my $o = shift;
	my $span = CDS::UI::Span->new(@_);
	$span->{bold} = 1;
	return $span;
}
sub underlined {
	my $o = shift;
	my $span = CDS::UI::Span->new(@_);
	$span->{underlined} = 1;
	return $span;
}
	my $o = shift;
	 $o->foreground(238, @_) }		# for commands that can be executed
sub gray {
	my $o = shift;
	 $o->foreground(246, @_) }		# for additional (less important) information
sub darkBold {
	my $o = shift;
	my $span = CDS::UI::Span->new(@_);
	$span->{bold} = 1;
	$span->{foreground} = 240;
	return $span;
}
### Semantic output
sub title {
	my $o = shift;
	 $o->line($o->bold(@_)) }
sub left {
	my $o = shift;
	my $width = shift;
	my $text = shift;
	return substr($text, 0, $width - 1).'â¦' if length $text > $width;
	return $text . ' ' x ($width - length $text);
}
	$key = substr($key, 0, $indent - 2).'â¦' if defined $firstLine && length $key >= $indent;
	$key .= ' ' x ($indent - length $key);
	$o->line($o->gray($key), $firstLine);
	my $noKey = ' ' x $indent;
	for my $line (@_) { $o->line($noKey, $line); }
	return;
}
sub command {
	my $o = shift;
	 $o->line($o->bold(@_)) }
sub verbose {
	my $o = shift;
	 $o->line($o->foreground(45, @_)) if $o->{verbose} }
sub pGreen {
	my $o = shift;
	$o->p($o->green(@_));
	return;
	return;
}
sub error {
	my $o = shift;
	$o->{hasError} = 1;
	my $span = CDS::UI::Span->new(@_);
	$span->{background} = 196;
	$span->{foreground} = 15;
	$span->{bold} = 1;
	$o->line($span);
	return;
}
### Semantic formatting
sub a {
	my $o = shift;
	 $o->underlined(@_) }
sub selector {
	my $o = shift;
	my $selector = shift; die 'wrong type '.ref($selector).' for $selector' if defined $selector && ref $selector ne 'CDS::Selector';
	my $rootLabel = shift;
	my $item = $selector->document->get($selector);
	my $revision = $item->{revision} ? $o->green('  ', $o->niceDateTime($item->{revision})) : '';
	if ($selector->{id} eq 'ROOT') {
		$o->line($o->bold($rootLabel // 'Data tree'), $revision);
		$o->recordChildren($selector->record);
		$o->selectorChildren($selector);
	} else {
		my $label = $selector->label;
		my $labelText = length $label > 64 ? substr($label, 0, 64).'â¦' : $label;
		$labelText =~ s/[\x00-\x1f\x7f-\xff]/·/g;
		$o->line($o->blue($labelText), $revision);
		$o->pushIndent;
		$o->recordChildren($selector->record);
}
sub printTo {
	my $o = shift;
	my $ui = shift;
	my $parent = shift;
	if ($parent) {
		$o->{appliedForeground} = $o->{foreground} // $parent->{appliedForeground};
		$o->{appliedBackground} = $o->{background} // $parent->{appliedBackground};
		$o->{appliedBold} = $o->{bold} // $parent->{appliedBold} // 0;
		$o->{appliedUnderlined} = $o->{underlined} // $parent->{appliedUnderlined} // 0;
	} else {
		$o->{appliedForeground} = $o->{foreground};
		$o->{appliedBackground} = $o->{background};
		$o->{appliedBold} = $o->{bold} // 0;
		$o->{appliedUnderlined} = $o->{underlined} // 0;
	}
	my $style = chr(0x1b).'[0';
	$style .= ';1' if $o->{appliedBold};
	$style .= ';4' if $o->{appliedUnderlined};
	$style .= ';38;5;'.$o->{appliedForeground} if defined $o->{appliedForeground};
	$style .= ';48;5;'.$o->{appliedBackground} if defined $o->{appliedBackground};
	$style .= 'm';
( run in 1.144 second using v1.01-cache-2.11-cpan-5dc5da66d9d )