summaryrefslogtreecommitdiff
path: root/tools/shell/ShellContext.h
blob: 95805ad0c02f1634469d267ad9e2f8a18d2ac752 (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef TOOLS_SHELL_SHELLCONTEXT
#define TOOLS_SHELL_SHELLCONTEXT

#include <map>
#include <string>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>

#include "DB.h"
#include "DBClientProxy.h"

class ShellState;

class ShellContext : private boost::noncopyable {
 public:
  void changeState(ShellState * pState);

  void stop(void);

  bool ParseInput(void);

  void connect(void);

  void get(const std::string & db,
           const std::string & key);

  void put(const std::string & db,
           const std::string & key,
           const std::string & value);

  void scan(const std::string & db,
            const std::string & start_key,
            const std::string & end_key,
            const std::string & limit);

  void create(const std::string & db);

  void run(void);

  ShellContext(int argc, char ** argv);

 private:
  ShellState * pShellState_;
  bool exit_;
  int argc_;
  char ** argv_;
  int port_;
  boost::shared_ptr<leveldb::DBClientProxy> clientProxy_;
};

#endif