1#pragma once
2
3#include <cstddef>
4
5
6namespace DB
7{
8
9/** Struct containing a pipe with lazy initialization.
10 * Use `open` and `close` methods to manipulate pipe and `fds_rw` field to access
11 * pipe's file descriptors.
12 */
13struct LazyPipeFDs
14{
15 int fds_rw[2] = {-1, -1};
16
17 void open();
18 void close();
19
20 void setNonBlocking();
21 void tryIncreaseSize(int desired_size);
22
23 ~LazyPipeFDs();
24};
25
26
27/** Struct which opens new pipe on creation and closes it on destruction.
28 * Use `fds_rw` field to access pipe's file descriptors.
29 */
30struct PipeFDs : public LazyPipeFDs
31{
32 PipeFDs();
33};
34
35}
36