Estimate the scale of the system you are going to design...
# REST Examples
GET /file/path/to/file.txt
PUT /file/path/to/file.txt
POST /file/path/to/file.txt?append=true
DELETE /file/path/to/file.txt
nodes Table – Files and Directories
TABLE nodes (
id,
name ,
parent_id,
is_directory,
size,
created_at,
modified_at,
permissions,
owner_id UUID,
);
chunks Table – Logical Data Blocks
TABLE chunks (
id,
node_id,
chunk_index,
checksum,
size,
);
locks Table – Distributed Locking
TABLE locks (
node_id ,
client_id,
lock_type,
acquired_at,
expires_at
);
chunk_replicas Table – Physical Replication Mapping
TABLE chunk_replicas (
chunk_id,
server_id,
replica_state,
last_heartbeat,
);
storage_servers Table – Data Node Info
TABLE storage_servers (
id
hostname ,
ip_address ,
last_heartbeat ,
disk_usage ,
is_active
);
Client wants to upload /user/video/video.mp4 (384 MB)
Client ──► Metadata Server: Request to create file
Metadata Server ──►Lock /user/video
Metadata Server ──► Checks parent directory, permissions, and uniqueness
Metadata Server ──► Allocates 3 chunk IDs (for 3 chunks of 128MB each)
──► Selects 3 storage nodes per chunk for replication
──► Returns chunk plan to Client
Client ──► Sends each chunk to its assigned Storage Servers
Storage Servers ──► Acknowledge receipt and replication success
Client ──► Metadata Server: Finalize write (commit metadata)
Metadata Server ──► Updates file entry, chunk locations, sizes
Metadata Server ──►Unlock
Client reads /user/alice/video.mp4
Client ──► Metadata Server: Request file metadata (including chunk list)
Metadata Server ──► Returns chunk IDs + list of replica locations
Client ──► Directly contacts closest or fastest Storage Server per chunk
Storage Servers ──► Stream chunks to Client
Responsibilities:
Design Notes:
Responsibilities:
Subcomponents:
Performance Design:
Responsibilities:
Storage Layout:
Design Notes:
Responsibilities:
Implementation Options:
Responsibilities:
Design Notes:
Responsibilities:
Design Notes:
Responsibilities:
Design Schema:
DB Choices:
Explain any trade offs you have made and why you made certain tech choices...
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?