-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconstants.js
103 lines (90 loc) · 2.06 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
module.exports = Constants
function Constants(params = {}){
const { constants = {} } = require('minimist')(process.argv)
merge(this, defaults, constants, params) // TODO should merge top level one by one
}
const { pow } = Math
, merge = require('lodash.merge')
, defaults = {
dht: {
vnodes: 200
}
, connect: {
wait: 3000
}
, retries: {
base : 100
, max : 5
, cap : 60000
, jitter: 0.5
}
, connections: {
timeout: 10000
, jitter: 200
, max: {
server: Infinity
, client: 1
}
}
, multicast: {
type: 'udp'
, ip: '224.0.0.251'
, host: '127.0.0.1'
, port: 3130
, ttl: 128
, jitter: 2000
, retry: false
, monitor: true
}
, types: {
0x1: 'string'
, 0x2: 'number'
, 0x3: 'json'
, 0x4: 'boolean'
, 0x5: 'undefined'
, 'string' : 0x1
, 'number' : 0x2
, 'json' : 0x3
, 'boolean' : 0x4
, 'undefined': 0x5
}
, change: {
0x1: 'update'
, 0x2: 'remove'
, 0x3: 'add'
, 0x4: 'subscribe'
, 0x5: 'stop'
, 'update' : 0x1
, 'remove' : 0x2
, 'add' : 0x3
, 'subscribe' : 0x4
, 'stop' : 0x5
}
, commands: {
init : 1 << 0
, sync : 1 << 1
, done : 1 << 2
, proxy : 1 << 3
, commit : 1 << 4
, ack : 1 << 5
, reply : 1 << 6
, [1 << 0]: 'init'
, [1 << 1]: 'sync'
, [1 << 2]: 'done'
, [1 << 3]: 'proxy'
, [1 << 4]: 'commit'
, [1 << 5]: 'ack'
, [1 << 6]: 'reply'
}
, partitions: {
history: {
max: Infinity
}
}
, hosts: ['127.0.0.1']
, ports: []
, outbox: {
max: pow(2, 16)
, frag: pow(2, 16)
}
}