Class: Google::Cloud::Bigtable::Table::RestoreJob

Inherits:
LongrunningJob show all
Defined in:
lib/google/cloud/bigtable/table/restore_job.rb

Overview

RestoreJob

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

See Backup#restore.

Examples:

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new
instance = bigtable.instance "my-instance"
cluster = instance.cluster "my-cluster"

backup = cluster.backup "my-backup"

job = backup.restore "my-new-table"

job.wait_until_done!
job.done? #=> true

if job.error?
  status = job.error
else
  table = job.table
  optimized = job.optimize_table_operation_name
end

See Also:

Instance Method Summary collapse

Instance Method Details

#optimize_table_operation_nameString?

The optimize table operation name from operation metadata.

Examples:

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new
instance = bigtable.instance "my-instance"
cluster = instance.cluster "my-cluster"

backup = cluster.backup "my-backup"

job = backup.restore "my-new-table"

job.wait_until_done!
job.done? #=> true

if job.error?
  status = job.error
else
  table = job.table
  optimized = job.optimize_table_operation_name
end

Returns:

  • (String, nil)

    The optimize table operation name, or nil if the optimize table operation is not complete.



80
81
82
# File 'lib/google/cloud/bigtable/table/restore_job.rb', line 80

def optimize_table_operation_name
  .optimize_table_operation_name
end

#tableGoogle::Cloud::Bigtable::Table?

Gets the table object from operation results.

Examples:

require "google/cloud/bigtable"

bigtable = Google::Cloud::Bigtable.new
instance = bigtable.instance "my-instance"
cluster = instance.cluster "my-cluster"

backup = cluster.backup "my-backup"

job = backup.restore "my-new-table"

job.wait_until_done!
job.done? #=> true

if job.error?
  status = job.error
else
  table = job.table
  optimized = job.optimize_table_operation_name
end

Returns:



110
111
112
# File 'lib/google/cloud/bigtable/table/restore_job.rb', line 110

def table
  Table.from_grpc results, service, view: :NAME_ONLY if results
end