-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (26 loc) · 958 Bytes
/
main.cpp
File metadata and controls
33 lines (26 loc) · 958 Bytes
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
#include <iostream>
#include "my_hash.h"
#include <sys/types.h>
#include <winsock2.h>
using namespace std;
#pragma comment(lib, "ws2_32.lib")
int main() {
consistent_hash hash = consistent_hash();
hash.add_real_node("192.168.2.136", 300);
hash.put("metang1996");
hash.put("buaa");
hash.put("hello world");
hash.put("test add data");
hash.put("python");
hash.put("c++");
cout << endl << "---------------------------------step 1---------------------------------" << endl;
hash.print();
cout << endl << "---------------------------------step 2---------------------------------" << endl;
hash.add_real_node("192.168.2.137", 300);
hash.add_real_node("192.168.2.138", 300);
hash.print();
cout << endl << "---------------------------------step 3---------------------------------" << endl;
hash.drop_real_node("192.168.2.136");
hash.print();
return 0;
}