Google Cloud Spanner C++ Client
A C++ Client Library for Google Cloud Spanner
backup.cc
Go to the documentation of this file.
1 // Copyright 2020 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
16 
17 namespace google {
18 namespace cloud {
19 namespace spanner {
20 inline namespace SPANNER_CLIENT_NS {
21 
22 Backup::Backup(Instance instance, std::string backup_id)
23  : instance_(std::move(instance)), backup_id_(std::move(backup_id)) {}
24 
25 std::string Backup::FullName() const {
26  return instance().FullName() + "/backups/" + backup_id_;
27 }
28 
29 bool operator==(Backup const& a, Backup const& b) {
30  return a.instance_ == b.instance_ && a.backup_id_ == b.backup_id_;
31 }
32 
33 bool operator!=(Backup const& a, Backup const& b) { return !(a == b); }
34 
35 std::ostream& operator<<(std::ostream& os, Backup const& bn) {
36  return os << bn.FullName();
37 }
38 
39 } // namespace SPANNER_CLIENT_NS
40 } // namespace spanner
41 } // namespace cloud
42 } // namespace google
This class identifies a Cloud Spanner Backup.
Definition: backup.h:38
bool operator!=(Backup const &a, Backup const &b)
Definition: backup.cc:33
This class identifies a Cloud Spanner Instance.
Definition: instance.h:41
bool operator==(Backup const &a, Backup const &b)
Definition: backup.cc:29
Contains all the Cloud Spanner C++ client types and functions.
#define SPANNER_CLIENT_NS
Definition: version.h:22
Instance const & instance() const
Returns the Instance containing this backup.
Definition: backup.h:59
std::string FullName() const
Returns the fully qualified instance name as a string of the form: "projects/<project-id>/instances/<...
Definition: instance.cc:27
std::string FullName() const
Returns the fully qualified backup name as a string of the form: "projects/<project-id>/instances/<in...
Definition: backup.cc:25
std::ostream & operator<<(std::ostream &os, Backup const &bn)
Definition: backup.cc:35