I started with the happy path, client uploads a file, server stores it, done.
Start by clarifying requirements (file sizes, concurrency, consistency, cost) and then walk through the end-to-end upload flow: client chunks the file, uploads chunks with resumable sessions, server stores chunks in blob storage and metadata in a database. Emphasize deduplication via content hashing and separation of metadata (SQL/NoSQL) from blob storage (object store) to enable scalability and cost efficiency.
Pro tip: Proactively discuss trade-offs: e.g., chunk size vs. overhead, strong vs. eventual consistency for dedup, and how to handle partial failures. Also mention that dedup should be done at chunk level to maximize storage savings and that metadata should include references to blob locations.
Ask about expected file sizes, upload frequency, consistency needs, and budget. This shapes decisions on chunk size, storage systems, and dedup strategy.
Define chunk size (e.g., 5-10 MB), use a session ID to track upload progress, and allow clients to resume by querying which chunks are already received. Consider using HTTP range requests or a custom protocol.
Compute a cryptographic hash (e.g., SHA-256) for each chunk. Before storing, check if the hash exists in a dedup index; if so, reference the existing blob instead of storing a duplicate.
Store file metadata (name, owner, permissions, chunk list, hashes) in a transactional database (e.g., PostgreSQL). Store actual chunk data in a scalable object store (e.g., S3, GCS). Metadata references blobs by unique IDs.
Design for retries, idempotent chunk uploads, and eventual consistency in dedup. Implement garbage collection for orphaned blobs when files are deleted or dedup references drop to zero.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
This one exposed a gap I didn't know I had.
Start by clarifying requirements and scale, then propose a layered model with users, groups, resources, and permissions, using a centralized authorization service. Explain how to handle inheritance, link sharing, and efficient ACL checks with caching and indexing, and discuss trade-offs between consistency and performance.
Pro tip: Emphasize the importance of a consistent authorization model and the use of a dedicated service with caching and precomputed effective permissions to achieve low-latency checks at scale. Also, mention the need for auditability and revocation propagation.
Ask about expected number of users, groups, resources, sharing patterns, and performance requirements. Clarify consistency needs (e.g., immediate revocation) and compliance constraints.
Define entities: users, groups, resources (files/folders), permissions (read/write/share), and ACLs. Decide on a model that supports direct user/group grants and link-based permissions.
Explain how folder inheritance works (e.g., propagating permissions down the tree) and how link-based permissions are represented (e.g., tokens with scoped access). Discuss how to resolve effective permissions.
Propose a centralized authorization service with caching (e.g., Redis) and precomputed effective permissions. Use indexing (e.g., by user/group and resource) to quickly answer 'can user X access resource Y?'.
Discuss scaling strategies: sharding, read replicas, cache invalidation, and eventual consistency. Trade-offs between strong consistency (slower) and eventual consistency (faster but risk of stale permissions).
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.