Configuration » History » Version 4

S. Wrede, 05/19/2011 03:04 PM

1 1 J. Moringen
h1. Configuration
2 1 J. Moringen
3 1 J. Moringen
The configuration mechanism is based on the following principles:
4 2 J. Moringen
* We cannot (and do not want) to handle configuration of individual participants. The configuration mechanism is intended to provide process-wide defaults. Participants that require individual configurations have to be configured programmatically.
5 1 J. Moringen
* The configuration mechanism works identically across implementation languages
6 1 J. Moringen
* Configuration options are obtained from multiple configuration sources:
7 1 J. Moringen
** Configuration files
8 1 J. Moringen
** Environment variables
9 1 J. Moringen
** _Commandline options (planned)_
10 1 J. Moringen
* Configuration options are organized in a tree of name-value pairs
11 1 J. Moringen
12 1 J. Moringen
h2. Syntax and Semantics
13 1 J. Moringen
14 1 J. Moringen
Option names consist of multiple components which are specified in configuration-source-dependent syntax. For example, in configuration files section names like @[transport.spread]@ are concatenated with names of contained options like @port@ to obtain @transport.spread.port@. For environment variables, the name @RSB_TRANSPORT_SPREAD_PORT@ maps to @transport.spread.port@.
15 1 J. Moringen
16 1 J. Moringen
Currently the following option tree is defined (uppercase option name components are placeholders):
17 1 J. Moringen
<pre>
18 1 J. Moringen
+ qualityofservice
19 1 J. Moringen
+-- reliability                     { UNRELIABLE, RELIABLE }
20 1 J. Moringen
+-- ordering                        { UNORDERED, ORDERED }
21 1 J. Moringen
+ errorhandling
22 1 J. Moringen
+-- onhandlererror                  { LOG, PRINT, EXIT }
23 1 J. Moringen
+ transport
24 1 J. Moringen
+-- NAME
25 1 J. Moringen
+---- enabled                       bool
26 1 J. Moringen
+---- TRANSPORT_SPECIFIC_OPTION     ?
27 1 J. Moringen
+---- converter
28 1 J. Moringen
+------ WIRE-SCHEMA                 string
29 1 J. Moringen
+-- spread
30 1 J. Moringen
+---- host                          string
31 1 J. Moringen
+---- port                          uint
32 1 J. Moringen
+-- inprocess
33 1 J. Moringen
</pre>
34 1 J. Moringen
35 1 J. Moringen
h2. Processing Order
36 1 J. Moringen
37 1 J. Moringen
Configuration sources are processed in the following order such that options from sources which are processed later take precedence over options from sources which are processed earlier:
38 1 J. Moringen
# Config file @${HOME}/.config/rsb.conf@
39 1 J. Moringen
# Config file @$(pwd)/rsb.conf@
40 1 J. Moringen
# Environment variables
41 1 J. Moringen
42 1 J. Moringen
h3. Example and test case
43 1 J. Moringen
44 1 J. Moringen
Consider the following situation:
45 1 J. Moringen
* Contents of @${HOME}/.config/rsb.conf@:
46 1 J. Moringen
<pre>
47 1 J. Moringen
[transport.spread]
48 1 J. Moringen
host = azurit
49 1 J. Moringen
port = <uint>5301
50 1 J. Moringen
</pre>
51 1 J. Moringen
* Contents of @(pwd)/rsb.conf@
52 1 J. Moringen
<pre>
53 1 J. Moringen
[transport.spread]
54 1 J. Moringen
host = localhost
55 1 J. Moringen
</pre>
56 1 J. Moringen
* Environment Variables
57 1 J. Moringen
  @RSB_TRANSPORT_SPREAD_PORT='<unit>4444'@
58 1 J. Moringen
59 1 J. Moringen
This would result in the following effective option values:
60 1 J. Moringen
* @transport.spread.host = localhost@
61 1 J. Moringen
* @transport.spread.port = 4444@
62 1 J. Moringen
63 1 J. Moringen
h2. Sources
64 1 J. Moringen
65 1 J. Moringen
The following sections briefly explains the currently defined configuration sources.
66 1 J. Moringen
67 1 J. Moringen
h3. Configuration Files
68 1 J. Moringen
69 1 J. Moringen
Configuration files use the following syntax, which is similar to INI-files or desktop-files:
70 1 J. Moringen
* Comments are initiated by the @#@ character and extend to the end of the current line
71 1 J. Moringen
* After removing comments, all lines have to be of one of the following forms:
72 1 J. Moringen
** empty
73 1 J. Moringen
** @[NAME]@ where @NAME@ consists of alphanumeric characters and colons 
74 1 J. Moringen
** @NAME = VALUE@ where @NAME@ consists of alphanumeric characters
75 1 J. Moringen
76 1 J. Moringen
Here is an example:
77 1 J. Moringen
<pre>
78 1 J. Moringen
[qualityofservice]
79 1 J. Moringen
reliability = UNRELIABLE
80 1 J. Moringen
ordering = UNORDERED
81 1 J. Moringen
82 1 J. Moringen
[errorhandling]
83 1 J. Moringen
onhandlererror = LOG
84 1 J. Moringen
85 1 J. Moringen
[transport.spread]
86 1 J. Moringen
host    = localhost
87 4 S. Wrede
port    = 4803
88 4 S. Wrede
enabled = 1                          # this is the default
89 1 J. Moringen
90 3 S. Wrede
[spread.converter.c++]
91 4 S. Wrede
image = IplImage                     # wireSchema = dataType
92 1 J. Moringen
93 1 J. Moringen
[transport.inprocess]
94 1 J. Moringen
foo     = barbar
95 4 S. Wrede
factor  = 1.5
96 4 S. Wrede
enabled = 1
97 3 S. Wrede
98 3 S. Wrede
[plugins.c++]
99 3 S. Wrede
path = /vol/vampire/lib:/vol/cor/lib
100 4 S. Wrede
libraries = rsbspread:rsbvampire     # no filetype suffix
101 1 J. Moringen
</pre>
102 1 J. Moringen
103 1 J. Moringen
h3. Environment Variables
104 1 J. Moringen
105 1 J. Moringen
Environment variables are processed according to the following rules
106 1 J. Moringen
# Variables whose names start with @RSB_@ are processed
107 1 J. Moringen
# The @RSB_@ prefix is stripped form the name
108 1 J. Moringen
# To obtain the name of the corresponding option, the remainder of the name is converted to lower case and split at @_@ characters
109 1 J. Moringen
110 1 J. Moringen
Example:
111 1 J. Moringen
@RSB_TRANSPORT_SPREAD_PORT -> transport.spread.port@