Class: Msf::RPC::RpcJobStatusTracker
- Inherits:
-
Object
- Object
- Msf::RPC::RpcJobStatusTracker
show all
- Includes:
- MonitorMixin
- Defined in:
- lib/msf/core/rpc/v10/rpc_job_status_tracker.rb
Defined Under Namespace
Classes: ResultsMemoryStore
Instance Method Summary
collapse
Constructor Details
Returns a new instance of RpcJobStatusTracker.
9
10
11
12
13
14
15
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 9
def initialize
super
@ready = Set.new
@running = Set.new
@results = ResultsMemoryStore.new
end
|
Instance Method Details
#completed(id, result, mod) ⇒ Object
30
31
32
33
34
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 30
def completed(id, result, mod)
synchronize do
add_result(id, { result: result }, mod)
end
end
|
#data ⇒ Object
93
94
95
96
97
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 93
def data
synchronize do
results.data
end
end
|
#delete(id) ⇒ Object
Also known as:
ack
69
70
71
72
73
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 69
def delete(id)
synchronize do
results.delete(id)
end
end
|
#failed(id, error, mod) ⇒ Object
36
37
38
39
40
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 36
def failed(id, error, mod)
synchronize do
add_result(id, { error: error.to_s }, mod)
end
end
|
#finished?(id) ⇒ Boolean
54
55
56
57
58
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 54
def finished?(id)
synchronize do
results.exist? id
end
end
|
#result(id) ⇒ Object
60
61
62
63
64
65
66
67
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 60
def result(id)
synchronize do
result = results.fetch(id)
return unless result
::JSON.parse(result).with_indifferent_access
end
end
|
#result_ids ⇒ Object
75
76
77
78
79
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 75
def result_ids
synchronize do
results.keys
end
end
|
#running?(id) ⇒ Boolean
42
43
44
45
46
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 42
def running?(id)
synchronize do
running.include? id
end
end
|
#running_ids ⇒ Object
87
88
89
90
91
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 87
def running_ids
synchronize do
running.to_a
end
end
|
#start(id) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 23
def start(id)
synchronize do
running << id
ready.delete(id)
end
end
|
#waiting(id) ⇒ Object
17
18
19
20
21
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 17
def waiting(id)
synchronize do
ready << id
end
end
|
#waiting?(id) ⇒ Boolean
48
49
50
51
52
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 48
def waiting?(id)
synchronize do
ready.include? id
end
end
|
#waiting_ids ⇒ Object
81
82
83
84
85
|
# File 'lib/msf/core/rpc/v10/rpc_job_status_tracker.rb', line 81
def waiting_ids
synchronize do
ready.to_a
end
end
|