UploadCache is an interface for tracking active uploads. Allows for different backends (e.g. in-memory or redis) to support both single instance and multi replica deployments.
| 15 | // Allows for different backends (e.g. in-memory or redis) |
| 16 | // to support both single instance and multi replica deployments. |
| 17 | type UploadCache interface { |
| 18 | // Register stores an upload with its expected file size |
| 19 | Register(filePath string, fileSize int64) |
| 20 | |
| 21 | // Complete removes an upload from the cache |
| 22 | Complete(filePath string) |
| 23 | |
| 24 | // GetLength returns the expected file size for an active upload |
| 25 | GetLength(filePath string) (int64, error) |
| 26 | |
| 27 | // Touch refreshes the TTL for an active upload |
| 28 | Touch(filePath string) |
| 29 | |
| 30 | // Close cleans up any resources |
| 31 | Close() |
| 32 | } |
| 33 | |
| 34 | // memoryUploadCache is an upload cache for single replica deployments |
| 35 | type memoryUploadCache struct { |
no outgoing calls
no test coverage detected