Class: Sumac::Reference
- Inherits:
-
Object
show all
- Includes:
- QueuedStateMachine
- Defined in:
- lib/sumac/reference.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(connection, exposed_id) ⇒ Reference
Returns a new instance of Reference.
25
26
27
28
29
30
31
32
|
# File 'lib/sumac/reference.rb', line 25
def initialize(connection, exposed_id)
super()
raise "argument 'connection' must be a Connection" unless connection.is_a?(Connection)
@connection = connection
raise unless exposed_id.is_a?(Integer)
@exposed_id = exposed_id
@forget_condition_variable = ConditionVariable.new
end
|
Instance Attribute Details
#exposed_id ⇒ Object
Returns the value of attribute exposed_id.
23
24
25
|
# File 'lib/sumac/reference.rb', line 23
def exposed_id
@exposed_id
end
|
Instance Method Details
#callable? ⇒ Boolean
54
55
56
|
# File 'lib/sumac/reference.rb', line 54
def callable?
at?(:active)
end
|
58
59
60
61
|
# File 'lib/sumac/reference.rb', line 58
def destroy
raise unless at?(:detached)
to(:stale)
end
|
50
51
52
|
# File 'lib/sumac/reference.rb', line 50
def detach
to(:detached)
end
|
#local_forget_request ⇒ Object
34
35
36
37
|
# File 'lib/sumac/reference.rb', line 34
def local_forget_request
to(:forget_requested) if at?(:active)
@forget_condition_variable.wait(@connection.mutex) if at?([:forget_requested, :detached])
end
|
#remote_forget_request ⇒ Object
39
40
41
42
|
# File 'lib/sumac/reference.rb', line 39
def remote_forget_request
raise if at?([:detached, :stale])
to(:stale)
end
|
#send_forget_notification ⇒ Object
44
45
46
47
48
|
# File 'lib/sumac/reference.rb', line 44
def send_forget_notification
message = Message::Exchange::ForgetNotification.new(@connection)
message.reference = self
@connection.messenger.send(message)
end
|
#stale? ⇒ Boolean
63
64
65
|
# File 'lib/sumac/reference.rb', line 63
def stale?
at?(:stale)
end
|