Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ A distributed file storage system built with **Spring Boot** that demonstrates c
Gateway (:8080) ──────────────► ZAB Metadata Cluster
│ ├─ Node 1 (:8081) [Leader]
│ ├─ Node 2 (:8082) [Follower]
│ └─ Node 3 (:8083) [Follower]
├──► Storage Node 1 (:9001)
├──► Storage Node 2 (:9002)
├──► Storage Node 3 (:9003)
└──► Storage Node 4 (:9004)

│ ├─ Node 1 (:8081) [Leader]
│ ├─ Node 2 (:8082) [Follower]
│ └─ Node 3 (:8083) [Follower]
├──► Storage Node 1 (:9001)
├──► Storage Node 2 (:9002)
├──► Storage Node 3 (:9003)
└──► Storage Node 4 (:9004)
```

| Layer | Role |
Expand Down
4 changes: 2 additions & 2 deletions demo-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/png" href="/needo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>demo-ui</title>
<title>Needo</title>
</head>
<body>
<div id="root"></div>
Expand Down
Binary file added demo-ui/public/needo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
675 changes: 349 additions & 326 deletions demo-ui/src/App.tsx

Large diffs are not rendered by default.

36 changes: 30 additions & 6 deletions demo-ui/src/index.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
@import "tailwindcss";

@theme {
--color-brand-50: #f0fdf4;
--color-brand-100: #dcfce7;
--color-brand-500: #22c55e;
--color-brand-600: #16a34a;
--font-sans: "Inter Tight", sans-serif;
--color-apple-50: #fbfbfb;
--color-apple-100: #f5f5f7;
--color-apple-200: #e8e8ed;
--color-apple-500: #86868b;
--color-apple-900: #1d1d1f;

--color-status-success: #34c759;
--color-status-error: #ff3b30;
--color-status-warning: #ff9500;

--font-sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

--radius-apple: 12px;
--radius-apple-lg: 20px;
--radius-apple-xl: 32px;
}

@layer base {
body {
@apply bg-gray-50 text-gray-900 font-sans antialiased;
@apply bg-white text-apple-900 font-sans antialiased selection:bg-apple-200 selection:text-apple-900;
}
}

@layer components {
.apple-card {
@apply bg-apple-50 border border-apple-100 shadow-sm rounded-apple-lg;
}

.apple-button-primary {
@apply bg-apple-900 text-white rounded-full px-6 py-2 transition-all hover:bg-black active:scale-95;
}

.apple-button-secondary {
@apply bg-apple-200 text-apple-900 rounded-full px-6 py-2 transition-all hover:bg-apple-100 active:scale-95;
}
}
21 changes: 21 additions & 0 deletions src/main/java/com/example/demo/apigateway/GatewayController.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,27 @@ private Map<String, Object> getDashboardStats() {
return stats;
}

/**
* Simulation: Chaos Toggle Proxy - Forward commands to nodes.
*/
@PostMapping("/api/chaos/toggle")
public ResponseEntity<String> toggleNode(@RequestBody Map<String, String> payload) {
String url = payload.get("url");
if (url == null) return ResponseEntity.badRequest().body("No URL provided");

try {
HttpRequest req = HttpRequest.newBuilder(URI.create(url + "/chaos/toggle"))
.timeout(Duration.ofSeconds(2))
.POST(BodyPublishers.noBody())
.build();

HttpResponse<String> res = client.send(req, BodyHandlers.ofString());
return ResponseEntity.status(res.statusCode()).body(res.body());
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body("Proxy fail: " + e.getMessage());
}
}

/**
* List all uploaded files
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.client.RestTemplate;
import io.grpc.StatusRuntimeException;
import com.example.demo.cluster.StatusResponse;
import com.example.demo.cluster .StatusResponse;

import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down
Loading