Reference documentation and code samples for the Cloud Spanner API class Google::Cloud::Spanner::Backup::Restore::Job.
Job
A resource representing the long-running, asynchronous processing of a backup restore. The job can be refreshed to retrieve the restored database object once the operation has been completed.
See {Backup#restore}
{Google::Cloud::Spanner::Admin::Database#database_admin Client#restore_database} instead.
Inherits
- Object
Example
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new instance = spanner.instance "my-instance" backup = instance.backup "my-backup" job = backup.restore "my-restored-database" job.done? #=> false job.reload! # API call job.done? #=> true if job.error? status = job.error else database = job.database end
Methods
#database
def database() -> Database, nil
The database is the object of the operation.
-
(Database, nil) — The database instance, or
nil
if the operation is not complete.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new instance = spanner.instance "my-instance" backup = instance.backup "my-backup" job = backup.restore "my-restored-database" job.done? #=> false job.reload! job.done? #=> true database = job.database
#done?
def done?() -> boolean
Checks if the processing of the restore operation is complete.
-
(boolean) —
true
when complete,false
otherwise.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new instance = spanner.instance "my-instance" backup = instance.backup "my-backup" job = backup.restore "my-restored-database" job.done? #=> false
#end_time
def end_time() -> Time, nil
The operation end time.
- (Time, nil)
#error
def error() -> Google::Cloud::Spanner::Status, nil
The status if the operation associated with this job produced an error.
-
(Google::Cloud::Spanner::Status, nil) — A status object with
the status code and message, or
nil
if no error occurred.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new instance = spanner.instance "my-instance" backup = instance.backup "my-backup" job = backup.restore "my-restored-database" job.error? # true error = job.error
#error?
def error?() -> boolean
Checks if the processing of the restore operation has errored.
-
(boolean) —
true
when errored,false
otherwise.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new instance = spanner.instance "my-instance" backup = instance.backup "my-backup" job = backup.restore "my-restored-database" job.error? #=> false
#progress_percent
def progress_percent() -> Integer
The operation progress in percentage.
- (Integer)
#refresh!
def refresh!() -> Backup::Job
Reloads the job with current data from the long-running, asynchronous processing of a restore operation.
- (Backup::Job) — The same job instance.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new instance = spanner.instance "my-instance" backup = instance.backup "my-backup" job = backup.restore "my-restored-database" job.done? #=> false job.reload! # API call job.done? #=> true
#reload!
def reload!() -> Backup::Job
Reloads the job with current data from the long-running, asynchronous processing of a restore operation.
- (Backup::Job) — The same job instance.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new instance = spanner.instance "my-instance" backup = instance.backup "my-backup" job = backup.restore "my-restored-database" job.done? #=> false job.reload! # API call job.done? #=> true
#start_time
def start_time() -> Time, nil
The operation start time.
- (Time, nil)
#wait_until_done!
def wait_until_done!()
Reloads the job until the operation is complete. The delay between reloads will incrementally increase.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new instance = spanner.instance "my-instance" backup = instance.backup "my-backup" job = backup.restore "my-restored-database" job.done? #=> false job.wait_until_done! job.done? #=> true