Class: Wurk::Flow::Status::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/wurk/flow/status.rb

Overview

One node of the graph, as stored. Reads only — Builder's Node is the declaration-side object and holds the caller's arguments; this one holds what Redis has, which is the part that changes as the flow runs.

Constant Summary collapse

STATES =
%w[waiting enqueued succeeded dead broken].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fields) ⇒ Node

Returns a new instance of Node.



117
118
119
120
121
# File 'lib/wurk/flow/status.rb', line 117

def initialize(fields)
  read_identity(fields)
  read_edges(fields)
  read_progress(fields)
end

Instance Attribute Details

#bidObject (readonly)

Returns the value of attribute bid.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def bid
  @bid
end

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def dependencies
  @dependencies
end

#dependentsObject (readonly)

Returns the value of attribute dependents.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def dependents
  @dependents
end

#errorObject (readonly)

Returns the value of attribute error.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def error
  @error
end

#indexObject (readonly)

Returns the value of attribute index.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def index
  @index
end

#jidObject (readonly)

Returns the value of attribute jid.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def jid
  @jid
end

#klassObject (readonly)

Returns the value of attribute klass.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def klass
  @klass
end

#nameObject (readonly)

Returns the value of attribute name.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def name
  @name
end

#queueObject (readonly)

Returns the value of attribute queue.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def queue
  @queue
end

#remainingObject (readonly)

Returns the value of attribute remaining.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def remaining
  @remaining
end

#stateObject (readonly)

Returns the value of attribute state.



114
115
116
# File 'lib/wurk/flow/status.rb', line 114

def state
  @state
end

Instance Method Details

#dataObject



128
129
130
131
132
133
134
135
# File 'lib/wurk/flow/status.rb', line 128

def data
  {
    'index' => @index, 'name' => @name, 'class' => @klass, 'queue' => @queue,
    'jid' => @jid, 'bid' => @bid, 'state' => @state, 'depends_on' => @dependencies,
    'dependents' => @dependents, 'remaining' => @remaining, 'piped' => @piped,
    'error' => @error
  }
end

#piped?Boolean

Returns true when this node is handed its dependency's stored result. The sentinel itself is not published: it is an internal splice marker, and its bytes say nothing a reader wants.

Returns:

  • (Boolean)

    true when this node is handed its dependency's stored result. The sentinel itself is not published: it is an internal splice marker, and its bytes say nothing a reader wants.



126
# File 'lib/wurk/flow/status.rb', line 126

def piped? = @piped