-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrouting.rb
63 lines (59 loc) · 2.2 KB
/
routing.rb
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
module Roma
class Routing
attr_accessor :redundant
attr_accessor :nodes
attr_accessor :primary
attr_accessor :secondary1
attr_accessor :secondary2
attr_accessor :short_vnodes
attr_accessor :lost_vnodes
attr_accessor :lost_action
attr_accessor :auto_recover
attr_accessor :auto_recover_status
attr_accessor :auto_recover_time
attr_accessor :event
attr_accessor :version_of_nodes
def initialize
@redundant = 3
@nodes = ["localhost_10001", "localhost_10002", "localhost_10003", "localhost_10004", "localhost_10005"]
@primary = 152
@secondary1 = 106
@secondary2 = 133
@short_vnodes = 0
@lost_vnodes = 0
@lost_action=:auto_assign
@auto_recover=false
@auto_recover_status="waiting"
@auto_recover_time=1800
@event = []
@version_of_nodes = {"localhost_10001"=>66304, "localhost_10002"=>66304, "localhost_10003"=>66304, "localhost_10004"=>66304, "localhost_10005"=>66304}
end
def get_stat()
ret = {}
ret['routing.redundant'] = 3
ret['routing.nodes.length'] = @nodes.length
ret['routing.nodes'] = @nodes
ret['routing.dgst_bits'] = 32
ret['routing.div_bits'] = 9
ret['routing.vnodes.length'] = 512
ret['routing.primary'] = @primary
ret['routing.secondary1'] = @secondary1
ret['routing.secondary2'] = @secondary2
ret['routing.short_vnodes'] = @short_vnodes
ret['routing.lost_vnodes'] = @lost_vnodes
ret['routing.fail_cnt_threshold'] = 15
ret['routing.fail_cnt_gap'] = 0
ret['routing.sub_nid'] = {}
ret['routing.lost_action'] = @lost_action
ret['routing.auto_recover'] = @auto_recover
ret['routing.auto_recover_status'] = @auto_recover_status
ret['routing.auto_recover_time'] = @auto_recover_time
ret['routing.event'] = @event
ret['routing.event_limit_line'] = 1000
ret['routing.version_of_nodes'] = @version_of_nodes
ret['routing.min_version'] = 66048
ret['routing.enabled_failover'] = true
ret
end
end # End of class Routing
end # End of module Roma