-
Notifications
You must be signed in to change notification settings - Fork 1
/
kvs_client_test.h
28 lines (25 loc) · 911 Bytes
/
kvs_client_test.h
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
#ifndef CHIRP_KVS_CLIENT_TEST_H
#define CHIRP_KVS_CLIENT_TEST_H
#include <string>
#include <thread>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <grpcpp/grpcpp.h>
#include "kvs_client_interface.h"
#include "kvs_backend.h"
#include "KeyValueStore.grpc.pb.h"
// client for key value store backend (only used in testing)
class KeyValueClientTest : public KeyValueClientInterface{
public:
// put `key` and `value` into backend key value store
bool put(const std::string &key, const std::string &value);
// get `value` from backend key value store, provided `key`
std::string get(const std::string &key);
// delete key value pair associate with `key` parameter in backend
bool deletekey(const std::string &key);
private:
// backend is directly stored as a member variable
// to avoid gRPC in testing
KeyValueBackend kvs_backend_;
};
#endif // CHIRP_KVS_CLIENT_TEST_H