Class: Neo4j::Driver::Summary::SummaryCounters
- Inherits:
-
Object
- Object
- Neo4j::Driver::Summary::SummaryCounters
- Defined in:
- lib/neo4j/driver/summary/summary_counters.rb
Overview
Per-operation counts produced by the query. Mirrors org.neo4j.driver.summary.SummaryCounters.
Constant Summary collapse
- COUNTER_KEYS =
Mapping from server metadata keys (kebab-case strings sent on the wire as Symbols) to Ruby attribute names.
{ 'nodes-created': :nodes_created, 'nodes-deleted': :nodes_deleted, 'relationships-created': :relationships_created, 'relationships-deleted': :relationships_deleted, 'properties-set': :properties_set, 'labels-added': :labels_added, 'labels-removed': :labels_removed, 'indexes-added': :indexes_added, 'indexes-removed': :indexes_removed, 'constraints-added': :constraints_added, 'constraints-removed': :constraints_removed, 'system-updates': :system_updates }.freeze
Instance Attribute Summary collapse
-
#constraints_added ⇒ Object
readonly
Returns the value of attribute constraints_added.
-
#constraints_removed ⇒ Object
readonly
Returns the value of attribute constraints_removed.
-
#indexes_added ⇒ Object
readonly
Returns the value of attribute indexes_added.
-
#indexes_removed ⇒ Object
readonly
Returns the value of attribute indexes_removed.
-
#labels_added ⇒ Object
readonly
Returns the value of attribute labels_added.
-
#labels_removed ⇒ Object
readonly
Returns the value of attribute labels_removed.
-
#nodes_created ⇒ Object
readonly
Returns the value of attribute nodes_created.
-
#nodes_deleted ⇒ Object
readonly
Returns the value of attribute nodes_deleted.
-
#properties_set ⇒ Object
readonly
Returns the value of attribute properties_set.
-
#relationships_created ⇒ Object
readonly
Returns the value of attribute relationships_created.
-
#relationships_deleted ⇒ Object
readonly
Returns the value of attribute relationships_deleted.
-
#system_updates ⇒ Object
readonly
Returns the value of attribute system_updates.
Instance Method Summary collapse
- #contains_system_updates? ⇒ Boolean
- #contains_updates? ⇒ Boolean
-
#initialize(stats) ⇒ SummaryCounters
constructor
A new instance of SummaryCounters.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(stats) ⇒ SummaryCounters
Returns a new instance of SummaryCounters.
34 35 36 37 38 39 40 41 42 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 34 def initialize(stats) # Initialize all counters to 0 — server only reports nonzero ones. COUNTER_KEYS.each_value { |attr| instance_variable_set("@#{attr}", 0) } stats.each do |key, value| attr_name = COUNTER_KEYS[key] instance_variable_set("@#{attr_name}", value.to_i) if attr_name end end |
Instance Attribute Details
#constraints_added ⇒ Object (readonly)
Returns the value of attribute constraints_added.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def constraints_added @constraints_added end |
#constraints_removed ⇒ Object (readonly)
Returns the value of attribute constraints_removed.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def constraints_removed @constraints_removed end |
#indexes_added ⇒ Object (readonly)
Returns the value of attribute indexes_added.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def indexes_added @indexes_added end |
#indexes_removed ⇒ Object (readonly)
Returns the value of attribute indexes_removed.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def indexes_removed @indexes_removed end |
#labels_added ⇒ Object (readonly)
Returns the value of attribute labels_added.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def labels_added @labels_added end |
#labels_removed ⇒ Object (readonly)
Returns the value of attribute labels_removed.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def labels_removed @labels_removed end |
#nodes_created ⇒ Object (readonly)
Returns the value of attribute nodes_created.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def nodes_created @nodes_created end |
#nodes_deleted ⇒ Object (readonly)
Returns the value of attribute nodes_deleted.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def nodes_deleted @nodes_deleted end |
#properties_set ⇒ Object (readonly)
Returns the value of attribute properties_set.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def properties_set @properties_set end |
#relationships_created ⇒ Object (readonly)
Returns the value of attribute relationships_created.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def relationships_created @relationships_created end |
#relationships_deleted ⇒ Object (readonly)
Returns the value of attribute relationships_deleted.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def relationships_deleted @relationships_deleted end |
#system_updates ⇒ Object (readonly)
Returns the value of attribute system_updates.
9 10 11 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 9 def system_updates @system_updates end |
Instance Method Details
#contains_system_updates? ⇒ Boolean
58 59 60 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 58 def contains_system_updates? system_updates.positive? end |
#contains_updates? ⇒ Boolean
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 44 def contains_updates? nodes_created.positive? || nodes_deleted.positive? || relationships_created.positive? || relationships_deleted.positive? || properties_set.positive? || labels_added.positive? || labels_removed.positive? || indexes_added.positive? || indexes_removed.positive? || constraints_added.positive? || constraints_removed.positive? end |
#to_h ⇒ Object
62 63 64 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 62 def to_h COUNTER_KEYS.values.to_h { |attr| [attr, instance_variable_get("@#{attr}")] } end |
#to_s ⇒ Object
66 67 68 |
# File 'lib/neo4j/driver/summary/summary_counters.rb', line 66 def to_s to_h.select { |_, v| v.positive? }.map { |k, v| "#{k}: #{v}" }.join(', ') end |