google-cloud-spanner 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62f5ce383d6aefe48214924e77b5a794bd0a0c03bb6acaedd383be12d47da9b9
4
- data.tar.gz: ed1e49a6ef47946d557f8cb768d6da33923179fa05551ea7fadd55f3f5cfe341
3
+ metadata.gz: f6bfbaef2aa9726c4f6546f22d9ad3da14cdd74f1d5704f0af88aaa197285af7
4
+ data.tar.gz: b21b4f7ce50132358a00b6d4f2723e2299b449edf7cdb50652263f3dc1e7a417
5
5
  SHA512:
6
- metadata.gz: 4b22e83c54208f8961e267a81ef681f98ef7e2ffe9a48274e566899adfed7c514c3a124b9f747667908db89067cbe0715f8c1363635d75cd4461f9072f703819
7
- data.tar.gz: '085550ca4945d0436fd92f94adb16464d30224f5f466ca1f3becb24bdcf0b8bc4fa0416d2f26ecc375ca71eadface1856702dac02a7093bda001ce4e37be359d'
6
+ metadata.gz: 2b26a10becd37ce0527996754eb16f368635269144f584d5cf1c25f17285d280f847e58ca49ccd942fb7adff59779e2a63f5c90987f548786759a5b65b337e49
7
+ data.tar.gz: 4e46cc9fddeb100349f410c08ef2b7d21fe0f43f6368e5ee3d2e6231c4da4ed7eb781fafb795408fbfadaca29dbcefc2b55ef290ccd39eab74d953959f59838b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Release History
2
2
 
3
+ ### 2.4.0 / 2021-02-18
4
+
5
+ #### Features
6
+
7
+ * Point In Time Recovery (PITR) ([#8169](https://www.github.com/googleapis/google-cloud-ruby/issues/8169))
8
+ * feat(spanner): support pitr-lite
9
+ * feature(spanner): adds test for throttled
10
+ * feat(spanner): adds version time to backup
11
+ * test(spanner): adds unit test for create backup
12
+ * feat(spanner): exposes version time in backup
13
+ * chore: fixes rubocop violations
14
+ * fix: addresses PR comments
15
+ * test: adds integration tests for pitr backup
16
+
3
17
  ### 2.3.0 / 2021-02-09
4
18
 
5
19
  #### Features
@@ -160,6 +160,14 @@ module Google
160
160
  raise error
161
161
  end
162
162
 
163
+ ##
164
+ # The timestamp when a consistent copy of the database for the backup was
165
+ # taken. The version time has microseconds granularity.
166
+ # @return [Time]
167
+ def version_time
168
+ Convert.timestamp_to_time @grpc.version_time
169
+ end
170
+
163
171
  ##
164
172
  # Create time is approximately the time when the backup request was
165
173
  # received.
@@ -85,6 +85,18 @@ module Google
85
85
  @grpc.name.split("/")[5]
86
86
  end
87
87
 
88
+ # The version retention period for a database.
89
+ # @return [String]
90
+ def version_retention_period
91
+ @grpc.version_retention_period
92
+ end
93
+
94
+ # The earliest available version time for a database.
95
+ # @return [Time]
96
+ def earliest_version_time
97
+ Convert.timestamp_to_time @grpc.earliest_version_time
98
+ end
99
+
88
100
  ##
89
101
  # The full path for the database resource. Values are of the form
90
102
  # `projects/<project_id>/instances/<instance_id>/databases/<database_id>`.
@@ -400,6 +412,11 @@ module Google
400
412
  # 366 days from the time the request is received. Required.
401
413
  # Once the `expire_time` has passed, Cloud Spanner will delete the
402
414
  # backup and free the resources used by the backup. Required.
415
+ # @param [Time] version_time Specifies the time to have an externally
416
+ # consistent copy of the database. If no version time is specified,
417
+ # it will be automatically set to the backup create time. The version
418
+ # time can be as far in the past as specified by the database earliest
419
+ # version time. Optional.
403
420
  # @return [Google::Cloud::Spanner::Backup::Job] The job representing
404
421
  # the long-running, asynchronous processing of a backup create
405
422
  # operation.
@@ -410,7 +427,11 @@ module Google
410
427
  # spanner = Google::Cloud::Spanner.new
411
428
  # database = spanner.database "my-instance", "my-database"
412
429
  #
413
- # job = database.create_backup "my-backup", Time.now + 36000
430
+ # backup_id = "my-backup"
431
+ # expire_time = Time.now + (24 * 60 * 60) # 1 day from now
432
+ # version_time = Time.now - (24 * 60 * 60) # 1 day ago (optional)
433
+ #
434
+ # job = database.create_backup backup_id, expire_time, version_time: version_time
414
435
  #
415
436
  # job.done? #=> false
416
437
  # job.reload! # API call
@@ -422,13 +443,14 @@ module Google
422
443
  # backup = job.backup
423
444
  # end
424
445
  #
425
- def create_backup backup_id, expire_time
446
+ def create_backup backup_id, expire_time, version_time: nil
426
447
  ensure_service!
427
448
  grpc = service.create_backup \
428
449
  instance_id,
429
450
  database_id,
430
451
  backup_id,
431
- expire_time
452
+ expire_time,
453
+ version_time
432
454
  Backup::Job.from_grpc grpc, service
433
455
  end
434
456
 
@@ -84,14 +84,23 @@ module Google
84
84
  end
85
85
 
86
86
  ##
87
- # The backup contains an externally consistent copy of
88
- # `source_database` at the timestamp specified by `create_time`.
89
- # received.
87
+ # The timestamp indicating the creation of the backup.
90
88
  # @return [Time]
91
89
  def create_time
92
90
  Convert.timestamp_to_time @grpc.create_time
93
91
  end
94
92
 
93
+ ##
94
+ # The backup contains an externally consistent copy of
95
+ # `source_database` at the timestamp specified by
96
+ # the `version_time` received. If no `version_time` was
97
+ # given during the creation of the backup, the `version_time`
98
+ # will be the same as the `create_time`.
99
+ # @return [Time]
100
+ def version_time
101
+ Convert.timestamp_to_time @grpc.version_time
102
+ end
103
+
95
104
  ##
96
105
  # @private Creates a new Database::BackupInfo instance from a
97
106
  # `Google::Cloud::Spanner::Admin::Database::V1::BackupInfo`.
@@ -464,11 +464,12 @@ module Google
464
464
  end
465
465
 
466
466
  def create_backup instance_id, database_id, backup_id, expire_time,
467
- call_options: nil
467
+ version_time, call_options: nil
468
468
  opts = default_options call_options: call_options
469
469
  backup = {
470
470
  database: database_path(instance_id, database_id),
471
- expire_time: expire_time
471
+ expire_time: expire_time,
472
+ version_time: version_time
472
473
  }
473
474
  request = {
474
475
  parent: instance_path(instance_id),
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Spanner
19
- VERSION = "2.3.0".freeze
19
+ VERSION = "2.4.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-spanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-02-09 00:00:00.000000000 Z
12
+ date: 2021-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core