Class: TinyPresto::TinyPresto
- Inherits:
-
Object
- Object
- TinyPresto::TinyPresto
- Includes:
- Singleton
- Defined in:
- lib/tiny-presto.rb
Overview
Singleton object representing a Presto cluster running in the local machine.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#cluster ⇒ Object
readonly
Returns the value of attribute cluster.
Instance Method Summary collapse
-
#initialize ⇒ TinyPresto
constructor
A new instance of TinyPresto.
- #stop ⇒ Object
Constructor Details
#initialize ⇒ TinyPresto
Returns a new instance of TinyPresto.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tiny-presto.rb', line 16 def initialize @cluster = Cluster.new @cluster.run @client = Presto::Client.new(server: 'localhost:8080', catalog: 'memory', user: 'tiny-user', schema: 'default') loop do @client.run('show schemas') break rescue StandardError => _ # Waiting for the cluster is launched sleep(1) end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
14 15 16 |
# File 'lib/tiny-presto.rb', line 14 def client @client end |
#cluster ⇒ Object (readonly)
Returns the value of attribute cluster.
14 15 16 |
# File 'lib/tiny-presto.rb', line 14 def cluster @cluster end |
Instance Method Details
#stop ⇒ Object
29 30 31 |
# File 'lib/tiny-presto.rb', line 29 def stop @cluster.stop end |