about summary refs log tree commit diff stats
path: root/src/client/client.h
blob: 852ade3164741f9d1da03c4e619bf636b3f22807 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include <cstring>
#include <fcntl.h>
#include <iostream>
#include <optional>
#include <pthread.h>
#include <string>
#include <sys/mman.h>
#include <unistd.h>
#include <utility>

#include "shared_memory.h"
class Client {
public:
    Client();
    ~Client();

    void start_client();

private:
    SharedMemory* shared_memory;
    int shm_fd;

    int send_request(
        SharedMemory* shared_memory,
        Operations type,
        std::optional<const std::string> k,
        std::optional<const std::string> v);
    bool request_processed(SharedMemory* shared_memory, int index);
    std::string process_respond(SharedMemory* shared_memory, int index);
};