]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/db/write_batch_base.cc
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / rocksdb / db / write_batch_base.cc
CommitLineData
7c673cae 1// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
11fdf7f2
TL
2// This source code is licensed under both the GPLv2 (found in the
3// COPYING file in the root directory) and Apache 2.0 License
4// (found in the LICENSE.Apache file in the root directory).
7c673cae
FG
5
6#include "rocksdb/write_batch_base.h"
7
8#include <string>
9
10#include "rocksdb/slice.h"
11#include "rocksdb/status.h"
12
f67539c2 13namespace ROCKSDB_NAMESPACE {
7c673cae
FG
14
15// Simple implementation of SlicePart variants of Put(). Child classes
16// can override these method with more performant solutions if they choose.
17Status WriteBatchBase::Put(ColumnFamilyHandle* column_family,
18 const SliceParts& key, const SliceParts& value) {
19 std::string key_buf, value_buf;
20 Slice key_slice(key, &key_buf);
21 Slice value_slice(value, &value_buf);
22
23 return Put(column_family, key_slice, value_slice);
24}
25
26Status WriteBatchBase::Put(const SliceParts& key, const SliceParts& value) {
27 std::string key_buf, value_buf;
28 Slice key_slice(key, &key_buf);
29 Slice value_slice(value, &value_buf);
30
31 return Put(key_slice, value_slice);
32}
33
34Status WriteBatchBase::Delete(ColumnFamilyHandle* column_family,
35 const SliceParts& key) {
36 std::string key_buf;
37 Slice key_slice(key, &key_buf);
38 return Delete(column_family, key_slice);
39}
40
41Status WriteBatchBase::Delete(const SliceParts& key) {
42 std::string key_buf;
43 Slice key_slice(key, &key_buf);
44 return Delete(key_slice);
45}
46
47Status WriteBatchBase::SingleDelete(ColumnFamilyHandle* column_family,
48 const SliceParts& key) {
49 std::string key_buf;
50 Slice key_slice(key, &key_buf);
51 return SingleDelete(column_family, key_slice);
52}
53
54Status WriteBatchBase::SingleDelete(const SliceParts& key) {
55 std::string key_buf;
56 Slice key_slice(key, &key_buf);
57 return SingleDelete(key_slice);
58}
59
60Status WriteBatchBase::DeleteRange(ColumnFamilyHandle* column_family,
61 const SliceParts& begin_key,
62 const SliceParts& end_key) {
63 std::string begin_key_buf, end_key_buf;
64 Slice begin_key_slice(begin_key, &begin_key_buf);
65 Slice end_key_slice(end_key, &end_key_buf);
66 return DeleteRange(column_family, begin_key_slice, end_key_slice);
67}
68
69Status WriteBatchBase::DeleteRange(const SliceParts& begin_key,
70 const SliceParts& end_key) {
71 std::string begin_key_buf, end_key_buf;
72 Slice begin_key_slice(begin_key, &begin_key_buf);
73 Slice end_key_slice(end_key, &end_key_buf);
74 return DeleteRange(begin_key_slice, end_key_slice);
75}
76
77Status WriteBatchBase::Merge(ColumnFamilyHandle* column_family,
78 const SliceParts& key, const SliceParts& value) {
79 std::string key_buf, value_buf;
80 Slice key_slice(key, &key_buf);
81 Slice value_slice(value, &value_buf);
82
83 return Merge(column_family, key_slice, value_slice);
84}
85
86Status WriteBatchBase::Merge(const SliceParts& key, const SliceParts& value) {
87 std::string key_buf, value_buf;
88 Slice key_slice(key, &key_buf);
89 Slice value_slice(value, &value_buf);
90
91 return Merge(key_slice, value_slice);
92}
93
f67539c2 94} // namespace ROCKSDB_NAMESPACE