-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.h
More file actions
81 lines (71 loc) · 2.73 KB
/
Copy pathdata.h
File metadata and controls
81 lines (71 loc) · 2.73 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef SRC_DATA_H
#define SRC_DATA_H
#include <vector>
#include <list>
#include <map>
#include <fstream>
const int MaxDiskNum = 10 + 1;
const int MaxDiskSize = 16384 + 1;
const int MaxRequestNum = 30000000 + 1;
const int MaxObjectNum = 100000 + 1;
const int RepNum = 3;
const int FrePerSlicing = 1800;
const int ExtraTime = 105;
typedef struct Request_ {
int request_id; // ID of this request
int object_id; // Object ID to read in this request
int prev_id; // Previous request ID for this object
bool is_done; // Whether this read is completed
int timestamp;
Request_() : request_id(0), object_id(0), prev_id(0), is_done(false), timestamp(0) {}
Request_(int req_id, int obj_id, int prev, bool done)
: request_id(req_id), object_id(obj_id), prev_id(prev), is_done(done), timestamp(0) {}
} Request;
typedef struct Object_ {
int replica[RepNum + 1]; // Stores the disk IDs of the 3 replicas
std::vector<std::vector<int>> unit; // Stores the position of object blocks for each replica on the disk
std::vector<int>read_phase;
int size;
int tag;
int last_request_point; // Stores the request ID of the last read for this object
bool is_delete;
bool is_requested;
std::list<int> request_ids;
int assigned_disk;
int assigned_point_index;
Object_() : unit(RepNum + 1),read_phase(RepNum + 1), is_requested(false), request_ids(), assigned_disk(0), assigned_point_index(-1) {}
} Object;
class SharedData {
double pearsonCorrelation(const std::vector<int>& series1, const std::vector<int>& series2);
std::vector<std::vector<double>> Count_Correlation(const std::vector<std::vector<int>>& timeSeries);
std::pair<int, int> findMaxCorrelationPair(const std::vector<std::vector<double>>& correlationMatrix, std::vector<bool>& paired);
// void proportion();
public:
SharedData();
// Singleton access point
static SharedData& instance() {
static SharedData instance;
return instance;
}
// Delete copy constructor to ensure singleton
SharedData(const SharedData&) = delete;
SharedData& operator=(const SharedData&) = delete;
int T, M, N, V, G, K;
double buffer = 0;
int timestamp;
std::vector<std::vector<int>> disk;
//std::vector<int> disk_point;
std::vector<std::vector<int>> disk_point;
std::vector<Request> request;
std::vector<Object> object;
std::vector<std::vector<int>> fre_del, fre_write, fre_read;
std::vector<int> disk_partition; // Disk partition
std::vector<int> tag_max_capacity; // Max capacity per tag
std::vector<int> readable_labels;
std::vector<int> label_assignment;
// std::vector<int>
std::vector<int> vec;
int request_num;
int refuse_index = 0;
};
#endif //SRC_DATA_H