Configuration » History » Version 14

J. Moringen, 02/16/2012 05:53 PM
remapping -> renaming

1 1 J. Moringen
h1. Configuration
2 1 J. Moringen
3 11 J. Moringen
{{>toc}}
4 11 J. Moringen
5 1 J. Moringen
The configuration mechanism is based on the following principles:
6 13 J. Moringen
* We cannot (and do not want) to handle configuration of individual participants:
7 13 J. Moringen
** The configuration mechanism is intended to provide process-wide defaults.
8 13 J. Moringen
** Participants that require individual configurations have to be configured programmatically.
9 1 J. Moringen
* The configuration mechanism works identically across implementation languages
10 1 J. Moringen
* Configuration options are obtained from multiple configuration sources:
11 1 J. Moringen
** Configuration files
12 1 J. Moringen
** Environment variables
13 1 J. Moringen
** _Commandline options (planned)_
14 1 J. Moringen
* Configuration options are organized in a tree of name-value pairs
15 1 J. Moringen
16 1 J. Moringen
h2. Syntax and Semantics
17 1 J. Moringen
18 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@.
19 1 J. Moringen
20 8 J. Moringen
Currently the following option tree is defined (uppercase option name components are placeholders, LANGUAGE refers to the implementation language):
21 1 J. Moringen
<pre>
22 1 J. Moringen
+ qualityofservice
23 1 J. Moringen
+-- reliability                     { UNRELIABLE, RELIABLE }
24 1 J. Moringen
+-- ordering                        { UNORDERED, ORDERED }
25 1 J. Moringen
+ errorhandling
26 1 J. Moringen
+-- onhandlererror                  { LOG, PRINT, EXIT }
27 14 J. Moringen
+ renaming
28 13 J. Moringen
  TODO
29 7 J. Moringen
+ plugins
30 7 J. Moringen
+-- LANGUAGE
31 7 J. Moringen
+---- path                          list of strings
32 7 J. Moringen
+---- load                          list of strings
33 1 J. Moringen
+ transport
34 1 J. Moringen
+-- NAME
35 1 J. Moringen
+---- enabled                       bool
36 1 J. Moringen
+---- TRANSPORT_SPECIFIC_OPTION     ?
37 1 J. Moringen
+---- converter
38 7 J. Moringen
+------ LANGUAGE
39 7 J. Moringen
+-------- WIRE-SCHEMA               string
40 1 J. Moringen
+-- spread
41 1 J. Moringen
+---- host                          string
42 1 J. Moringen
+---- port                          uint
43 10 J. Moringen
+---- maxfragmentsize               uint
44 10 J. Moringen
+---- tcpnodelay                    boolean
45 1 J. Moringen
+-- inprocess
46 1 J. Moringen
</pre>
47 1 J. Moringen
48 1 J. Moringen
h2. Processing Order
49 1 J. Moringen
50 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:
51 1 J. Moringen
# Config file @${HOME}/.config/rsb.conf@
52 1 J. Moringen
# Config file @$(pwd)/rsb.conf@
53 1 J. Moringen
# Environment variables
54 1 J. Moringen
55 1 J. Moringen
h3. Example and test case
56 1 J. Moringen
57 1 J. Moringen
Consider the following situation:
58 1 J. Moringen
* Contents of @${HOME}/.config/rsb.conf@:
59 1 J. Moringen
<pre>
60 1 J. Moringen
[transport.spread]
61 1 J. Moringen
host = azurit
62 5 J. Moringen
port = 5301
63 1 J. Moringen
</pre>
64 1 J. Moringen
* Contents of @(pwd)/rsb.conf@
65 1 J. Moringen
<pre>
66 1 J. Moringen
[transport.spread]
67 1 J. Moringen
host = localhost
68 1 J. Moringen
</pre>
69 1 J. Moringen
* Environment Variables
70 5 J. Moringen
  @RSB_TRANSPORT_SPREAD_PORT='4444'@
71 1 J. Moringen
72 1 J. Moringen
This would result in the following effective option values:
73 1 J. Moringen
* @transport.spread.host = localhost@
74 1 J. Moringen
* @transport.spread.port = 4444@
75 1 J. Moringen
76 1 J. Moringen
h2. Sources
77 1 J. Moringen
78 1 J. Moringen
The following sections briefly explains the currently defined configuration sources.
79 1 J. Moringen
80 1 J. Moringen
h3. Configuration Files
81 1 J. Moringen
82 8 J. Moringen
Configuration files use the following syntax, which is similar to "INI-files":http://en.wikipedia.org/wiki/INI_file or "desktop-files":http://standards.freedesktop.org/desktop-entry-spec/latest/:
83 1 J. Moringen
* Comments are initiated by the @#@ character and extend to the end of the current line
84 1 J. Moringen
* After removing comments, all lines have to be of one of the following forms:
85 1 J. Moringen
** empty
86 1 J. Moringen
** @[NAME]@ where @NAME@ consists of alphanumeric characters and colons 
87 1 J. Moringen
** @NAME = VALUE@ where @NAME@ consists of alphanumeric characters
88 1 J. Moringen
89 1 J. Moringen
Here is an example:
90 1 J. Moringen
<pre>
91 1 J. Moringen
[qualityofservice]
92 1 J. Moringen
reliability = UNRELIABLE
93 1 J. Moringen
ordering = UNORDERED
94 1 J. Moringen
95 1 J. Moringen
[errorhandling]
96 1 J. Moringen
onhandlererror = LOG
97 1 J. Moringen
98 1 J. Moringen
[transport.spread]
99 1 J. Moringen
host    = localhost
100 4 S. Wrede
port    = 4803
101 4 S. Wrede
enabled = 1                          # this is the default
102 1 J. Moringen
103 6 J. Moringen
[spread.converter.cpp]
104 9 J. Moringen
image = IplImage                     # wire-schema = data-type
105 1 J. Moringen
106 1 J. Moringen
[transport.inprocess]
107 4 S. Wrede
foo     = barbar
108 4 S. Wrede
factor  = 1.5
109 3 S. Wrede
enabled = 1
110 1 J. Moringen
111 6 J. Moringen
[plugins.cpp]
112 3 S. Wrede
path = /vol/vampire/lib:/vol/cor/lib
113 7 J. Moringen
load = rsbspread:rsbvampire     # no filetype suffix
114 1 J. Moringen
</pre>
115 1 J. Moringen
116 12 J. Wienke
Please note that only files with the platform's respective line endings are supported (i.e. \n on linux and \r\n on windows).
117 12 J. Wienke
118 1 J. Moringen
h3. Environment Variables
119 1 J. Moringen
120 9 J. Moringen
Environment variables are processed according to the following rules:
121 1 J. Moringen
# Variables whose names start with @RSB_@ are processed
122 1 J. Moringen
# The @RSB_@ prefix is stripped form the name
123 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
124 1 J. Moringen
125 9 J. Moringen
Examples:
126 9 J. Moringen
* @RSB_PLUGINS_CPP_LOAD      <-> plugins.cpp.load@
127 9 J. Moringen
* @RSB_TRANSPORT_SPREAD_PORT <-> transport.spread.port@
128 9 J. Moringen
129 9 J. Moringen
h3. Commandline Options
130 9 J. Moringen
131 9 J. Moringen
_This section is a proposal._
132 9 J. Moringen
133 1 J. Moringen
Commandline options are processed according to the following rules:
134 13 J. Moringen
# Options whose names start with @rsb-@ are processed
135 9 J. Moringen
# Language-specific name components (such as @plugins.cpp.load@) are dropped
136 1 J. Moringen
# Components are joined with/strings are split at @-@ characters
137 1 J. Moringen
138 9 J. Moringen
Examples:
139 13 J. Moringen
* @--rsb-plugins-load          <-> plugins.cpp.load@
140 13 J. Moringen
* @--rsb-transport-spread-port <-> transport.spread.port@