Class: Google::Cloud::Spanner::Instance::Job
- Inherits:
-
Object
- Object
- Google::Cloud::Spanner::Instance::Job
- Defined in:
- lib/google/cloud/spanner/instance/job.rb
Overview
# Job
A resource representing the long-running, asynchronous processing of an instance create or update operation. The job can be refreshed to retrieve the instance object once the operation has been completed.
See Project#create_instance and #update.
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#done? ⇒ boolean
Checks if the processing of the instance operation is complete.
-
#error ⇒ Google::Cloud::Spanner::Status?
The status if the operation associated with this job produced an error.
-
#error? ⇒ boolean
Checks if the processing of the instance operation has errored.
-
#initialize ⇒ Job
constructor
A new instance of Job.
-
#instance ⇒ Google::Cloud::Spanner::Instance?
The instance that is the object of the operation.
-
#reload! ⇒ Google::Cloud::Spanner::Instance::Job
(also: #refresh!)
Reloads the job with current data from the long-running, asynchronous processing of an instance operation.
-
#wait_until_done! ⇒ Object
Reloads the job until the operation is complete.
Constructor Details
#initialize ⇒ Job
Returns a new instance of Job.
60 61 62 63 |
# File 'lib/google/cloud/spanner/instance/job.rb', line 60 def initialize @grpc = nil @service = nil end |
Instance Attribute Details
#grpc ⇒ Object
52 53 54 |
# File 'lib/google/cloud/spanner/instance/job.rb', line 52 def grpc @grpc end |
#service ⇒ Object
56 57 58 |
# File 'lib/google/cloud/spanner/instance/job.rb', line 56 def service @service end |
Class Method Details
.from_grpc(grpc, service) ⇒ Object
217 218 219 220 221 222 |
# File 'lib/google/cloud/spanner/instance/job.rb', line 217 def self.from_grpc grpc, service new.tap do |job| job.instance_variable_set :@grpc, grpc job.instance_variable_set :@service, service end end |
Instance Method Details
#done? ⇒ boolean
Checks if the processing of the instance operation is complete.
111 112 113 |
# File 'lib/google/cloud/spanner/instance/job.rb', line 111 def done? @grpc.done? end |
#error ⇒ Google::Cloud::Spanner::Status?
The status if the operation associated with this job produced an error.
159 160 161 162 |
# File 'lib/google/cloud/spanner/instance/job.rb', line 159 def error return nil unless error? Google::Cloud::Spanner::Status.from_grpc @grpc.error end |
#error? ⇒ boolean
Checks if the processing of the instance operation has errored.
133 134 135 |
# File 'lib/google/cloud/spanner/instance/job.rb', line 133 def error? @grpc.error? end |
#instance ⇒ Google::Cloud::Spanner::Instance?
The instance that is the object of the operation.
87 88 89 90 91 |
# File 'lib/google/cloud/spanner/instance/job.rb', line 87 def instance return nil unless done? return nil unless @grpc.grpc_op.result == :response Instance.from_grpc @grpc.results, service end |
#reload! ⇒ Google::Cloud::Spanner::Instance::Job Also known as: refresh!
Reloads the job with current data from the long-running, asynchronous processing of an instance operation.
186 187 188 189 |
# File 'lib/google/cloud/spanner/instance/job.rb', line 186 def reload! @grpc.reload! self end |
#wait_until_done! ⇒ Object
Reloads the job until the operation is complete. The delay between reloads will incrementally increase.
211 212 213 |
# File 'lib/google/cloud/spanner/instance/job.rb', line 211 def wait_until_done! @grpc.wait_until_done! end |