Configuration » History » Version 10

J. Moringen, 05/26/2011 02:36 AM
added missing options for spread transport

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 8 J. Moringen
Currently the following option tree is defined (uppercase option name components are placeholders, LANGUAGE refers to the implementation language):
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 7 J. Moringen
+ plugins
24 7 J. Moringen
+-- LANGUAGE
25 7 J. Moringen
+---- path                          list of strings
26 7 J. Moringen
+---- load                          list of strings
27 1 J. Moringen
+ transport
28 1 J. Moringen
+-- NAME
29 1 J. Moringen
+---- enabled                       bool
30 1 J. Moringen
+---- TRANSPORT_SPECIFIC_OPTION     ?
31 1 J. Moringen
+---- converter
32 7 J. Moringen
+------ LANGUAGE
33 7 J. Moringen
+-------- WIRE-SCHEMA               string
34 1 J. Moringen
+-- spread
35 1 J. Moringen
+---- host                          string
36 1 J. Moringen
+---- port                          uint
37 10 J. Moringen
+---- maxfragmentsize               uint
38 10 J. Moringen
+---- tcpnodelay                    boolean
39 1 J. Moringen
+-- inprocess
40 1 J. Moringen
</pre>
41 1 J. Moringen
42 1 J. Moringen
h2. Processing Order
43 1 J. Moringen
44 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:
45 1 J. Moringen
# Config file @${HOME}/.config/rsb.conf@
46 1 J. Moringen
# Config file @$(pwd)/rsb.conf@
47 1 J. Moringen
# Environment variables
48 1 J. Moringen
49 1 J. Moringen
h3. Example and test case
50 1 J. Moringen
51 1 J. Moringen
Consider the following situation:
52 1 J. Moringen
* Contents of @${HOME}/.config/rsb.conf@:
53 1 J. Moringen
<pre>
54 1 J. Moringen
[transport.spread]
55 1 J. Moringen
host = azurit
56 5 J. Moringen
port = 5301
57 1 J. Moringen
</pre>
58 1 J. Moringen
* Contents of @(pwd)/rsb.conf@
59 1 J. Moringen
<pre>
60 1 J. Moringen
[transport.spread]
61 1 J. Moringen
host = localhost
62 1 J. Moringen
</pre>
63 1 J. Moringen
* Environment Variables
64 5 J. Moringen
  @RSB_TRANSPORT_SPREAD_PORT='4444'@
65 1 J. Moringen
66 1 J. Moringen
This would result in the following effective option values:
67 1 J. Moringen
* @transport.spread.host = localhost@
68 1 J. Moringen
* @transport.spread.port = 4444@
69 1 J. Moringen
70 1 J. Moringen
h2. Sources
71 1 J. Moringen
72 1 J. Moringen
The following sections briefly explains the currently defined configuration sources.
73 1 J. Moringen
74 1 J. Moringen
h3. Configuration Files
75 1 J. Moringen
76 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/:
77 1 J. Moringen
* Comments are initiated by the @#@ character and extend to the end of the current line
78 1 J. Moringen
* After removing comments, all lines have to be of one of the following forms:
79 1 J. Moringen
** empty
80 1 J. Moringen
** @[NAME]@ where @NAME@ consists of alphanumeric characters and colons 
81 1 J. Moringen
** @NAME = VALUE@ where @NAME@ consists of alphanumeric characters
82 1 J. Moringen
83 1 J. Moringen
Here is an example:
84 1 J. Moringen
<pre>
85 1 J. Moringen
[qualityofservice]
86 1 J. Moringen
reliability = UNRELIABLE
87 1 J. Moringen
ordering = UNORDERED
88 1 J. Moringen
89 1 J. Moringen
[errorhandling]
90 1 J. Moringen
onhandlererror = LOG
91 1 J. Moringen
92 1 J. Moringen
[transport.spread]
93 1 J. Moringen
host    = localhost
94 4 S. Wrede
port    = 4803
95 4 S. Wrede
enabled = 1                          # this is the default
96 1 J. Moringen
97 6 J. Moringen
[spread.converter.cpp]
98 9 J. Moringen
image = IplImage                     # wire-schema = data-type
99 1 J. Moringen
100 1 J. Moringen
[transport.inprocess]
101 4 S. Wrede
foo     = barbar
102 4 S. Wrede
factor  = 1.5
103 3 S. Wrede
enabled = 1
104 1 J. Moringen
105 6 J. Moringen
[plugins.cpp]
106 3 S. Wrede
path = /vol/vampire/lib:/vol/cor/lib
107 7 J. Moringen
load = rsbspread:rsbvampire     # no filetype suffix
108 1 J. Moringen
</pre>
109 1 J. Moringen
110 1 J. Moringen
h3. Environment Variables
111 1 J. Moringen
112 9 J. Moringen
Environment variables are processed according to the following rules:
113 1 J. Moringen
# Variables whose names start with @RSB_@ are processed
114 1 J. Moringen
# The @RSB_@ prefix is stripped form the name
115 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
116 1 J. Moringen
117 9 J. Moringen
Examples:
118 9 J. Moringen
* @RSB_PLUGINS_CPP_LOAD      <-> plugins.cpp.load@
119 9 J. Moringen
* @RSB_TRANSPORT_SPREAD_PORT <-> transport.spread.port@
120 9 J. Moringen
121 9 J. Moringen
h3. Commandline Options
122 9 J. Moringen
123 9 J. Moringen
_This section is a proposal._
124 9 J. Moringen
125 9 J. Moringen
Commandline options are processed according to the following rules:
126 9 J. Moringen
# Language-specific name components (such as @plugins.cpp.load@) are dropped
127 9 J. Moringen
# Components are joined with/strings are split at @-@ characters
128 9 J. Moringen
129 9 J. Moringen
Examples:
130 9 J. Moringen
* @--plugins-load          <-> plugins.cpp.load@
131 9 J. Moringen
* @--transport-spread-port <-> transport.spread.port@