Reference documentation and code samples for the Cloud Spanner API class Google::Cloud::Spanner::Backup::Job.
Job
A resource representing the long-running, asynchronous processing of backup creation. The job can be refreshed to retrieve the backup object once the operation has been completed.
See {Google::Cloud::Spanner::Database#create_backup}
{Google::Cloud::Spanner::Admin::Database#database_admin Client#create_backup} instead.
Inherits
- Object
Example
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new database = spanner.database "my-instance", "my-database" expire_time = Time.now + 36000 job = database.create_backup "my-backup", expire_time job.done? #=> false job.reload! # API call job.done? #=> true if job.error? status = job.error else backup = job.backup end
Methods
#backup
def backup() -> Backup, nil
The backup is the object of the operation.
-
(Backup, nil) — The backup, or
nil
if the operation is not complete.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new database = spanner.database "my-instance", "my-database" expire_time = Time.now + 36000 job = database.create_backup "my-backup", expire_time job.done? #=> false job.reload! job.done? #=> true backup = job.backup
#cancel
def cancel()
Cancel the backup job.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new database = spanner.database "my-instance", "my-database" expire_time = Time.now + 36000 job = database.create_backup "my-backup", expire_time job.done? #=> false job.cancel
#cancel_time
def cancel_time() -> Time, nil
The operation canceled time.
- (Time, nil)
#done?
def done?() -> boolean
Checks if the processing of the backup operation is complete.
-
(boolean) —
true
when complete,false
otherwise.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new database = spanner.database "my-instance", "my-database" expire_time = Time.now + 36000 job = database.create_backup "my-backup", expire_time 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 database = spanner.database "my-instance", "my-database" expire_time = Time.now + 36000 job = database.create_backup "my-backup", expire_time job.error? # true error = job.error
#error?
def error?() -> boolean
Checks if the processing of the backup operation has errored.
-
(boolean) —
true
when errored,false
otherwise.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new database = spanner.database "my-instance", "my-database" expire_time = Time.now + 36000 job = database.create_backup "my-backup", expire_time job.error? #=> false
#progress_percent
def progress_percent() -> Integer
The operation progress in percentage.
- (Integer)
#refresh!
def refresh!() -> Google::Cloud::Spanner::Backup::Job
Reloads the job with current data from the long-running, asynchronous processing of a backup operation.
- (Google::Cloud::Spanner::Backup::Job) — The same job instance.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new database = spanner.database "my-instance", "my-database" expire_time = Time.now + 36000 job = database.create_backup "my-backup", expire_time job.done? #=> false job.reload! # API call job.done? #=> true
#reload!
def reload!() -> Google::Cloud::Spanner::Backup::Job
Reloads the job with current data from the long-running, asynchronous processing of a backup operation.
- (Google::Cloud::Spanner::Backup::Job) — The same job instance.
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new database = spanner.database "my-instance", "my-database" expire_time = Time.now + 36000 job = database.create_backup "my-backup", expire_time 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 database = spanner.database "my-instance", "my-database" expire_time = Time.now + 36000 job = database.create_backup "my-backup", expire_time job.done? #=> false job.wait_until_done! job.done? #=> true