From 55883c12df9b8af11f39bf2ea6b8cf245ae5ef66 Mon Sep 17 00:00:00 2001 From: Bodo Hugo Barwich Date: Sat, 6 Nov 2021 11:20:09 +0000 Subject: [PATCH] extending documentation on MetaCPAN::Script::Mapping methods --- lib/MetaCPAN/Role/Script.pm | 6 +- lib/MetaCPAN/Script/Mapping.pm | 109 +++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 3 deletions(-) diff --git a/lib/MetaCPAN/Role/Script.pm b/lib/MetaCPAN/Role/Script.pm index c5d046d74..9da4edbf8 100644 --- a/lib/MetaCPAN/Role/Script.pm +++ b/lib/MetaCPAN/Role/Script.pm @@ -267,7 +267,7 @@ sub check_health { my $sinfo_rs = $self->es->cat->indices( h => [ 'index', 'health' ] ); - %{ $self->indices_info } = (); + $self->indices_info({}); while ( $sinfo_rs =~ /^([^[:space:]]+) +([^[:space:]]+)/gm ) { $self->indices_info->{$1} @@ -289,7 +289,7 @@ sub check_health { my $sinfo_rs = $self->es->cat->aliases( h => [ 'alias', 'index' ] ); - %{ $self->aliases_info } = (); + $self->aliases_info({}); while ( $sinfo_rs =~ /^([^[:space:]]+) +([^[:space:]]+)/gm ) { $self->aliases_info->{$1} @@ -324,7 +324,7 @@ sub await { . " : ready" }; - %{ $self->cluster_info } = ( %{ $es->info } ); + $self->cluster_info( \%{ $es->info } ); } }; diff --git a/lib/MetaCPAN/Script/Mapping.pm b/lib/MetaCPAN/Script/Mapping.pm index 4c94a73af..f06663481 100644 --- a/lib/MetaCPAN/Script/Mapping.pm +++ b/lib/MetaCPAN/Script/Mapping.pm @@ -595,6 +595,12 @@ __PACKAGE__->meta->make_immutable; __END__ +=pod + +=head1 NAME + +MetaCPAN::Script::Mapping - Script to set the index and mapping the types + =head1 SYNOPSIS # bin/metacpan mapping --show_cluster_info # show basic info about the cluster, indices and aliases @@ -615,3 +621,106 @@ __END__ This is the index mapping handling script. Used rarely, but carries the most important task of setting the index and mapping the types. + +=head1 OPTIONS + +This Script accepts the following options + +=over 4 + +=item Option C<--show_cluster_info> + +This option makes the Script show basic information about the I Cluster +and its indices and aliases. +This information has to be collected with the C Method. +On Script start-up it is empty. + + bin/metacpan mapping --show_cluster_info + +See L> + +=item Option C<--delete> + +This option makes the Script delete all indices configured in the project and re-create them emtpy. +It verifies the index integrity of the indices and aliases calling the methods +C and C. +If the C Method fails it exits the Script +with B C< 1 >. + + bin/metacpan mapping --delete + +See L> + +See L> + +See L> + +=item Option C<--all> + +This option is only effective in combination with Option C<--delete>. +It uses the information gathered by C to delete +B indices in the I Cluster. +This option is usefull to reconstruct a broken I Cluster + + bin/metacpan mapping --delete --all + +See L