Skip to content

Commit c533d23

Browse files
committed
updates for beta 3
1 parent 806edd8 commit c533d23

File tree

1 file changed

+58
-24
lines changed

1 file changed

+58
-24
lines changed

README.md

Lines changed: 58 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,57 +53,91 @@ v1.0-beta.1 - 2014-01-17
5353
To use StatefulProcessCommandProxy the constructor takes one parameter which is a configuration object who's properties are described below. Please refer to the example (following) and the unit-test for more details.
5454

5555
```
56-
name: The name of this instance, arbitrary
57-
58-
max: maximum number of processes to maintain
59-
60-
min: minimum number of processes to maintain
61-
62-
idleTimeoutMS: idle in milliseconds by which a process will be destroyed
63-
56+
name: The name of this instance, arbitrary
57+
58+
max: maximum number of processes to maintain
59+
60+
min: minimum number of processes to maintain
61+
62+
idleTimeoutMS: idle in milliseconds by which a process will be destroyed
63+
6464
processCommand: full path to the actual process to be spawned (i.e. /bin/bash)
65-
65+
6666
processArgs: arguments to pass to the process command
67-
68-
processRetainMaxCmdHistory: default 0, for each process spawned, the maximum number
67+
68+
processRetainMaxCmdHistory: for each process spawned, the maximum number
6969
of command history objects to retain in memory
70-
(useful for debugging via the getStatus() method)
71-
70+
(useful for debugging), default 0
71+
7272
processInvalidateOnRegex: optional config of regex patterns who if match
7373
their respective type, will flag the process as invalid
74-
7574
{
7675
'any' : ['regex1', ....],
7776
'stdout' : ['regex1', ....],
7877
'stderr' : ['regex1', ....]
7978
}
80-
79+
80+
processCmdBlacklistRegex: optional config array regex patterns who if match the
81+
command requested to be executed will be rejected
82+
with an error
83+
[ 'regex1', 'regex2'...]
84+
8185
processCwd: optional current working directory for the processes to be spawned
82-
86+
8387
processEnvMap: optional hash/object of key-value pairs for environment variables
8488
to set for the spawned processes
85-
89+
8690
processUid: optional uid to launch the processes as
87-
91+
8892
processGid: optional gid to launch the processes as
89-
93+
9094
logFunction: optional function that should have the signature
9195
(severity,origin,message), where log messages will
9296
be sent to. If null, logs will just go to console
93-
97+
9498
initCommands: optional array of actual commands to execute on each newly
9599
spawned ProcessProxy in the pool before it is made available
96-
100+
97101
preDestroyCommands: optional array of actual commands to execute on a process
98102
before it is killed/destroyed on shutdown or being invalid
99-
103+
100104
validateFunction: optional function that should have the signature to accept
101105
a ProcessProxy object, and should return true/false if the
102106
process is valid or not, at a minimum this should call
103107
ProcessProxy.isValid(). If the function is not provided
104108
the default behavior is to only check ProcessProxy.isValid()
105-
which is sufficient for most use cases if 'processInvalidateOnRegex'
106-
is properly configured
109+
110+
autoInvalidationConfig optional configuration that will run the specified
111+
commands in the background on the given interval,
112+
and if the given regexes match/do-not-match for each command the
113+
ProcessProxy will be flagged as invalid and return FALSE
114+
on calls to isValid(). The commands will be run in
115+
order sequentially via executeCommands()
116+
{
117+
checkIntervalMS: 30000; // check every 30s
118+
commands:
119+
[
120+
{ command:'cmd1toRun',
121+
122+
// OPTIONAL: because you can configure multiple commands
123+
// where the first ones doe some prep, then the last one's
124+
// output needs to be evaluated hence 'regexes' may not
125+
// always be present, (but your LAST command must have a
126+
// regexes config to eval prior work, otherwise whats the point
127+
128+
regexes: {
129+
// at least one key must be specified
130+
// 'any' means either stdout or stderr
131+
// for each regex, the 'on' property dictates
132+
// if the process will be flagged invalid based
133+
// on the results of the regex evaluation
134+
'any' : [ {regex:'regex1', invalidOn:'match | noMatch'}, ....],
135+
'stdout' : [ {regex:'regex1', invalidOn:'match | noMatch'}, ....],
136+
'stderr' : [ {regex:'regex1', invalidOn:'match | noMatch'}, ....]
137+
}
138+
},...
139+
]
140+
}
107141
```
108142

109143
Its highly recommended you check out the unit-tests for some examples in addition to the below:

0 commit comments

Comments
 (0)