Class: Spinoza::Log::Entry
- Inherits:
-
Object
- Object
- Spinoza::Log::Entry
- Defined in:
- lib/spinoza/system/log.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Node which wrote the entry.
-
#time_durable ⇒ Object
readonly
When, in the global timeline, this entry is durable enough and the writing node has been notified that this is the case.
-
#time_replicated ⇒ Object
readonly
When, in the global timeline, this entry is completely replicated.
-
#value ⇒ Object
readonly
Data payload.
Instance Method Summary collapse
-
#durable? ⇒ Boolean
Returns true if the writing node believes the data to be durable.
-
#initialize(node: raise, value: raise, time_durable: raise, time_replicated: raise) ⇒ Entry
constructor
A new instance of Entry.
-
#readable_at?(other_node) ⇒ Boolean
Returns true if
other_node
can read the entry (i.e. it has been replicated to the nodes).
Constructor Details
#initialize(node: raise, value: raise, time_durable: raise, time_replicated: raise) ⇒ Entry
Returns a new instance of Entry.
34 35 36 37 38 |
# File 'lib/spinoza/system/log.rb', line 34 def initialize node: raise, value: raise, time_durable: raise, time_replicated: raise @node, @value, @time_durable, @time_replicated = node, value, time_durable, time_replicated end |
Instance Attribute Details
#node ⇒ Object (readonly)
Node which wrote the entry.
22 23 24 |
# File 'lib/spinoza/system/log.rb', line 22 def node @node end |
#time_durable ⇒ Object (readonly)
When, in the global timeline, this entry is durable enough and the writing node has been notified that this is the case.
29 30 31 |
# File 'lib/spinoza/system/log.rb', line 29 def time_durable @time_durable end |
#time_replicated ⇒ Object (readonly)
When, in the global timeline, this entry is completely replicated.
32 33 34 |
# File 'lib/spinoza/system/log.rb', line 32 def time_replicated @time_replicated end |
#value ⇒ Object (readonly)
Data payload.
25 26 27 |
# File 'lib/spinoza/system/log.rb', line 25 def value @value end |
Instance Method Details
#durable? ⇒ Boolean
Returns true if the writing node believes the data to be durable.
41 42 43 |
# File 'lib/spinoza/system/log.rb', line 41 def durable? @node.time_now >= @time_durable end |
#readable_at?(other_node) ⇒ Boolean
Returns true if other_node
can read the entry (i.e. it has been replicated to the nodes).
47 48 49 |
# File 'lib/spinoza/system/log.rb', line 47 def readable_at? other_node other_node == @node or other_node.time_now >= @time_replicated end |