Class: Voltdb::Client
- Inherits:
-
Object
- Object
- Voltdb::Client
- Extended by:
- Forwardable
- Includes:
- ClientUtils
- Defined in:
- lib/voltdb/client.rb
Instance Attribute Summary collapse
-
#java_client ⇒ Object
readonly
Returns the value of attribute java_client.
Class Method Summary collapse
-
.create_client(config) ⇒ Object
Factory of Voltdb::Client.
Instance Method Summary collapse
-
#call_all_partition_procedure(proc_name, *params, &block) ⇒ ClientResponseWithPartitionKey, ...
The method uses system procedure @GetPartitionKeys to get a set of partition values and then execute the stored procedure one partition at a time, and return an aggregated response.
-
#call_procedure(proc_name, *params, &block) ⇒ Java::OrgVoltdbClient::ClientResponse, ...
Invokes a voltdb stored procedure based on its procedure name, a list of params and a block only if an asynchronous call is required.
-
#call_procedure_with_timeout(query_timeout, proc_name, *params, &block) ⇒ Java::OrgVoltdbClient::ClientResponse, ...
Invokes a voltdb stored procedure with an specific timeout a procedure name, a list of params and a block only if an asynchronous call is required.
-
#get_connected_host_list ⇒ Array<InetSocketAddress>
Get the list of VoltDB server hosts that this client has open TCP connections to.
-
#get_instance_id ⇒ Array<Fixnum>
Get an identifier for the cluster that this client is currently connected to.
-
#get_new_bulk_loader(table_name, max_batch_size, upsert, &block) ⇒ VoltBulkLoader
Creates a new instance of a VoltBulkLoader that is bound to this Client.
-
#get_throughput_and_outstanding_txn_limits ⇒ Array<Fixnum>
Get the instantaneous values of the rate limiting values for this client.
-
#initialize(java_client) ⇒ Client
constructor
A new instance of Client.
-
#update_application_catalog(catalog_path, deployment_path, &block) ⇒ Java::OrgVoltdbClient::ClientResponse, ...
This method is a convenience method that is equivalent to reading the catalog file into a byte array in Java code, then calling call_procedure with “@UpdateApplicationCatalog” as the procedure name, followed by they bytes of the catalog and the string value of the deployment file.
-
#update_classes(jar_path, classes_to_delete, &block) ⇒ Java::OrgVoltdbClient::ClientResponse, ...
This method is a convenience method that is equivalent to reading a jarfile containing to be added/updated into a byte array in Java code, then calling call_procedure with “@UpdateClasses” as the procedure name, followed by the bytes of the jarfile and a string containing a comma-separates list of classes to delete from the catalog.If a block is passed to the method an asyncronous call will be made.
Methods included from ClientUtils
#host_and_port_from_address, #params_to_java_objects
Constructor Details
#initialize(java_client) ⇒ Client
Returns a new instance of Client.
24 25 26 |
# File 'lib/voltdb/client.rb', line 24 def initialize(java_client) @java_client = java_client end |
Instance Attribute Details
#java_client ⇒ Object (readonly)
Returns the value of attribute java_client.
12 13 14 |
# File 'lib/voltdb/client.rb', line 12 def java_client @java_client end |
Class Method Details
.create_client(config) ⇒ Object
Factory of Voltdb::Client
18 19 20 21 22 |
# File 'lib/voltdb/client.rb', line 18 def self.create_client(config) client = ClientFactory.create_client(config) self.new(client) end |
Instance Method Details
#call_all_partition_procedure(proc_name, *params, &block) ⇒ ClientResponseWithPartitionKey, ...
The method uses system procedure @GetPartitionKeys to get a set of partition values and then execute the stored procedure one partition at a time, and return an aggregated response. If a block is passed to the method an asyncronous call will be made
182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/voltdb/client.rb', line 182 def call_all_partition_procedure(proc_name, *params, &block) if block_given? cb = AllPartitionProcCallback.new(&block) java_client.call_all_partition_procedure(cb, proc_name, *params_to_java_objects(*params)) else java_client.call_all_partition_procedure(proc_name, *params_to_java_objects(*params)).map do |partition| partition.response.extend(ClientResponseUtils) partition end end end |
#call_procedure(proc_name, *params, &block) ⇒ Java::OrgVoltdbClient::ClientResponse, ...
Invokes a voltdb stored procedure based on its procedure name, a list of params and a block only if an asynchronous call is required
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/voltdb/client.rb', line 38 def call_procedure(proc_name, *params, &block) if block_given? cb = ProcCallback.new(&block) java_client.call_procedure(cb, proc_name, *params_to_java_objects(*params)) else response = java_client.call_procedure(proc_name, *params_to_java_objects(*params)) response.extend(ClientResponseUtils) response end end |
#call_procedure_with_timeout(query_timeout, proc_name, *params, &block) ⇒ Java::OrgVoltdbClient::ClientResponse, ...
Invokes a voltdb stored procedure with an specific timeout a procedure name, a list of params and a block only if an asynchronous call is required
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/voltdb/client.rb', line 61 def call_procedure_with_timeout(query_timeout, proc_name, *params, &block) if block_given? cb = ProcCallback.new(&block) java_client.call_procedure_with_timeout(cb, query_timeout, proc_name, *params_to_java_objects(*params)) else response = java_client.call_procedure_with_timeout(query_timeout, proc_name, *params_to_java_objects(*params)) response.extend(ClientResponseUtils) response end end |
#get_connected_host_list ⇒ Array<InetSocketAddress>
Get the list of VoltDB server hosts that this client has open TCP connections to
147 148 149 |
# File 'lib/voltdb/client.rb', line 147 def get_connected_host_list java_client.get_connected_host_list.to_ary end |
#get_instance_id ⇒ Array<Fixnum>
Get an identifier for the cluster that this client is currently connected to. This will be null if the client has not been connected. Currently these values have logical meaning, but they should just be interpreted as a unique per-cluster value
130 131 132 |
# File 'lib/voltdb/client.rb', line 130 def get_instance_id java_client.get_instance_id.to_ary end |
#get_new_bulk_loader(table_name, max_batch_size, upsert, &block) ⇒ VoltBulkLoader
Creates a new instance of a VoltBulkLoader that is bound to this Client. Multiple instances of a VoltBulkLoader created by a single Client will share some resources, particularly if they are inserting into the same table
162 163 164 165 166 167 168 169 170 |
# File 'lib/voltdb/client.rb', line 162 def get_new_bulk_loader(table_name, max_batch_size, upsert, &block) cb = BulkLoaderFailureCallback.new(&block) if upsert java_client.get_new_bulk_loader(table_name, max_batch_size, upsert, cb) else java_client.get_new_bulk_loader(table_name, max_batch_size, cb) end end |
#get_throughput_and_outstanding_txn_limits ⇒ Array<Fixnum>
Get the instantaneous values of the rate limiting values for this client
138 139 140 |
# File 'lib/voltdb/client.rb', line 138 def get_throughput_and_outstanding_txn_limits java_client.get_throughput_and_outstanding_txn_limits.to_ary end |
#update_application_catalog(catalog_path, deployment_path, &block) ⇒ Java::OrgVoltdbClient::ClientResponse, ...
This method is a convenience method that is equivalent to reading the catalog file into a byte array in Java code, then calling call_procedure with “@UpdateApplicationCatalog” as the procedure name, followed by they bytes of the catalog and the string value of the deployment file. If a block is passed to the method an asyncronous call will be made
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/voltdb/client.rb', line 86 def update_application_catalog(catalog_path, deployment_path, &block) if block_given? cb = ProcCallback.new(&block) java_client.update_application_catalog(cb, catalog_path, deployment_path) else response = java_client.update_application_catalog(catalog_path, deployment_path) response.extend(ClientResponseUtils) response end end |
#update_classes(jar_path, classes_to_delete, &block) ⇒ Java::OrgVoltdbClient::ClientResponse, ...
This method is a convenience method that is equivalent to reading a jarfile containing to be added/updated into a byte array in Java code, then calling call_procedure with “@UpdateClasses” as the procedure name, followed by the bytes of the jarfile and a string containing a comma-separates list of classes to delete from the catalog.If a block is passed to the method an asyncronous call will be made
112 113 114 115 116 117 118 119 120 121 |
# File 'lib/voltdb/client.rb', line 112 def update_classes(jar_path, classes_to_delete, &block) if block_given? cb = ProcCallback.new(&block) java_client.update_classes(cb, jar_path, classes_to_delete) else response = java_client.update_classes(jar_path, classes_to_delete) response.extend(ClientResponseUtils) response end end |