Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
io.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_IO_H
19 #define PLASMA_IO_H
20 
21 #include <inttypes.h>
22 #include <sys/socket.h>
23 #include <sys/un.h>
24 #include <unistd.h>
25 
26 #include <string>
27 #include <vector>
28 
29 #include "arrow/status.h"
30 #include "plasma/compat.h"
31 
32 // TODO(pcm): Replace our own custom message header (message type,
33 // message length, plasma protocol verion) with one that is serialized
34 // using flatbuffers.
35 #define PLASMA_PROTOCOL_VERSION 0x0000000000000000
36 #define DISCONNECT_CLIENT 0
37 
38 namespace plasma {
39 
40 using arrow::Status;
41 
42 Status WriteBytes(int fd, uint8_t* cursor, size_t length);
43 
44 Status WriteMessage(int fd, int64_t type, int64_t length, uint8_t* bytes);
45 
46 Status ReadBytes(int fd, uint8_t* cursor, size_t length);
47 
48 Status ReadMessage(int fd, int64_t* type, std::vector<uint8_t>* buffer);
49 
50 int bind_ipc_sock(const std::string& pathname, bool shall_listen);
51 
52 int connect_ipc_sock(const std::string& pathname);
53 
54 Status ConnectIpcSocketRetry(const std::string& pathname, int num_retries,
55  int64_t timeout, int* fd);
56 
57 int AcceptClient(int socket_fd);
58 
59 uint8_t* read_message_async(int sock);
60 
61 } // namespace plasma
62 
63 #endif // PLASMA_IO_H
Status ConnectIpcSocketRetry(const std::string &pathname, int num_retries, int64_t timeout, int *fd)
Status WriteBytes(int fd, uint8_t *cursor, size_t length)
Definition: status.h:106
uint8_t * read_message_async(int sock)
int AcceptClient(int socket_fd)
Status WriteMessage(int fd, int64_t type, int64_t length, uint8_t *bytes)
int connect_ipc_sock(const std::string &pathname)
Definition: client.h:35
Status ReadMessage(int fd, int64_t *type, std::vector< uint8_t > *buffer)
int bind_ipc_sock(const std::string &pathname, bool shall_listen)
Status ReadBytes(int fd, uint8_t *cursor, size_t length)