Class: Droonga::Catalog::Dataset
- Inherits:
-
Object
- Object
- Droonga::Catalog::Dataset
- Defined in:
- lib/droonga/catalog/dataset.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_NAME =
"Default"
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#[](key) ⇒ Object
provided for compatibility.
-
#[]=(key, value) ⇒ Object
provided for compatibility.
- #all_nodes ⇒ Object
- #compute_routes(message, active_nodes) ⇒ Object
- #fact ⇒ Object
-
#initialize(name, raw) ⇒ Dataset
constructor
A new instance of Dataset.
- #n_workers ⇒ Object
- #plugins ⇒ Object
-
#replicas ⇒ Object
XXX Currently, dataset has a property named "replicas" so can be parsed as a ReplicasVolume.
- #schema ⇒ Object
- #sliced? ⇒ Boolean
Constructor Details
#initialize(name, raw) ⇒ Dataset
Returns a new instance of Dataset.
26 27 28 29 30 |
# File 'lib/droonga/catalog/dataset.rb', line 26 def initialize(name, raw) @name = name @raw = raw @schema = nil end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/droonga/catalog/dataset.rb', line 24 def name @name end |
Instance Method Details
#[](key) ⇒ Object
provided for compatibility
33 34 35 |
# File 'lib/droonga/catalog/dataset.rb', line 33 def [](key) @raw[key] end |
#[]=(key, value) ⇒ Object
provided for compatibility
38 39 40 |
# File 'lib/droonga/catalog/dataset.rb', line 38 def []=(key, value) @raw[key] = value end |
#all_nodes ⇒ Object
66 67 68 |
# File 'lib/droonga/catalog/dataset.rb', line 66 def all_nodes @all_nodes ||= replicas.all_nodes end |
#compute_routes(message, active_nodes) ⇒ Object
70 71 72 |
# File 'lib/droonga/catalog/dataset.rb', line 70 def compute_routes(, active_nodes) @replicas.compute_routes(, active_nodes) end |
#fact ⇒ Object
50 51 52 |
# File 'lib/droonga/catalog/dataset.rb', line 50 def fact @raw["fact"] end |
#n_workers ⇒ Object
54 55 56 |
# File 'lib/droonga/catalog/dataset.rb', line 54 def n_workers @raw["nWorkers"] || 0 end |
#plugins ⇒ Object
46 47 48 |
# File 'lib/droonga/catalog/dataset.rb', line 46 def plugins @raw["plugins"] || [] end |
#replicas ⇒ Object
XXX Currently, dataset has a property named "replicas" so can be parsed as a ReplicasVolume. We must introduce a new property "volume" to provide ReplicasVolume safely.
62 63 64 |
# File 'lib/droonga/catalog/dataset.rb', line 62 def replicas @replicas ||= ReplicasVolume.new(self, @raw) end |
#schema ⇒ Object
42 43 44 |
# File 'lib/droonga/catalog/dataset.rb', line 42 def schema @schema ||= Schema.new(@name, @raw["schema"]) end |
#sliced? ⇒ Boolean
74 75 76 77 |
# File 'lib/droonga/catalog/dataset.rb', line 74 def sliced? # TODO: Support slice key @replicas.sliced? end |