How cheasezz/file-service works
File Service is a gRPC-backed file storage and synchronization application. A client uploads and downloads files in chunks, lists stored names, and compares local SHA-256 hashes with server state; synchronization uploads only files the server reports as missing or changed. The server separates gRPC handlers, application services, domain validation, and filesystem storage. The README documents the four RPC patterns and parallel client uploads. Some handler and hash-storage implementations were not excerpted, so their specific call paths are shown only where the README or sampled code supports them.
Main entry points: service.go File service · main.go Client workflow · server.go gRPC server · app.go Server assembly
Components 19
Client
- Client workflow
cmd/client/main.go - Local files
cmd/client/main.go
gRPC transport
- Upload handler
internal/grpc/upload.go - Download handler
internal/grpc/download.go - List handler
internal/grpc/getAllFilesNames.go - Sync handler
internal/grpc/checkFiles.go - gRPC server
internal/grpc/server.go - RPC protocol
proto/fileService.proto
Application services
- File service
internal/service/service.go - Upload writer
internal/service/create.go - Hash comparison
internal/service/hashList.go - File validation
internal/core/file.go - Domain errors
internal/core/errors.go - Server assembly
internal/app/app.go - Configuration
config/config.go - Server entry
cmd/server/main.go
Filesystem storage
- Filesystem repository
internal/repo/repo.go - Stored hash lists
internal/repo/hashList.go
Other components
- User
Connections 30
- User → Client workflow: uses
README.md - Client workflow → Local files: reads and writes
cmd/client/main.go - Client workflow → RPC protocol: calls RPCs
cmd/client/main.go - Client workflow → gRPC server: connects to
cmd/client/main.go - gRPC server → RPC protocol: registers service
internal/grpc/server.go - gRPC server → Upload handler: dispatches
internal/grpc/server.go - gRPC server → Download handler: dispatches
- gRPC server → List handler: dispatches
- gRPC server → Sync handler: dispatches
- Upload handler → File service: creates and finishes upload
internal/grpc/upload.go - Sync handler → File service: gets user hashes
internal/grpc/checkFiles.go - Download handler → File service: opens file
README.md - List handler → File service: lists names
README.md - File service → Upload writer: implements upload creation
internal/service/create.go - Upload writer → File validation: validates file info
internal/service/create.go - Upload writer → Filesystem repository: creates stored file
internal/service/create.go - File service → Filesystem repository: opens and lists files
README.md - File service → Hash comparison: loads user hashes
internal/service/hashList.go - Hash comparison → Stored hash lists: reads hash list
- File service → Domain errors: returns domain errors
internal/service/service.go - Server assembly → Filesystem repository: initializes
internal/app/app.go - Server assembly → File service: constructs
internal/app/app.go - Server assembly → gRPC server: constructs
internal/app/app.go - Server entry → Configuration: loads
cmd/server/main.go - Server entry → Server assembly: starts
cmd/server/main.go - Configuration → gRPC server: configures
config/config.go - Client workflow → Sync handler: compares hashes
cmd/client/main.go - Client workflow → Upload handler: uploads chunks
cmd/client/main.go - Client workflow → Download handler: downloads chunks
cmd/client/main.go - Client workflow → List handler: requests names
cmd/client/main.go