試験ノート - 実装ドリル 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
comment_only.hpp
1// =================================
2// header guard
3// =================================
4// MINI_DB_HPP
5
6// =================================
7// includes
8// =================================
9// tip : sys/select.h
10// map, string
11
12// =================================
13// class MiniDb
14// =================================
15
16// class MiniDb {
17// public:
18// // ctor(port, path) / dtor
19// // setup()
20// // run()
21// // save() const
22//
23// private:
24// // 状態 (引数)
25// // port_ : int
26// // path_ : string
27// // 状態 (ソケット)
28// // listen_fd_ : int
29// // max_fd_ : int
30// // active_fds_ : fd_set
31// // 状態 (受信)
32// // buffers_ : map<int, string> // fd -> 未完成行
33// // 状態 (KV 本体)
34// // db_ : map<string, string>
35//
36// // load() // setup() 内で呼ばれる
37// // accept_client() // listen_fd_ がレディ
38// // recv_data(fd) // client fd がレディ
39// // disconnect(fd) // 切断 / cleanup
40// // handle_command(line) -> str // POST/GET/DELETE を解釈し応答文字列を返す
41//
42// // コピー禁止 (private 宣言のみ、実体なし)
43// // MiniDb(const MiniDb&)
44// // operator=(const MiniDb&)
45// };
46
47// =================================
48// free function
49// =================================
50// void fatal(); // "Fatal error" -> exit(1)