# max-out-00/distribute_file_management_system architecture

> Architecture diagram of the GitHub repository max-out-00/distribute_file_management_system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/max-out-00/distribute_file_management_system
- Repository: https://github.com/max-out-00/distribute_file_management_system

## Overview

This is a distributed file system organized around a client, metadata service, and storage nodes. Its user workflow splits a file into chunks, transfers chunks to nodes, then fetches, verifies, and reassembles them. Nodes also expose heartbeat registration and chunk replication; metadata placement and failure recovery are named product capabilities, though their implementations were not sampled. The graph preserves these services without asserting unverified call chains. The README documents the demo flow; source excerpts show node storage, protocol handling, and heartbeat behavior.

Main entry points: [`data_node/node_server.py`](https://github.com/max-out-00/distribute_file_management_system/blob/main/data_node/node_server.py) (Node TCP server), [`data_node/init.py`](https://github.com/max-out-00/distribute_file_management_system/blob/main/data_node/init.py) (Node startup), [`client/upload.py`](https://github.com/max-out-00/distribute_file_management_system/blob/main/client/upload.py) (Upload client), [`metadata_server/server.py`](https://github.com/max-out-00/distribute_file_management_system/blob/main/metadata_server/server.py) (Metadata TCP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client file workflow"]
  node_chunker["Chunking and reassembly<br/>[chunker.py]"]
  node_client_upload["Upload client<br/>[upload.py]"]
  node_client_download["Download client<br/>[download.py]"]
  node_client_cli["Client CLI<br/>[cli.py]"]
end

subgraph group_metadata["Metadata service"]
  node_metadata_server["Metadata TCP server<br/>[server.py]"]
  node_metadata_placement["Chunk placement<br/>[placement.py]"]
  node_metadata_db[("Metadata database<br/>[db.py]")]
  node_metadata_queries["Metadata queries<br/>[queries.py]"]
end

subgraph group_storage["Data node storage"]
  node_data_node_server["Node TCP server<br/>[node_server.py]"]
  node_chunk_storage[("Local chunk storage<br/>[storage.py]")]
  node_heartbeat["Heartbeat sender<br/>[heartbeat.py]"]
  node_node_init["Node startup<br/>[init.py]"]
  node_message_protocol["Message framing<br/>[message.py]"]
end

subgraph group_recovery["Monitoring and recovery"]
  node_failure_monitor["Failure monitoring<br/>[monitor.py]"]
  node_replicator["Chunk replication<br/>[replicator.py]"]
end

subgraph group_dashboard["Optional dashboard"]
  node_dashboard["Web dashboard<br/>[app.py]"]
end

node_user(("File user"))

node_user -->|"requests file operation"| node_client_cli
node_client_cli -.->|"splits and reassembles"| node_chunker
node_chunker -->|"provides chunks"| node_client_upload
node_client_upload -->|"uploads chunks"| node_data_node_server
node_client_download -->|"fetches chunks"| node_data_node_server
node_client_download -.->|"reassembles file"| node_chunker
node_client_upload -->|"uses framing"| node_message_protocol
node_node_init -->|"starts"| node_data_node_server
node_node_init -->|"creates storage"| node_chunk_storage
node_node_init -->|"starts"| node_heartbeat
node_heartbeat -->|"uses request helper"| node_data_node_server
node_data_node_server -->|"reads and writes chunks"| node_chunk_storage
node_data_node_server -->|"replicates to target node"| node_data_node_server
node_heartbeat -->|"registers and reports health"| node_metadata_server
node_metadata_server -.->|"selects chunk placement"| node_metadata_placement
node_metadata_server -.->|"persists metadata"| node_metadata_db
node_metadata_queries -.->|"queries metadata"| node_metadata_db
node_failure_monitor -.->|"triggers recovery"| node_replicator
node_replicator -.->|"requests replication"| node_data_node_server

click node_chunker "https://github.com/max-out-00/distribute_file_management_system/blob/main/client/chunker.py"
click node_client_upload "https://github.com/max-out-00/distribute_file_management_system/blob/main/client/upload.py"
click node_client_download "https://github.com/max-out-00/distribute_file_management_system/blob/main/client/download.py"
click node_client_cli "https://github.com/max-out-00/distribute_file_management_system/blob/main/client/cli.py"
click node_metadata_server "https://github.com/max-out-00/distribute_file_management_system/blob/main/metadata_server/server.py"
click node_metadata_placement "https://github.com/max-out-00/distribute_file_management_system/blob/main/metadata_server/placement.py"
click node_metadata_db "https://github.com/max-out-00/distribute_file_management_system/blob/main/metadata_server/db.py"
click node_metadata_queries "https://github.com/max-out-00/distribute_file_management_system/blob/main/metadata_server/queries.py"
click node_data_node_server "https://github.com/max-out-00/distribute_file_management_system/blob/main/data_node/node_server.py"
click node_chunk_storage "https://github.com/max-out-00/distribute_file_management_system/blob/main/data_node/storage.py"
click node_heartbeat "https://github.com/max-out-00/distribute_file_management_system/blob/main/data_node/heartbeat.py"
click node_node_init "https://github.com/max-out-00/distribute_file_management_system/blob/main/data_node/init.py"
click node_message_protocol "https://github.com/max-out-00/distribute_file_management_system/blob/main/shared/message.py"
click node_failure_monitor "https://github.com/max-out-00/distribute_file_management_system/blob/main/failure_detector/monitor.py"
click node_replicator "https://github.com/max-out-00/distribute_file_management_system/blob/main/failure_detector/replicator.py"
click node_dashboard "https://github.com/max-out-00/distribute_file_management_system/blob/main/dashboard/app.py"

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_chunker,node_client_upload,node_client_download,node_client_cli,node_user toneBlue
class node_metadata_server,node_metadata_placement,node_metadata_db,node_metadata_queries toneAmber
class node_data_node_server,node_chunk_storage,node_heartbeat,node_node_init,node_message_protocol toneMint
class node_failure_monitor,node_replicator toneRose
class node_dashboard toneIndigo
```

## Components

### Client file workflow

- [Chunking and reassembly](https://github.com/max-out-00/distribute_file_management_system/blob/main/client/chunker.py): `client/chunker.py`
- [Upload client](https://github.com/max-out-00/distribute_file_management_system/blob/main/client/upload.py): `client/upload.py`
- [Download client](https://github.com/max-out-00/distribute_file_management_system/blob/main/client/download.py): `client/download.py`
- [Client CLI](https://github.com/max-out-00/distribute_file_management_system/blob/main/client/cli.py): `client/cli.py`

### Metadata service

- [Metadata TCP server](https://github.com/max-out-00/distribute_file_management_system/blob/main/metadata_server/server.py): `metadata_server/server.py`
- [Chunk placement](https://github.com/max-out-00/distribute_file_management_system/blob/main/metadata_server/placement.py): `metadata_server/placement.py`
- [Metadata database](https://github.com/max-out-00/distribute_file_management_system/blob/main/metadata_server/db.py): `metadata_server/db.py`
- [Metadata queries](https://github.com/max-out-00/distribute_file_management_system/blob/main/metadata_server/queries.py): `metadata_server/queries.py`

### Data node storage

- [Node TCP server](https://github.com/max-out-00/distribute_file_management_system/blob/main/data_node/node_server.py): `data_node/node_server.py`
- [Local chunk storage](https://github.com/max-out-00/distribute_file_management_system/blob/main/data_node/storage.py): `data_node/storage.py`
- [Heartbeat sender](https://github.com/max-out-00/distribute_file_management_system/blob/main/data_node/heartbeat.py): `data_node/heartbeat.py`
- [Node startup](https://github.com/max-out-00/distribute_file_management_system/blob/main/data_node/init.py): `data_node/init.py`
- [Message framing](https://github.com/max-out-00/distribute_file_management_system/blob/main/shared/message.py): `shared/message.py`

### Monitoring and recovery

- [Failure monitoring](https://github.com/max-out-00/distribute_file_management_system/blob/main/failure_detector/monitor.py): `failure_detector/monitor.py`
- [Chunk replication](https://github.com/max-out-00/distribute_file_management_system/blob/main/failure_detector/replicator.py): `failure_detector/replicator.py`

### Optional dashboard

- [Web dashboard](https://github.com/max-out-00/distribute_file_management_system/blob/main/dashboard/app.py): `dashboard/app.py`

### Other components

- **File user**

## Connections

- File user → Client CLI: requests file operation (evidence: `README.md`)
- Client CLI → Chunking and reassembly: splits and reassembles
- Chunking and reassembly → Upload client: provides chunks (evidence: `README.md`)
- Upload client → Node TCP server: uploads chunks (evidence: `README.md`)
- Download client → Node TCP server: fetches chunks (evidence: `README.md`)
- Download client → Chunking and reassembly: reassembles file
- Upload client → Message framing: uses framing (evidence: `client/upload.py`)
- Node startup → Node TCP server: starts (evidence: `data_node/init.py`)
- Node startup → Local chunk storage: creates storage (evidence: `data_node/init.py`)
- Node startup → Heartbeat sender: starts (evidence: `data_node/init.py`)
- Heartbeat sender → Node TCP server: uses request helper (evidence: `data_node/heartbeat.py`)
- Node TCP server → Local chunk storage: reads and writes chunks (evidence: `data_node/node_server.py`)
- Node TCP server → Node TCP server: replicates to target node (evidence: `data_node/node_server.py`)
- Heartbeat sender → Metadata TCP server: registers and reports health (evidence: `data_node/heartbeat.py`)
- Metadata TCP server → Chunk placement: selects chunk placement
- Metadata TCP server → Metadata database: persists metadata
- Metadata queries → Metadata database: queries metadata
- Failure monitoring → Chunk replication: triggers recovery
- Chunk replication → Node TCP server: requests replication
