diff options
Diffstat (limited to 'vespaclient/src/perl/lib/Yahoo/Vespa/ClusterState.pm')
-rw-r--r-- | vespaclient/src/perl/lib/Yahoo/Vespa/ClusterState.pm | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/vespaclient/src/perl/lib/Yahoo/Vespa/ClusterState.pm b/vespaclient/src/perl/lib/Yahoo/Vespa/ClusterState.pm new file mode 100644 index 00000000000..648f158f9db --- /dev/null +++ b/vespaclient/src/perl/lib/Yahoo/Vespa/ClusterState.pm @@ -0,0 +1,45 @@ +# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +# +# Defines structs to represent a cluster state +# +package Yahoo::Vespa::ClusterState; + +use strict; +use warnings; +use Class::Struct; + +struct( ClusterState => { + globalState => '$', # A state primitive + distributor => '%', # Index to Node map + storage => '%' # Index to Node map +}); + +struct( Node => { + group => '$', # Hierarchical group node belongs to + unit => 'State', + generated => 'State', + user => 'State', + partition => '%' +}); + +struct( Partition => { + generated => 'State', + bucketcount => '$', + doccount => '$', + totaldocsize => '$' +}); + +struct( State => { + state => '$', # A state primitive + reason => '$', # Textual reason for it to be set. + timestamp => '$', # Timestamp of the time it got set. + source => '$' # What type of state is it (unit/generated/user) +}); + +return 1; + +sub legalState { # (State) -> Bool + my ($state) = @_; + return ($state =~ /^(up|down|maintenance|retired|stopping|initializing)$/); +} + |