gossiperl_client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +151 -0
- data/gossiperl_client.gemspec +44 -0
- data/lib/gossiperl_client.rb +5 -0
- data/lib/gossiperl_client/encryption/aes256.rb +44 -0
- data/lib/gossiperl_client/headers.rb +46 -0
- data/lib/gossiperl_client/messaging.rb +120 -0
- data/lib/gossiperl_client/overlay_worker.rb +73 -0
- data/lib/gossiperl_client/requirements.rb +15 -0
- data/lib/gossiperl_client/resolution.rb +38 -0
- data/lib/gossiperl_client/serialization/serializer.rb +128 -0
- data/lib/gossiperl_client/state.rb +73 -0
- data/lib/gossiperl_client/supervisor.rb +81 -0
- data/lib/gossiperl_client/thrift/gossiperl_constants.rb +15 -0
- data/lib/gossiperl_client/thrift/gossiperl_types.rb +378 -0
- data/lib/gossiperl_client/transport/udp.rb +52 -0
- data/lib/gossiperl_client/util/validation.rb +37 -0
- data/lib/gossiperl_client/version.rb +9 -0
- data/tests/process_tests.rb +63 -0
- data/tests/thrift_tests.rb +45 -0
- metadata +129 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
require 'logger'
|
3
|
+
module Gossiperl
|
4
|
+
module Client
|
5
|
+
class OverlayWorker < Gossiperl::Client::Resolution
|
6
|
+
|
7
|
+
field :options, Hash
|
8
|
+
field :supervisor, Gossiperl::Client::Supervisor
|
9
|
+
field :messaging, Gossiperl::Client::Messaging
|
10
|
+
field :state, Gossiperl::Client::State
|
11
|
+
field :working, [FalseClass,TrueClass]
|
12
|
+
field :logger, Logger
|
13
|
+
|
14
|
+
def initialize supervisor, options, block
|
15
|
+
raise ArgumentError.new('Supervisor must be of type Supervisor.') unless supervisor.is_a?(::Gossiperl::Client::Supervisor)
|
16
|
+
raise ArgumentError.new('Callback must be a Proc / block.') unless block.nil? or block.is_a?(Proc)
|
17
|
+
::Gossiperl::Client::Util::Validation.validate_connect( options )
|
18
|
+
self.supervisor = supervisor
|
19
|
+
self.options = options
|
20
|
+
self.working = true
|
21
|
+
@callback_block = block
|
22
|
+
if options.has_key?(:logger)
|
23
|
+
self.logger - options[:logger]
|
24
|
+
else
|
25
|
+
self.logger = Logger.new(STDOUT)
|
26
|
+
self.logger.level = Logger::DEBUG
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def start
|
31
|
+
self.messaging = Gossiperl::Client::Messaging.new(self)
|
32
|
+
self.state = Gossiperl::Client::State.new(self)
|
33
|
+
[self.messaging.start, self.state.start].each {|worker|
|
34
|
+
worker.join
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def stop
|
39
|
+
self.messaging.digest_exit
|
40
|
+
while self.state.connected
|
41
|
+
sleep 0.1
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def current_state
|
46
|
+
return :connected if self.state.connected
|
47
|
+
return :disconnected
|
48
|
+
end
|
49
|
+
|
50
|
+
def process_event event
|
51
|
+
unless @callback_block.nil?
|
52
|
+
self.instance_exec event.merge( { :options => self.options } ), &@callback_block
|
53
|
+
else
|
54
|
+
self.logger.info("[#{self.options[:client_name]}] Processing event: #{event}.")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def subscribe event_types
|
59
|
+
self.state.subscribe event_types
|
60
|
+
end
|
61
|
+
|
62
|
+
def unsubscribe event_types
|
63
|
+
self.state.unsubscribe event_types
|
64
|
+
end
|
65
|
+
|
66
|
+
def send digest_type, digest_data
|
67
|
+
serialized = self.messaging.transport.serializer.serialize_arbitrary( digest_type, digest_data )
|
68
|
+
self.messaging.send serialized
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
%w[
|
3
|
+
headers
|
4
|
+
resolution
|
5
|
+
encryption/aes256.rb
|
6
|
+
serialization/serializer.rb
|
7
|
+
thrift/gossiperl_types.rb
|
8
|
+
util/validation.rb
|
9
|
+
transport/udp.rb
|
10
|
+
messaging.rb
|
11
|
+
overlay_worker.rb
|
12
|
+
state.rb
|
13
|
+
supervisor.rb
|
14
|
+
version.rb
|
15
|
+
].each { |req| require "#{File.expand_path(File.dirname(__FILE__))}/#{req}" }
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
module Gossiperl
|
3
|
+
module Client
|
4
|
+
class Resolution
|
5
|
+
|
6
|
+
UNDEFINED_VALUE = 'GOSSIPERL_UNDEFINED_VALUE'
|
7
|
+
|
8
|
+
def self.field(name, types, default_value=Resolution::UNDEFINED_VALUE)
|
9
|
+
name = name.to_s
|
10
|
+
define_method("#{name}=") do |value|
|
11
|
+
if value.nil?
|
12
|
+
type_matched = true
|
13
|
+
else
|
14
|
+
type_matched = false
|
15
|
+
types = [types] unless types.is_a? Array
|
16
|
+
types.each do |type|
|
17
|
+
type_matched = true if value.is_a? type and not type_matched
|
18
|
+
end
|
19
|
+
end
|
20
|
+
if type_matched
|
21
|
+
self.instance_variable_set("@#{name}", value)
|
22
|
+
else
|
23
|
+
raise ArgumentError, "Invalid argument value type for #{name}. Required one of #{types.inspect}, received #{value.class}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
define_method("#{name}") do
|
28
|
+
if default_value != Resolution::UNDEFINED_VALUE
|
29
|
+
self.instance_variable_set("@#{name}", default_value) unless self.instance_variable_defined? "@#{name}"
|
30
|
+
end
|
31
|
+
self.instance_variable_get("@#{name}")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
require 'thrift'
|
3
|
+
module Gossiperl
|
4
|
+
module Client
|
5
|
+
module Serialization
|
6
|
+
class Serializer
|
7
|
+
include ::Thrift::Struct_Union
|
8
|
+
|
9
|
+
def serialize_arbitrary digest_type, digest_data
|
10
|
+
transport = ::Thrift::MemoryBufferTransport.new()
|
11
|
+
protocol = ::Thrift::BinaryProtocol.new(transport)
|
12
|
+
protocol.write_struct_begin(digest_type.to_s)
|
13
|
+
digest_data.each_key{|key|
|
14
|
+
value = digest_data[key][:value]
|
15
|
+
type = self.type_to_thrift_type( digest_data[key][:type] )
|
16
|
+
unless value.nil?
|
17
|
+
if is_container? type
|
18
|
+
protocol.write_field_begin(key.to_s, digest_data[key][:value], digest_data[key][:field_id])
|
19
|
+
write_container( protocol, value, { :type => type, :name => key.to_s } )
|
20
|
+
protocol.write_field_end
|
21
|
+
else
|
22
|
+
protocol.write_field({ :type => type, :name => key.to_s }, digest_data[key][:field_id], value )
|
23
|
+
end
|
24
|
+
end
|
25
|
+
}
|
26
|
+
protocol.write_field_stop
|
27
|
+
protocol.write_struct_end
|
28
|
+
|
29
|
+
envelope = Gossiperl::Client::Thrift::DigestEnvelope.new
|
30
|
+
envelope.payload_type = digest_type.to_s
|
31
|
+
envelope.bin_payload = protocol.trans.read( protocol.trans.available ).force_encoding('UTF-8')
|
32
|
+
envelope.id = SecureRandom.uuid.to_s
|
33
|
+
self.digest_to_binary( envelope )
|
34
|
+
end
|
35
|
+
|
36
|
+
def serialize digest
|
37
|
+
digest_type = digest.class.name.split('::').last
|
38
|
+
digest_type = digest_type[0].downcase + digest_type[1..digest_type.length]
|
39
|
+
if digest_type == 'digestEnvelope'
|
40
|
+
return self.digest_to_binary( envelope )
|
41
|
+
end
|
42
|
+
envelope = Gossiperl::Client::Thrift::DigestEnvelope.new
|
43
|
+
envelope.payload_type = digest_type
|
44
|
+
envelope.bin_payload = self.digest_to_binary( digest )
|
45
|
+
envelope.id = SecureRandom.uuid.to_s
|
46
|
+
self.digest_to_binary( envelope )
|
47
|
+
end
|
48
|
+
|
49
|
+
def deserialize bin_digest
|
50
|
+
envelope_resp = self.digest_from_binary('digestEnvelope', bin_digest)
|
51
|
+
if envelope_resp.has_key?(:ok)
|
52
|
+
embedded_type = self.digest_type_class( envelope_resp[:ok].payload_type )
|
53
|
+
if embedded_type == :forward
|
54
|
+
return { :forward => true,
|
55
|
+
:type => envelope_resp[:ok].payload_type,
|
56
|
+
:envelope => envelope_resp[:ok] }
|
57
|
+
else
|
58
|
+
payload = digest_from_binary(envelope_resp[:ok].payload_type, envelope_resp[:ok].bin_payload)
|
59
|
+
if payload.has_key?(:ok)
|
60
|
+
return payload[:ok]
|
61
|
+
else
|
62
|
+
return { :error => :not_thrift }
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
return { :error => :not_thrift }
|
67
|
+
end
|
68
|
+
|
69
|
+
def digest_to_binary digest
|
70
|
+
transport = ::Thrift::MemoryBufferTransport.new()
|
71
|
+
protocol = ::Thrift::BinaryProtocol.new(transport)
|
72
|
+
digest.write( protocol )
|
73
|
+
protocol.trans.read( protocol.trans.available ).force_encoding('UTF-8')
|
74
|
+
end
|
75
|
+
|
76
|
+
def digest_from_binary digest_type, bin_digest
|
77
|
+
begin
|
78
|
+
transport = ::Thrift::MemoryBufferTransport.new( bin_digest )
|
79
|
+
protocol = ::Thrift::BinaryProtocol.new(transport)
|
80
|
+
digest = self.digest_type_class(digest_type).new
|
81
|
+
digest.read( protocol )
|
82
|
+
return { :ok => digest }
|
83
|
+
rescue Exception => ex
|
84
|
+
return { :error => ex }
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def digest_type_class digest_type
|
89
|
+
types = {
|
90
|
+
'digestError' => Gossiperl::Client::Thrift::DigestError,
|
91
|
+
'digestForwardedAck' => Gossiperl::Client::Thrift::DigestForwardedAck,
|
92
|
+
'digestEnvelope' => Gossiperl::Client::Thrift::DigestEnvelope,
|
93
|
+
'digest' => Gossiperl::Client::Thrift::Digest,
|
94
|
+
'digestAck' => Gossiperl::Client::Thrift::DigestAck,
|
95
|
+
'digestSubscriptions' => Gossiperl::Client::Thrift::DigestSubscriptions,
|
96
|
+
'digestExit' => Gossiperl::Client::Thrift::DigestExit,
|
97
|
+
'digestSubscribe' => Gossiperl::Client::Thrift::DigestSubscribe,
|
98
|
+
'digestSubscribeAck' => Gossiperl::Client::Thrift::DigestSubscribeAck,
|
99
|
+
'digestUnsubscribe' => Gossiperl::Client::Thrift::DigestUnsubscribe,
|
100
|
+
'digestUnsubscribeAck' => Gossiperl::Client::Thrift::DigestUnsubscribeAck,
|
101
|
+
'digestEvent' => Gossiperl::Client::Thrift::DigestEvent
|
102
|
+
}
|
103
|
+
return types[ digest_type ] if types.has_key? digest_type
|
104
|
+
return :forward
|
105
|
+
end
|
106
|
+
|
107
|
+
def type_to_thrift_type type
|
108
|
+
return ({
|
109
|
+
:stop => ::Thrift::Types::STOP,
|
110
|
+
:void => ::Thrift::Types::VOID,
|
111
|
+
:bool => ::Thrift::Types::BOOL,
|
112
|
+
:byte => ::Thrift::Types::BYTE,
|
113
|
+
:double => ::Thrift::Types::DOUBLE,
|
114
|
+
:i16 => ::Thrift::Types::I16,
|
115
|
+
:i32 => ::Thrift::Types::I32,
|
116
|
+
:i64 => ::Thrift::Types::I64,
|
117
|
+
:string => ::Thrift::Types::STRING,
|
118
|
+
:struct => ::Thrift::Types::STRUCT,
|
119
|
+
:map => ::Thrift::Types::MAP,
|
120
|
+
:set => ::Thrift::Types::SET,
|
121
|
+
:list => ::Thrift::Types::LIST,
|
122
|
+
})[ type.to_sym ]
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
require 'securerandom'
|
3
|
+
module Gossiperl
|
4
|
+
module Client
|
5
|
+
class State < Gossiperl::Client::Resolution
|
6
|
+
|
7
|
+
field :worker, Gossiperl::Client::OverlayWorker
|
8
|
+
field :connected, [TrueClass,FalseClass], false
|
9
|
+
field :last_ts, Fixnum
|
10
|
+
field :subscriptions, Array, []
|
11
|
+
|
12
|
+
def initialize worker
|
13
|
+
self.worker = worker
|
14
|
+
end
|
15
|
+
|
16
|
+
def start
|
17
|
+
sleep 1
|
18
|
+
self.last_ts = Time.now.to_i
|
19
|
+
Thread.new(self) do |state|
|
20
|
+
while state.worker.working
|
21
|
+
state.send_digest
|
22
|
+
sleep 2
|
23
|
+
if Time.now.to_i - state.last_ts > 5
|
24
|
+
if self.connected
|
25
|
+
# Announce disconnected
|
26
|
+
state.worker.process_event( { :event => :disconnected } )
|
27
|
+
self.connected = false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
state.worker.process_event( { :event => :disconnected } )
|
32
|
+
self.connected = false
|
33
|
+
state.worker.logger.info("Stopping state service for client #{state.worker.options[:client_name]}.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def receive digest_ack
|
38
|
+
unless self.connected
|
39
|
+
# Announce connected
|
40
|
+
self.worker.process_event( { :event => :connected } )
|
41
|
+
self.worker.messaging.digest_subscribe( self.subscriptions ) if self.subscriptions.length > 0
|
42
|
+
end
|
43
|
+
self.connected = true
|
44
|
+
self.last_ts = digest_ack.heartbeat
|
45
|
+
end
|
46
|
+
|
47
|
+
def send_digest
|
48
|
+
digest = Gossiperl::Client::Thrift::Digest.new
|
49
|
+
digest.name = self.worker.options[:client_name].to_s
|
50
|
+
digest.port = self.worker.options[:client_port]
|
51
|
+
digest.heartbeat = Time.now.to_i
|
52
|
+
digest.id = SecureRandom.uuid.to_s
|
53
|
+
digest.secret = self.worker.options[:client_secret].to_s
|
54
|
+
self.worker.messaging.send digest
|
55
|
+
end
|
56
|
+
|
57
|
+
def subscribe event_types
|
58
|
+
::Gossiperl::Client::Util::Validation.validate_event_types( event_types )
|
59
|
+
self.subscriptions = self.subscriptions + event_types
|
60
|
+
self.worker.messaging.digest_subscribe(event_types) if self.connected
|
61
|
+
return self.subscriptions
|
62
|
+
end
|
63
|
+
|
64
|
+
def unsubscribe event_types
|
65
|
+
::Gossiperl::Client::Util::Validation.validate_event_types( event_types )
|
66
|
+
self.subscriptions = self.subscriptions - event_types
|
67
|
+
self.worker.messaging.digest_unsubscribe(event_types) if self.connected
|
68
|
+
return self.subscriptions
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
module Gossiperl
|
3
|
+
module Client
|
4
|
+
class Supervisor < Gossiperl::Client::Resolution
|
5
|
+
|
6
|
+
field :connections, Hash, Hash.new
|
7
|
+
|
8
|
+
def connect options, &block
|
9
|
+
::Gossiperl::Client::Util::Validation.validate_connect( options )
|
10
|
+
if block_given?
|
11
|
+
self.connections[ options[:overlay_name].to_sym ] = ::Gossiperl::Client::OverlayWorker.new(self, options, block)
|
12
|
+
else
|
13
|
+
self.connections[ options[:overlay_name].to_sym ] = ::Gossiperl::Client::OverlayWorker.new(self, options, nil)
|
14
|
+
end
|
15
|
+
self.connections[ options[:overlay_name].to_sym ].start
|
16
|
+
end
|
17
|
+
|
18
|
+
def disconnect overlay_name
|
19
|
+
overlay_name = overlay_name.to_sym
|
20
|
+
if self.connections.has_key? overlay_name
|
21
|
+
self.connections[ overlay_name ].stop
|
22
|
+
self.connections.delete overlay_name
|
23
|
+
else
|
24
|
+
raise ArgumentError.new("[supervisor] No overlay connection: #{overlay_name}.")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def subscriptions overlay_name
|
29
|
+
overlay_name = overlay_name.to_sym
|
30
|
+
if self.connections.has_key? overlay_name
|
31
|
+
self.connections[ overlay_name ].subscriptions
|
32
|
+
else
|
33
|
+
raise ArgumentError.new("[supervisor] No overlay connection: #{overlay_name}.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def state overlay_name
|
38
|
+
overlay_name = overlay_name.to_sym
|
39
|
+
if self.connections.has_key? overlay_name
|
40
|
+
self.connections[ overlay_name ].current_state
|
41
|
+
else
|
42
|
+
raise ArgumentError.new("[supervisor] No overlay connection: #{overlay_name}.")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def subscribe overlay_name, event_types
|
47
|
+
overlay_name = overlay_name.to_sym
|
48
|
+
if self.connections.has_key? overlay_name
|
49
|
+
self.connections[ overlay_name ].subscribe event_types
|
50
|
+
else
|
51
|
+
raise ArgumentError.new("[supervisor] No overlay connection: #{overlay_name}.")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def unsubscribe overlay_name, event_types
|
56
|
+
overlay_name = overlay_name.to_sym
|
57
|
+
if self.connections.has_key? overlay_name
|
58
|
+
self.connections[ overlay_name ].unsubscribe event_types
|
59
|
+
else
|
60
|
+
raise ArgumentError.new("[supervisor] No overlay connection: #{overlay_name}.")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def send overlay_name, digest_type, digest_data
|
65
|
+
overlay_name = overlay_name.to_sym
|
66
|
+
if self.connections.has_key? overlay_name
|
67
|
+
self.connections[ overlay_name ].send digest_type, digest_data
|
68
|
+
else
|
69
|
+
raise ArgumentError.new("[supervisor] No overlay connection: #{overlay_name}.")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def stop
|
74
|
+
self.connections.keys.each_value {|ow|
|
75
|
+
ow.stop
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,378 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.9.1)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
|
9
|
+
module Gossiperl
|
10
|
+
module Client
|
11
|
+
module Thrift
|
12
|
+
class DigestEnvelope
|
13
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
14
|
+
PAYLOAD_TYPE = 1
|
15
|
+
BIN_PAYLOAD = 2
|
16
|
+
ID = 3
|
17
|
+
|
18
|
+
FIELDS = {
|
19
|
+
PAYLOAD_TYPE => {:type => ::Thrift::Types::STRING, :name => 'payload_type'},
|
20
|
+
BIN_PAYLOAD => {:type => ::Thrift::Types::STRING, :name => 'bin_payload'},
|
21
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'}
|
22
|
+
}
|
23
|
+
|
24
|
+
def struct_fields; FIELDS; end
|
25
|
+
|
26
|
+
def validate
|
27
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field payload_type is unset!') unless @payload_type
|
28
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field bin_payload is unset!') unless @bin_payload
|
29
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
30
|
+
end
|
31
|
+
|
32
|
+
::Thrift::Struct.generate_accessors self
|
33
|
+
end
|
34
|
+
|
35
|
+
class DigestForwardedAck
|
36
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
37
|
+
NAME = 1
|
38
|
+
REPLY_ID = 2
|
39
|
+
SECRET = 3
|
40
|
+
|
41
|
+
FIELDS = {
|
42
|
+
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
|
43
|
+
REPLY_ID => {:type => ::Thrift::Types::STRING, :name => 'reply_id'},
|
44
|
+
SECRET => {:type => ::Thrift::Types::STRING, :name => 'secret'}
|
45
|
+
}
|
46
|
+
|
47
|
+
def struct_fields; FIELDS; end
|
48
|
+
|
49
|
+
def validate
|
50
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
|
51
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field reply_id is unset!') unless @reply_id
|
52
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field secret is unset!') unless @secret
|
53
|
+
end
|
54
|
+
|
55
|
+
::Thrift::Struct.generate_accessors self
|
56
|
+
end
|
57
|
+
|
58
|
+
class DigestError
|
59
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
60
|
+
NAME = 1
|
61
|
+
HEARTBEAT = 2
|
62
|
+
ERROR_CODE = 3
|
63
|
+
ERROR_ENTITY = 4
|
64
|
+
ERROR_ENTITY_NAME = 5
|
65
|
+
ERROR_MESSAGE = 6
|
66
|
+
REPLY_ID = 7
|
67
|
+
|
68
|
+
FIELDS = {
|
69
|
+
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
|
70
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'},
|
71
|
+
ERROR_CODE => {:type => ::Thrift::Types::I32, :name => 'error_code'},
|
72
|
+
ERROR_ENTITY => {:type => ::Thrift::Types::STRING, :name => 'error_entity'},
|
73
|
+
ERROR_ENTITY_NAME => {:type => ::Thrift::Types::STRING, :name => 'error_entity_name'},
|
74
|
+
ERROR_MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'error_message'},
|
75
|
+
REPLY_ID => {:type => ::Thrift::Types::STRING, :name => 'reply_id'}
|
76
|
+
}
|
77
|
+
|
78
|
+
def struct_fields; FIELDS; end
|
79
|
+
|
80
|
+
def validate
|
81
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
|
82
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
83
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field error_code is unset!') unless @error_code
|
84
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field error_entity is unset!') unless @error_entity
|
85
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field error_entity_name is unset!') unless @error_entity_name
|
86
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field error_message is unset!') unless @error_message
|
87
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field reply_id is unset!') unless @reply_id
|
88
|
+
end
|
89
|
+
|
90
|
+
::Thrift::Struct.generate_accessors self
|
91
|
+
end
|
92
|
+
|
93
|
+
class DigestExit
|
94
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
95
|
+
NAME = 1
|
96
|
+
HEARTBEAT = 2
|
97
|
+
SECRET = 3
|
98
|
+
|
99
|
+
FIELDS = {
|
100
|
+
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
|
101
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'},
|
102
|
+
SECRET => {:type => ::Thrift::Types::STRING, :name => 'secret'}
|
103
|
+
}
|
104
|
+
|
105
|
+
def struct_fields; FIELDS; end
|
106
|
+
|
107
|
+
def validate
|
108
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
|
109
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
110
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field secret is unset!') unless @secret
|
111
|
+
end
|
112
|
+
|
113
|
+
::Thrift::Struct.generate_accessors self
|
114
|
+
end
|
115
|
+
|
116
|
+
class DigestMember
|
117
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
118
|
+
MEMBER_NAME = 1
|
119
|
+
MEMBER_IP = 2
|
120
|
+
MEMBER_PORT = 3
|
121
|
+
MEMBER_HEARTBEAT = 4
|
122
|
+
|
123
|
+
FIELDS = {
|
124
|
+
MEMBER_NAME => {:type => ::Thrift::Types::STRING, :name => 'member_name'},
|
125
|
+
MEMBER_IP => {:type => ::Thrift::Types::STRING, :name => 'member_ip'},
|
126
|
+
MEMBER_PORT => {:type => ::Thrift::Types::I32, :name => 'member_port'},
|
127
|
+
MEMBER_HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'member_heartbeat'}
|
128
|
+
}
|
129
|
+
|
130
|
+
def struct_fields; FIELDS; end
|
131
|
+
|
132
|
+
def validate
|
133
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field member_name is unset!') unless @member_name
|
134
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field member_ip is unset!') unless @member_ip
|
135
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field member_port is unset!') unless @member_port
|
136
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field member_heartbeat is unset!') unless @member_heartbeat
|
137
|
+
end
|
138
|
+
|
139
|
+
::Thrift::Struct.generate_accessors self
|
140
|
+
end
|
141
|
+
|
142
|
+
class DigestSubscription
|
143
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
144
|
+
EVENT_TYPE = 1
|
145
|
+
MEMBER_NAME = 2
|
146
|
+
ORIGIN = 3
|
147
|
+
HEARTBEAT = 4
|
148
|
+
|
149
|
+
FIELDS = {
|
150
|
+
EVENT_TYPE => {:type => ::Thrift::Types::STRING, :name => 'event_type'},
|
151
|
+
MEMBER_NAME => {:type => ::Thrift::Types::STRING, :name => 'member_name'},
|
152
|
+
ORIGIN => {:type => ::Thrift::Types::STRING, :name => 'origin'},
|
153
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'}
|
154
|
+
}
|
155
|
+
|
156
|
+
def struct_fields; FIELDS; end
|
157
|
+
|
158
|
+
def validate
|
159
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field event_type is unset!') unless @event_type
|
160
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field member_name is unset!') unless @member_name
|
161
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field origin is unset!') unless @origin
|
162
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
163
|
+
end
|
164
|
+
|
165
|
+
::Thrift::Struct.generate_accessors self
|
166
|
+
end
|
167
|
+
|
168
|
+
class Digest
|
169
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
170
|
+
NAME = 1
|
171
|
+
PORT = 2
|
172
|
+
HEARTBEAT = 3
|
173
|
+
ID = 4
|
174
|
+
SECRET = 5
|
175
|
+
|
176
|
+
FIELDS = {
|
177
|
+
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
|
178
|
+
PORT => {:type => ::Thrift::Types::I32, :name => 'port'},
|
179
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'},
|
180
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
181
|
+
SECRET => {:type => ::Thrift::Types::STRING, :name => 'secret'}
|
182
|
+
}
|
183
|
+
|
184
|
+
def struct_fields; FIELDS; end
|
185
|
+
|
186
|
+
def validate
|
187
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
|
188
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field port is unset!') unless @port
|
189
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
190
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
191
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field secret is unset!') unless @secret
|
192
|
+
end
|
193
|
+
|
194
|
+
::Thrift::Struct.generate_accessors self
|
195
|
+
end
|
196
|
+
|
197
|
+
class DigestAck
|
198
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
199
|
+
NAME = 1
|
200
|
+
HEARTBEAT = 2
|
201
|
+
REPLY_ID = 3
|
202
|
+
MEMBERSHIP = 4
|
203
|
+
|
204
|
+
FIELDS = {
|
205
|
+
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
|
206
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'},
|
207
|
+
REPLY_ID => {:type => ::Thrift::Types::STRING, :name => 'reply_id'},
|
208
|
+
MEMBERSHIP => {:type => ::Thrift::Types::LIST, :name => 'membership', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Gossiperl::Client::Thrift::DigestMember}}
|
209
|
+
}
|
210
|
+
|
211
|
+
def struct_fields; FIELDS; end
|
212
|
+
|
213
|
+
def validate
|
214
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
|
215
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
216
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field reply_id is unset!') unless @reply_id
|
217
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field membership is unset!') unless @membership
|
218
|
+
end
|
219
|
+
|
220
|
+
::Thrift::Struct.generate_accessors self
|
221
|
+
end
|
222
|
+
|
223
|
+
class DigestSubscriptions
|
224
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
225
|
+
NAME = 1
|
226
|
+
HEARTBEAT = 2
|
227
|
+
REPLY_ID = 3
|
228
|
+
SUBSCRIPTIONS = 4
|
229
|
+
|
230
|
+
FIELDS = {
|
231
|
+
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
|
232
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'},
|
233
|
+
REPLY_ID => {:type => ::Thrift::Types::STRING, :name => 'reply_id'},
|
234
|
+
SUBSCRIPTIONS => {:type => ::Thrift::Types::LIST, :name => 'subscriptions', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Gossiperl::Client::Thrift::DigestSubscription}}
|
235
|
+
}
|
236
|
+
|
237
|
+
def struct_fields; FIELDS; end
|
238
|
+
|
239
|
+
def validate
|
240
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
|
241
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
242
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field reply_id is unset!') unless @reply_id
|
243
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field subscriptions is unset!') unless @subscriptions
|
244
|
+
end
|
245
|
+
|
246
|
+
::Thrift::Struct.generate_accessors self
|
247
|
+
end
|
248
|
+
|
249
|
+
class DigestSubscribe
|
250
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
251
|
+
NAME = 1
|
252
|
+
HEARTBEAT = 2
|
253
|
+
ID = 3
|
254
|
+
EVENT_TYPES = 4
|
255
|
+
SECRET = 5
|
256
|
+
|
257
|
+
FIELDS = {
|
258
|
+
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
|
259
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'},
|
260
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
261
|
+
EVENT_TYPES => {:type => ::Thrift::Types::LIST, :name => 'event_types', :element => {:type => ::Thrift::Types::STRING}},
|
262
|
+
SECRET => {:type => ::Thrift::Types::STRING, :name => 'secret'}
|
263
|
+
}
|
264
|
+
|
265
|
+
def struct_fields; FIELDS; end
|
266
|
+
|
267
|
+
def validate
|
268
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
|
269
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
270
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
271
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field event_types is unset!') unless @event_types
|
272
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field secret is unset!') unless @secret
|
273
|
+
end
|
274
|
+
|
275
|
+
::Thrift::Struct.generate_accessors self
|
276
|
+
end
|
277
|
+
|
278
|
+
class DigestUnsubscribe
|
279
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
280
|
+
NAME = 1
|
281
|
+
HEARTBEAT = 2
|
282
|
+
ID = 3
|
283
|
+
EVENT_TYPES = 4
|
284
|
+
SECRET = 5
|
285
|
+
|
286
|
+
FIELDS = {
|
287
|
+
NAME => {:type => ::Thrift::Types::STRING, :name => 'name'},
|
288
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'},
|
289
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
290
|
+
EVENT_TYPES => {:type => ::Thrift::Types::LIST, :name => 'event_types', :element => {:type => ::Thrift::Types::STRING}},
|
291
|
+
SECRET => {:type => ::Thrift::Types::STRING, :name => 'secret'}
|
292
|
+
}
|
293
|
+
|
294
|
+
def struct_fields; FIELDS; end
|
295
|
+
|
296
|
+
def validate
|
297
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field name is unset!') unless @name
|
298
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
299
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
300
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field event_types is unset!') unless @event_types
|
301
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field secret is unset!') unless @secret
|
302
|
+
end
|
303
|
+
|
304
|
+
::Thrift::Struct.generate_accessors self
|
305
|
+
end
|
306
|
+
|
307
|
+
class DigestSubscribeAck
|
308
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
309
|
+
HEARTBEAT = 1
|
310
|
+
REPLY_ID = 2
|
311
|
+
EVENT_TYPES = 3
|
312
|
+
|
313
|
+
FIELDS = {
|
314
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'},
|
315
|
+
REPLY_ID => {:type => ::Thrift::Types::STRING, :name => 'reply_id'},
|
316
|
+
EVENT_TYPES => {:type => ::Thrift::Types::LIST, :name => 'event_types', :element => {:type => ::Thrift::Types::STRING}}
|
317
|
+
}
|
318
|
+
|
319
|
+
def struct_fields; FIELDS; end
|
320
|
+
|
321
|
+
def validate
|
322
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
323
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field reply_id is unset!') unless @reply_id
|
324
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field event_types is unset!') unless @event_types
|
325
|
+
end
|
326
|
+
|
327
|
+
::Thrift::Struct.generate_accessors self
|
328
|
+
end
|
329
|
+
|
330
|
+
class DigestUnsubscribeAck
|
331
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
332
|
+
HEARTBEAT = 1
|
333
|
+
REPLY_ID = 2
|
334
|
+
EVENT_TYPES = 3
|
335
|
+
|
336
|
+
FIELDS = {
|
337
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'},
|
338
|
+
REPLY_ID => {:type => ::Thrift::Types::STRING, :name => 'reply_id'},
|
339
|
+
EVENT_TYPES => {:type => ::Thrift::Types::LIST, :name => 'event_types', :element => {:type => ::Thrift::Types::STRING}}
|
340
|
+
}
|
341
|
+
|
342
|
+
def struct_fields; FIELDS; end
|
343
|
+
|
344
|
+
def validate
|
345
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
346
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field reply_id is unset!') unless @reply_id
|
347
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field event_types is unset!') unless @event_types
|
348
|
+
end
|
349
|
+
|
350
|
+
::Thrift::Struct.generate_accessors self
|
351
|
+
end
|
352
|
+
|
353
|
+
class DigestEvent
|
354
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
355
|
+
EVENT_TYPE = 1
|
356
|
+
EVENT_OBJECT = 2
|
357
|
+
HEARTBEAT = 3
|
358
|
+
|
359
|
+
FIELDS = {
|
360
|
+
EVENT_TYPE => {:type => ::Thrift::Types::STRING, :name => 'event_type'},
|
361
|
+
EVENT_OBJECT => {:type => ::Thrift::Types::STRING, :name => 'event_object'},
|
362
|
+
HEARTBEAT => {:type => ::Thrift::Types::I64, :name => 'heartbeat'}
|
363
|
+
}
|
364
|
+
|
365
|
+
def struct_fields; FIELDS; end
|
366
|
+
|
367
|
+
def validate
|
368
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field event_type is unset!') unless @event_type
|
369
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field event_object is unset!') unless @event_object
|
370
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field heartbeat is unset!') unless @heartbeat
|
371
|
+
end
|
372
|
+
|
373
|
+
::Thrift::Struct.generate_accessors self
|
374
|
+
end
|
375
|
+
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|