class Google::Cloud::Bigtable::LongrunningJob

# LongrunningJob

A resource representing the long-running, asynchronous processing operation. The job can be refreshed to retrieve the result object once the operation has been completed.

@see cloud.google.com/bigtable/docs/reference/admin/rpc/google.longrunning#google.longrunning.Operation

Long-running Operation

Attributes

grpc[RW]

@private The Gapic::Operation gRPC object.

service[RW]

@private The gRPC Service object.

Public Class Methods

from_grpc(grpc, service) click to toggle source

@private New BasicJob from a Gapic::Operation object.

# File lib/google/cloud/bigtable/longrunning_job.rb, line 113
def self.from_grpc grpc, service
  new.tap do |job|
    job.grpc =  grpc
    job.service = service
  end
end

Public Instance Methods

done?() click to toggle source

Checks if the processing of the instance operation is complete.

@return [boolean] `true` when complete, `false` otherwise.

# File lib/google/cloud/bigtable/longrunning_job.rb, line 56
def done?
  @grpc.done?
end
error() click to toggle source

The status when the operation associated with this job produced an error.

@return [Object, Google::Rpc::Status, nil] A status object with

the status code and message, or `nil` if no error occurred.
# File lib/google/cloud/bigtable/longrunning_job.rb, line 76
def error
  return nil unless error?
  @grpc.error
end
error?() click to toggle source

Checks if the processing of the instance operation has errored.

@return [boolean] `true` when errored, `false` otherwise.

# File lib/google/cloud/bigtable/longrunning_job.rb, line 65
def error?
  @grpc.error?
end
metadata() click to toggle source

@private Gets the metadata object of the operation.

@return [Object, nil] `nil` if the operation is not complete.

# File lib/google/cloud/bigtable/longrunning_job.rb, line 105
def metadata
  return nil unless done?
  return nil unless @grpc.grpc_op.result == :response
  @grpc.metadata
end
reload!() click to toggle source

Reloads the job with current data from the long-running, asynchronous processing of an operation.

@return [Google::Cloud::Bigtable::Instance::Job] The same job instance.

# File lib/google/cloud/bigtable/longrunning_job.rb, line 87
def reload!
  @grpc.reload!
  self
end
results() click to toggle source

Gets the result object of the operation.

@return [Object, nil]

`nil` if the operation is not complete.
# File lib/google/cloud/bigtable/longrunning_job.rb, line 45
def results
  return nil unless done?
  return nil unless @grpc.grpc_op.result == :response
  @grpc.results
end
wait_until_done!() click to toggle source

Reloads the job until the operation is complete. The delay between reloads will incrementally increase.

# File lib/google/cloud/bigtable/longrunning_job.rb, line 96
def wait_until_done!
  @grpc.wait_until_done!
end