// Package storage defines the FileStore interface and backend implementations. package storage import ( "context" "fmt" "io" "net/url" "time" ) // FileStore is the interface for file storage backends. type FileStore interface { Put(ctx context.Context, key string, reader io.Reader, size int64, contentType string) (*PutResult, error) Get(ctx context.Context, key string) (io.ReadCloser, error) GetVersion(ctx context.Context, key string, versionID string) (io.ReadCloser, error) Delete(ctx context.Context, key string) error Exists(ctx context.Context, key string) (bool, error) Copy(ctx context.Context, srcKey, dstKey string) error PresignPut(ctx context.Context, key string, expiry time.Duration) (*url.URL, error) Ping(ctx context.Context) error } // PutResult contains the result of a put operation. type PutResult struct { Key string VersionID string Size int64 Checksum string } // FileKey generates a storage key for an item file. func FileKey(partNumber string, revision int) string { return fmt.Sprintf("items/%s/rev%d.FCStd", partNumber, revision) } // ThumbnailKey generates a storage key for a thumbnail. func ThumbnailKey(partNumber string, revision int) string { return fmt.Sprintf("thumbnails/%s/rev%d.png", partNumber, revision) }