How eldrago12/distributedfilesystem works
Core Components
• DistributedFS Node: At the heart of the system are the nodes that run this service. Each node may include a server component, a client interface, and background services for maintaining network state.
• Client Module: Found in the “client” directory (client/client.go), this module likely handles operations from the user’s perspective, interfacing with the service APIs.
• Server Module: Located in the “server” directory (server/service.go), this handles incoming requests, file storage operations, and coordination with other nodes.
• TCP Connection Module: The “tcpconn” package (tcpconn/tcp.go) encapsulates the custom peer-to-peer TCP communication logic.
• Gossip Module: In the “gossip” directory (gossip/gossip.go), this module is responsible for disseminating state information (such as node membership and file storage metadata) across the distributed network.
• API/Communication Contracts: The “proto” directory contains the protocol buffers definitions (dfs.proto) and the generated Go files, indicating that parts of the system might be accessible via gRPC or other protobuf-based mechanisms.
• Main Entry Point: The “cmd/main.go” illustrates where the node or service is bootstrapped, initializing all these components.
• Dockerfile: Indicates containerization, so deployment aspects are also part of the overall architecture.
Relationships and Interactions
• The Client interacts with the Server through defined service APIs (most likely via gRPC or custom TCP APIs using the protocol buffers definitions).
• The Server processes client requests and concurrently communicates with other nodes through the custom TCP connection (through the tcpconn module).
• The Gossip service periodically exchanges state and health information with peer nodes to manage distributed consistency and membership.
• The protocol buffers (proto folder) serve as an inter-service contract not only between client and server, but also for internal messaging between nodes.
• Docker encapsulation manages the deployment and environment consistency for the overall distributed system.
Architectural Patterns & Technologies
• Distributed Systems: The overall design is decentralized with peer-to-peer communication.
• Microservices/Modular Structure: Each component (client, server, gossip, tcp connection) is independently implemented, suggesting modularity.
• Custom Networking: The tcpconn package implies a tailored TCP communication mechanism differs from standard libraries.
• Protobuf/gRPC: The system uses protocol buffers which might also imply gRPC interfaces, ensuring structured, language-agnostic communication.