zephyrfs/zephyrfs-proto / 039f32b

Browse files

boilerplate

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
039f32b91d83600737b8a3622007b6b5e8cbadd7
Tree
2e6715b

3 changed files

StatusFile+-
A README.md 0 0
A protobuff/coordinator.proto 191 0
A protobuff/node.proto 149 0
README.mdadded
protobuff/coordinator.protoadded
@@ -0,0 +1,191 @@
1
+syntax = "proto3";
2
+
3
+package zephyrfs.coordinator;
4
+
5
+option go_package = "github.com/ZephyrFS/zephyrfs-proto/gen/go/coordinator";
6
+
7
+// Coordinator service for peer discovery and metadata management
8
+service CoordinatorService {
9
+  // Node registration and discovery
10
+  rpc RegisterNode(RegisterNodeRequest) returns (RegisterNodeResponse);
11
+  rpc UnregisterNode(UnregisterNodeRequest) returns (UnregisterNodeResponse);
12
+  rpc GetActiveNodes(GetActiveNodesRequest) returns (GetActiveNodesResponse);
13
+  rpc NodeHeartbeat(NodeHeartbeatRequest) returns (NodeHeartbeatResponse);
14
+  
15
+  // File and chunk coordination
16
+  rpc RegisterFile(RegisterFileRequest) returns (RegisterFileResponse);
17
+  rpc GetFileInfo(GetFileInfoRequest) returns (GetFileInfoResponse);
18
+  rpc UpdateChunkLocations(UpdateChunkLocationsRequest) returns (UpdateChunkLocationsResponse);
19
+  rpc FindChunkLocations(FindChunkLocationsRequest) returns (FindChunkLocationsResponse);
20
+  
21
+  // Network health and monitoring
22
+  rpc GetNetworkStatus(GetNetworkStatusRequest) returns (GetNetworkStatusResponse);
23
+}
24
+
25
+// Node management messages
26
+message RegisterNodeRequest {
27
+  string node_id = 1;
28
+  repeated string addresses = 2;
29
+  int64 storage_capacity = 3;
30
+  map<string, string> capabilities = 4;
31
+}
32
+
33
+message RegisterNodeResponse {
34
+  bool success = 1;
35
+  string message = 2;
36
+  string assigned_node_id = 3;
37
+  repeated string bootstrap_peers = 4;
38
+}
39
+
40
+message UnregisterNodeRequest {
41
+  string node_id = 1;
42
+  string reason = 2;
43
+}
44
+
45
+message UnregisterNodeResponse {
46
+  bool success = 1;
47
+  string message = 2;
48
+}
49
+
50
+message GetActiveNodesRequest {
51
+  int32 limit = 1;
52
+  repeated string exclude_nodes = 2;
53
+}
54
+
55
+message GetActiveNodesResponse {
56
+  repeated NodeStatus nodes = 1;
57
+  int32 total_nodes = 2;
58
+}
59
+
60
+message NodeHeartbeatRequest {
61
+  string node_id = 1;
62
+  NodeStats stats = 2;
63
+}
64
+
65
+message NodeHeartbeatResponse {
66
+  bool success = 1;
67
+  string message = 2;
68
+  repeated string tasks = 3;
69
+}
70
+
71
+// File coordination messages
72
+message RegisterFileRequest {
73
+  string file_id = 1;
74
+  string file_name = 2;
75
+  int64 file_size = 3;
76
+  string file_hash = 4;
77
+  repeated ChunkMetadata chunks = 5;
78
+  string owner_node_id = 6;
79
+}
80
+
81
+message RegisterFileResponse {
82
+  bool success = 1;
83
+  string message = 2;
84
+  repeated ChunkPlacement chunk_placements = 3;
85
+}
86
+
87
+message GetFileInfoRequest {
88
+  string file_id = 1;
89
+}
90
+
91
+message GetFileInfoResponse {
92
+  bool success = 1;
93
+  string message = 2;
94
+  FileRecord file_info = 3;
95
+}
96
+
97
+message UpdateChunkLocationsRequest {
98
+  string chunk_id = 1;
99
+  repeated string node_ids = 2;
100
+  string operation = 3; // "add" or "remove"
101
+}
102
+
103
+message UpdateChunkLocationsResponse {
104
+  bool success = 1;
105
+  string message = 2;
106
+}
107
+
108
+message FindChunkLocationsRequest {
109
+  string chunk_id = 1;
110
+  int32 preferred_count = 2;
111
+}
112
+
113
+message FindChunkLocationsResponse {
114
+  bool success = 1;
115
+  string message = 2;
116
+  repeated string node_ids = 3;
117
+  repeated string node_addresses = 4;
118
+}
119
+
120
+// Network monitoring messages
121
+message GetNetworkStatusRequest {}
122
+
123
+message GetNetworkStatusResponse {
124
+  NetworkStats network_stats = 1;
125
+  repeated NodeStatus active_nodes = 2;
126
+  int64 timestamp = 3;
127
+}
128
+
129
+// Data structures
130
+message NodeStatus {
131
+  string node_id = 1;
132
+  repeated string addresses = 2;
133
+  NodeStats stats = 3;
134
+  int64 last_heartbeat = 4;
135
+  string status = 5; // "active", "inactive", "maintenance"
136
+}
137
+
138
+message NodeStats {
139
+  int64 storage_used = 1;
140
+  int64 storage_available = 2;
141
+  int64 chunks_stored = 3;
142
+  int64 bandwidth_up = 4;
143
+  int64 bandwidth_down = 5;
144
+  double cpu_usage = 6;
145
+  double memory_usage = 7;
146
+  int64 uptime_seconds = 8;
147
+}
148
+
149
+message ChunkMetadata {
150
+  string chunk_id = 1;
151
+  string hash = 2;
152
+  int64 size = 3;
153
+  int32 index = 4;
154
+}
155
+
156
+message ChunkPlacement {
157
+  string chunk_id = 1;
158
+  repeated string target_nodes = 2;
159
+  int32 replication_factor = 3;
160
+}
161
+
162
+message FileRecord {
163
+  string file_id = 1;
164
+  string file_name = 2;
165
+  int64 file_size = 3;
166
+  string file_hash = 4;
167
+  repeated ChunkRecord chunks = 5;
168
+  string owner_node_id = 6;
169
+  int64 created_at = 7;
170
+  int64 last_accessed = 8;
171
+}
172
+
173
+message ChunkRecord {
174
+  string chunk_id = 1;
175
+  string hash = 2;
176
+  int64 size = 3;
177
+  int32 index = 4;
178
+  repeated string stored_at_nodes = 5;
179
+  int32 replication_count = 6;
180
+}
181
+
182
+message NetworkStats {
183
+  int32 total_nodes = 1;
184
+  int32 active_nodes = 2;
185
+  int64 total_storage_capacity = 3;
186
+  int64 total_storage_used = 4;
187
+  int64 total_files = 5;
188
+  int64 total_chunks = 6;
189
+  double average_node_uptime = 7;
190
+  int64 network_uptime_seconds = 8;
191
+}
protobuff/node.protoadded
@@ -0,0 +1,149 @@
1
+syntax = "proto3";
2
+
3
+package zephyrfs.node;
4
+
5
+option go_package = "github.com/ZephyrFS/zephyrfs-proto/gen/go/node";
6
+
7
+// Core message types for P2P communication
8
+service NodeService {
9
+  // Health check for node status
10
+  rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse);
11
+  
12
+  // Peer discovery and connection management
13
+  rpc RegisterPeer(RegisterPeerRequest) returns (RegisterPeerResponse);
14
+  rpc GetPeers(GetPeersRequest) returns (GetPeersResponse);
15
+  
16
+  // Chunk storage operations
17
+  rpc StoreChunk(StoreChunkRequest) returns (StoreChunkResponse);
18
+  rpc RetrieveChunk(RetrieveChunkRequest) returns (RetrieveChunkResponse);
19
+  rpc DeleteChunk(DeleteChunkRequest) returns (DeleteChunkResponse);
20
+  
21
+  // File metadata operations
22
+  rpc StoreMetadata(StoreMetadataRequest) returns (StoreMetadataResponse);
23
+  rpc RetrieveMetadata(RetrieveMetadataRequest) returns (RetrieveMetadataResponse);
24
+}
25
+
26
+// Health check messages
27
+message HealthCheckRequest {}
28
+
29
+message HealthCheckResponse {
30
+  string status = 1;
31
+  int64 timestamp = 2;
32
+  NodeInfo node_info = 3;
33
+}
34
+
35
+// Peer management messages
36
+message RegisterPeerRequest {
37
+  PeerInfo peer = 1;
38
+}
39
+
40
+message RegisterPeerResponse {
41
+  bool success = 1;
42
+  string message = 2;
43
+}
44
+
45
+message GetPeersRequest {
46
+  int32 limit = 1;
47
+}
48
+
49
+message GetPeersResponse {
50
+  repeated PeerInfo peers = 1;
51
+}
52
+
53
+// Chunk storage messages
54
+message StoreChunkRequest {
55
+  string chunk_id = 1;
56
+  bytes data = 2;
57
+  string hash = 3;
58
+  int64 size = 4;
59
+  map<string, string> metadata = 5;
60
+}
61
+
62
+message StoreChunkResponse {
63
+  bool success = 1;
64
+  string message = 2;
65
+  string stored_hash = 3;
66
+}
67
+
68
+message RetrieveChunkRequest {
69
+  string chunk_id = 1;
70
+  string expected_hash = 2;
71
+}
72
+
73
+message RetrieveChunkResponse {
74
+  bool success = 1;
75
+  string message = 2;
76
+  bytes data = 3;
77
+  string hash = 4;
78
+  int64 size = 5;
79
+}
80
+
81
+message DeleteChunkRequest {
82
+  string chunk_id = 1;
83
+  string reason = 2;
84
+}
85
+
86
+message DeleteChunkResponse {
87
+  bool success = 1;
88
+  string message = 2;
89
+}
90
+
91
+// Metadata messages
92
+message StoreMetadataRequest {
93
+  string file_id = 1;
94
+  FileMetadata metadata = 2;
95
+}
96
+
97
+message StoreMetadataResponse {
98
+  bool success = 1;
99
+  string message = 2;
100
+}
101
+
102
+message RetrieveMetadataRequest {
103
+  string file_id = 1;
104
+}
105
+
106
+message RetrieveMetadataResponse {
107
+  bool success = 1;
108
+  string message = 2;
109
+  FileMetadata metadata = 3;
110
+}
111
+
112
+// Data structures
113
+message NodeInfo {
114
+  string node_id = 1;
115
+  string version = 2;
116
+  repeated string addresses = 3;
117
+  int64 storage_available = 4;
118
+  int64 storage_used = 5;
119
+  int64 uptime_seconds = 6;
120
+  string status = 7;
121
+}
122
+
123
+message PeerInfo {
124
+  string peer_id = 1;
125
+  repeated string addresses = 2;
126
+  int64 last_seen = 3;
127
+  string status = 4;
128
+  double reputation_score = 5;
129
+}
130
+
131
+message FileMetadata {
132
+  string file_id = 1;
133
+  string name = 2;
134
+  int64 size = 3;
135
+  string mime_type = 4;
136
+  string hash = 5;
137
+  repeated ChunkInfo chunks = 6;
138
+  int64 created_at = 7;
139
+  int64 modified_at = 8;
140
+  map<string, string> user_metadata = 9;
141
+}
142
+
143
+message ChunkInfo {
144
+  string chunk_id = 1;
145
+  string hash = 2;
146
+  int64 size = 3;
147
+  int32 index = 4;
148
+  repeated string stored_at_peers = 5;
149
+}