blob: 648f158f9dbefab4742eed42cac08671524c743b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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)$/);
}
|