Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
common.h
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 
18 #ifndef PLASMA_COMMON_H
19 #define PLASMA_COMMON_H
20 
21 #include <cstring>
22 #include <string>
23 // TODO(pcm): Convert getopt and sscanf in the store to use more idiomatic C++
24 // and get rid of the next three lines:
25 #ifndef __STDC_FORMAT_MACROS
26 #define __STDC_FORMAT_MACROS
27 #endif
28 
29 #include "plasma/compat.h"
30 
31 #include "arrow/status.h"
32 #include "arrow/util/logging.h"
33 
34 namespace plasma {
35 
36 constexpr int64_t kUniqueIDSize = 20;
37 
38 class ARROW_EXPORT UniqueID {
39  public:
40  static UniqueID from_random();
41  static UniqueID from_binary(const std::string& binary);
42  bool operator==(const UniqueID& rhs) const;
43  const uint8_t* data() const;
44  uint8_t* mutable_data();
45  std::string binary() const;
46  std::string hex() const;
47 
48  private:
49  uint8_t id_[kUniqueIDSize];
50 };
51 
52 static_assert(std::is_pod<UniqueID>::value, "UniqueID must be plain old data");
53 
55  // ObjectID hashing function.
56  size_t operator()(const UniqueID& id) const {
57  size_t result;
58  std::memcpy(&result, id.data(), sizeof(size_t));
59  return result;
60  }
61 };
62 
64 
65 arrow::Status plasma_error_status(int plasma_error);
66 
68 constexpr int64_t kDigestSize = sizeof(uint64_t);
69 
71 struct ObjectRequest {
73  ObjectID object_id;
79  int type;
87  int status;
88 };
89 
95 };
96 
97 extern int ObjectStatusLocal;
98 extern int ObjectStatusRemote;
99 
103 struct PlasmaStoreInfo;
104 extern const PlasmaStoreInfo* plasma_config;
105 } // namespace plasma
106 
107 #endif // PLASMA_COMMON_H
int ObjectStatusRemote
The plasma store information that is exposed to the eviction policy.
Definition: plasma.h:129
std::shared_ptr< DataType > binary()
int type
Request associated to the object.
Definition: common.h:79
Object request data structure. Used for Wait.
Definition: common.h:71
UniqueID ObjectID
Definition: common.h:63
Definition: common.h:38
ObjectID object_id
The ID of the requested object. If ID_NIL request any object.
Definition: common.h:73
Definition: status.h:106
constexpr int64_t kDigestSize
Size of object hash digests.
Definition: common.h:68
size_t operator()(const UniqueID &id) const
Definition: common.h:56
arrow::Status plasma_error_status(int plasma_error)
int ObjectStatusLocal
Definition: client.h:35
int status
Object status.
Definition: common.h:87
Definition: common.h:54
ObjectRequestType
Definition: common.h:90
bool operator==(const stl_allocator< T1 > &lhs, const stl_allocator< T2 > &rhs) noexcept
Definition: allocator.h:89
Query for object in the local plasma store.
Definition: common.h:92
constexpr int64_t kUniqueIDSize
Definition: common.h:36
const PlasmaStoreInfo * plasma_config
Query for object in the local plasma store or in a remote plasma store.
Definition: common.h:94