# sreejithore/distributed-file-system architecture

> Architecture diagram of the GitHub repository sreejithore/distributed-file-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sreejithore/distributed-file-system
- Repository: https://github.com/sreejithore/distributed-file-system

## Overview

This is a local-process simulation of a fault-tolerant distributed file system. The principal workflow is a user uploading a file through the Streamlit client: the client checks version information with the master, splits and hashes the file, registers chunk locations, and sends chunk data to storage workers. Downloads retrieve chunks and reassemble them; the master also tracks node health and repairs under-replicated data. The README documents registry, previews, deletion, and analytics capabilities. Connections involving unsampled app sections are based on that documentation; no other source files were available to inspect.

Main entry points: [`app.py`](https://github.com/sreejithore/distributed-file-system/blob/main/app.py) (Streamlit dashboard), [`master_node.py`](https://github.com/sreejithore/distributed-file-system/blob/main/master_node.py) (Master RPC services), [`data_node.py`](https://github.com/sreejithore/distributed-file-system/blob/main/data_node.py) (Data node RPC), [`client_logic.py`](https://github.com/sreejithore/distributed-file-system/blob/main/client_logic.py) (Chunk split and stitch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_cluster_views["Health and analytics<br/>[app.py]"]
  node_file_registry["Versioned registry<br/>[app.py]"]
  node_image_preview["Image preview<br/>[app.py]"]
  node_download_ui["Download matrix<br/>[app.py]"]
end

subgraph group_transfer["File transfer"]
  node_chunk_codec["Chunk split and stitch<br/>[client_logic.py]"]
  node_download_folder[("Recovered files")]
end

subgraph group_master["Master services"]
  node_master_api["Master RPC services<br/>[master_node.py]"]
  node_node_tracker["Heartbeat tracking<br/>[master_node.py]"]
  node_metadata_store[("SQLite metadata<br/>[master_metadata.db]")]
  node_replication_monitor["Replication monitor<br/>[master_node.py]"]
end

subgraph group_workers["Storage workers"]
  node_data_node_service["Data node RPC<br/>[data_node.py]"]
  node_local_chunks[("Chunk files")]
  node_worker_heartbeat["Heartbeat worker<br/>[data_node.py]"]
  node_garbage_collector["Orphan cleanup<br/>[data_node.py]"]
end

node_user(("DFS user"))

node_user -->|"uses"| node_dashboard
node_dashboard -->|"renders"| node_cluster_views
node_dashboard -->|"renders"| node_file_registry
node_dashboard -->|"opens"| node_image_preview
node_dashboard -->|"opens"| node_download_ui
node_dashboard -->|"splits files"| node_chunk_codec
node_dashboard -->|"requests versions"| node_master_api
node_dashboard -->|"registers chunks"| node_master_api
node_dashboard -->|"sends chunks"| node_data_node_service
node_cluster_views -->|"requests status"| node_master_api
node_file_registry -->|"reads registry"| node_master_api
node_file_registry -->|"deletes files"| node_master_api
node_download_ui -->|"locates chunks"| node_master_api
node_download_ui -->|"fetches chunks"| node_data_node_service
node_download_ui -->|"reassembles file"| node_chunk_codec
node_chunk_codec -->|"writes output"| node_download_folder
node_master_api -->|"reads and writes"| node_metadata_store
node_master_api -->|"tracks health"| node_node_tracker
node_worker_heartbeat -->|"reports health"| node_node_tracker
node_data_node_service -->|"reads and writes"| node_local_chunks
node_replication_monitor -->|"replicates chunks"| node_data_node_service
node_replication_monitor -->|"records replicas"| node_metadata_store
node_garbage_collector -->|"checks registration"| node_master_api
node_garbage_collector -->|"removes orphans"| node_local_chunks

click node_dashboard "https://github.com/sreejithore/distributed-file-system/blob/main/app.py"
click node_cluster_views "https://github.com/sreejithore/distributed-file-system/blob/main/app.py"
click node_file_registry "https://github.com/sreejithore/distributed-file-system/blob/main/app.py"
click node_image_preview "https://github.com/sreejithore/distributed-file-system/blob/main/app.py"
click node_download_ui "https://github.com/sreejithore/distributed-file-system/blob/main/app.py"
click node_chunk_codec "https://github.com/sreejithore/distributed-file-system/blob/main/client_logic.py"
click node_master_api "https://github.com/sreejithore/distributed-file-system/blob/main/master_node.py"
click node_node_tracker "https://github.com/sreejithore/distributed-file-system/blob/main/master_node.py"
click node_metadata_store "https://github.com/sreejithore/distributed-file-system/blob/main/master_metadata.db"
click node_replication_monitor "https://github.com/sreejithore/distributed-file-system/blob/main/master_node.py"
click node_data_node_service "https://github.com/sreejithore/distributed-file-system/blob/main/data_node.py"
click node_local_chunks "https://github.com/sreejithore/distributed-file-system/tree/main/storage_node_5001"
click node_worker_heartbeat "https://github.com/sreejithore/distributed-file-system/blob/main/data_node.py"
click node_garbage_collector "https://github.com/sreejithore/distributed-file-system/blob/main/data_node.py"
click node_download_folder "https://github.com/sreejithore/distributed-file-system/tree/main/downloads"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_cluster_views,node_file_registry,node_image_preview,node_download_ui,node_user toneBlue
class node_chunk_codec,node_download_folder toneAmber
class node_master_api,node_node_tracker,node_metadata_store,node_replication_monitor toneMint
class node_data_node_service,node_local_chunks,node_worker_heartbeat,node_garbage_collector toneRose
```

## Components

### Client experience

- [Streamlit dashboard](https://github.com/sreejithore/distributed-file-system/blob/main/app.py): `app.py`
- [Health and analytics](https://github.com/sreejithore/distributed-file-system/blob/main/app.py): `app.py`
- [Versioned registry](https://github.com/sreejithore/distributed-file-system/blob/main/app.py): `app.py`
- [Image preview](https://github.com/sreejithore/distributed-file-system/blob/main/app.py): `app.py`
- [Download matrix](https://github.com/sreejithore/distributed-file-system/blob/main/app.py): `app.py`

### File transfer

- [Chunk split and stitch](https://github.com/sreejithore/distributed-file-system/blob/main/client_logic.py): `client_logic.py`
- [Recovered files](https://github.com/sreejithore/distributed-file-system/tree/main/downloads): `downloads`

### Master services

- [Master RPC services](https://github.com/sreejithore/distributed-file-system/blob/main/master_node.py): `master_node.py`
- [Heartbeat tracking](https://github.com/sreejithore/distributed-file-system/blob/main/master_node.py): `master_node.py`
- [SQLite metadata](https://github.com/sreejithore/distributed-file-system/blob/main/master_metadata.db): `master_metadata.db`
- [Replication monitor](https://github.com/sreejithore/distributed-file-system/blob/main/master_node.py): `master_node.py`

### Storage workers

- [Data node RPC](https://github.com/sreejithore/distributed-file-system/blob/main/data_node.py): `data_node.py`
- [Chunk files](https://github.com/sreejithore/distributed-file-system/tree/main/storage_node_5001): `storage_node_5001`
- [Heartbeat worker](https://github.com/sreejithore/distributed-file-system/blob/main/data_node.py): `data_node.py`
- [Orphan cleanup](https://github.com/sreejithore/distributed-file-system/blob/main/data_node.py): `data_node.py`

### Other components

- **DFS user**

## Connections

- DFS user → Streamlit dashboard: uses (evidence: `README.md`)
- Streamlit dashboard → Health and analytics: renders (evidence: `app.py`)
- Streamlit dashboard → Versioned registry: renders (evidence: `app.py`)
- Streamlit dashboard → Image preview: opens (evidence: `README.md`)
- Streamlit dashboard → Download matrix: opens (evidence: `app.py`)
- Streamlit dashboard → Chunk split and stitch: splits files (evidence: `app.py`)
- Streamlit dashboard → Master RPC services: requests versions (evidence: `app.py`)
- Streamlit dashboard → Master RPC services: registers chunks (evidence: `app.py`)
- Streamlit dashboard → Data node RPC: sends chunks (evidence: `app.py`)
- Health and analytics → Master RPC services: requests status (evidence: `app.py`)
- Versioned registry → Master RPC services: reads registry (evidence: `README.md`)
- Versioned registry → Master RPC services: deletes files (evidence: `README.md`)
- Download matrix → Master RPC services: locates chunks (evidence: `README.md`)
- Download matrix → Data node RPC: fetches chunks (evidence: `README.md`)
- Download matrix → Chunk split and stitch: reassembles file (evidence: `README.md`)
- Chunk split and stitch → Recovered files: writes output (evidence: `README.md`)
- Master RPC services → SQLite metadata: reads and writes (evidence: `master_node.py`)
- Master RPC services → Heartbeat tracking: tracks health (evidence: `master_node.py`)
- Heartbeat worker → Heartbeat tracking: reports health (evidence: `data_node.py`)
- Data node RPC → Chunk files: reads and writes (evidence: `data_node.py`)
- Replication monitor → Data node RPC: replicates chunks (evidence: `master_node.py`)
- Replication monitor → SQLite metadata: records replicas (evidence: `master_node.py`)
- Orphan cleanup → Master RPC services: checks registration (evidence: `data_node.py`)
- Orphan cleanup → Chunk files: removes orphans (evidence: `data_node.py`)
