1GENDLIB(3)                          GENDLIB                         GENDLIB(3)
2
3
4

NAME

6       gendlib - perl library for querying genders file
7

SYNOPSIS

9       require ``/usr/lib/genders/gendlib.pl'';
10

DESCRIPTION

12       This  package  contains  common  functions for manipulating the genders
13       file.  Previously this code existed only in the nodeattr  command,  but
14       applications  that  must  repeatedly  call nodeattr would spend a great
15       deal of time reading and parsing the  genders  file.   These  functions
16       create  an  in-memory  cache  of genders on the first call;  subsequent
17       calls need only reference the in-memory copy and are thus speeded up.
18
19       Initialization:
20
21       Genders::init([$path_genders])
22
23              Function normally called internally for initialization.  It  can
24              be  called  externally  with a non-default genders file path and
25              subsequent operations will use this non-default  data.   May  be
26              called more than once to change genders file.
27
28       Simple Queries:
29
30       Genders::hasattr($attribute, [$node])
31
32              Return 1 if node has attribute, 0 if not.  If node is not speci‐
33              fied, use local node.
34
35       Genders::getattrval($attribute, [$node])
36
37              Return value of attribute held by node, or empty  string  if  no
38              value  or  node  does not have attribute.  If node is not speci‐
39              fied, use local node.
40
41       Genders::getnode([$attribute])
42
43              Return a list of nodes having the  specified  attribute.   If  a
44              value is also specified ("attr=val"), only nodes with the speci‐
45              fied attribute and value are returned.  If no attribute is spec‐
46              ified, getnode returns all the nodes listed in the genders file.
47
48       Genders::getattr([$node])
49
50              Return a list of attributes held by node.  If node is not speci‐
51              fied, use local node.
52
53       Complex Queries:
54
55       Genders::getallattr()
56
57              Return a list of all attributes in the genders file (one cluster
58              only).
59
60       Genders::get_node_hash(\%node)
61
62              Get  a  copy of hash of attributes to node lists for the current
63              cluster (a "hash of lists").  Ensure that  keys  exist  for  all
64              possible  attributes  across  clusters (though they may point to
65              empty lists).
66
67       Genders::get_clusters()
68
69              Return a list with the local cluster name as the first and  only
70              element.   get_clusters() returns a list instead of a scalar for
71              backwards compatability.  If  the  local  cluster  name  is  not
72              known, null is returned.
73
74       Genders::gendexp($exp, [$node])
75
76              Evaluate  expression involving genders attributes and return the
77              result of  the  evaluation.   Any  legal  perl  expresion  using
78              numeric  constants, genders attributes (which are converted into
79              $variables), and the following operators is valid:  !,  ||,  &&,
80              *, +, -, /.  If $node is not specified, assume the local host.
81
82       Conversion:
83
84       Genders::to_altnames()
85
86              Given  a  list  of hostnames as they appear in the genders file,
87              return a list of alternate names.  On the SP, genders names  are
88              assumed  to be the initial_hostnames, and we use the SDR to con‐
89              vert to reliable_hostnames.  On other systems, we look  for  the
90              value  of  the  altname  attribute  in the genders file.  If the
91              input hostname cannot be converted, it is preserved in the  out‐
92              put.
93
94       Genders::to_gendnames()
95
96              Performs  the  inverse of the to_altnames() function.  Just like
97              to_altnames(), an input hostname is preserved in the  output  if
98              it cannot be converted.
99

SEE ALSO

101       nodeattr(1), libgenders(3), Libgenders(3)
102
103
104
105LLNL                               10/10/97                         GENDLIB(3)
Impressum