Couchbase Transactions C++ Client  1.0.0
Transactions client for couchbase
document_metadata.hxx
1 /*
2  * Copyright 2021 Couchbase, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cstdint>
20 #include <string>
21 
22 #include <boost/optional.hpp>
23 
24 namespace couchbase
25 {
26 namespace transactions
27 {
32  {
33  public:
40  document_metadata(boost::optional<std::string> cas,
41  boost::optional<std::string> revid,
42  boost::optional<std::uint32_t> exptime,
43  boost::optional<std::string> crc32)
44  : cas_(std::move(cas))
45  , revid_(std::move(revid))
46  , exptime_(exptime)
47  , crc32_(crc32)
48  {
49  }
50 
56  CB_NODISCARD boost::optional<std::string> cas() const
57  {
58  return cas_;
59  }
60 
66  CB_NODISCARD boost::optional<std::string> revid() const
67  {
68  return revid_;
69  }
70 
77  CB_NODISCARD boost::optional<std::uint32_t> exptime() const
78  {
79  return exptime_;
80  }
81 
87  CB_NODISCARD boost::optional<std::string> crc32() const
88  {
89  return crc32_;
90  }
91 
92  private:
93  const boost::optional<std::string> cas_;
94  const boost::optional<std::string> revid_;
95  const boost::optional<std::uint32_t> exptime_;
96  const boost::optional<std::string> crc32_;
97  };
98 } // namespace transactions
99 } // namespace couchbase
CB_NODISCARD boost::optional< std::string > revid() const
Get revid for the document.
Definition: document_metadata.hxx:67
Definition: bucket.hxx:33
document_metadata(boost::optional< std::string > cas, boost::optional< std::string > revid, boost::optional< std::uint32_t > exptime, boost::optional< std::string > crc32)
Create document metadata, given results of a kv operation.
Definition: document_metadata.hxx:41
Stores some $document metadata from when the document is fetched.
Definition: document_metadata.hxx:31
STL namespace.
CB_NODISCARD boost::optional< std::string > crc32() const
Get the crc for the document.
Definition: document_metadata.hxx:88
CB_NODISCARD boost::optional< std::string > cas() const
Get CAS for the document.
Definition: document_metadata.hxx:57
CB_NODISCARD boost::optional< std::uint32_t > exptime() const
Get the expiry of the document, if set.
Definition: document_metadata.hxx:78