From e29939ce418ba57451ea8fdcd989e83fbe8828b2 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Thu, 11 May 2023 19:41:51 +0000 Subject: [PATCH] feat(storage): Define interface for creating temporary files This provides a new type for a temporary file and a method on a RecordingStorage to create temporary files. Temporary files will get removed when closed. --- internal/storage/storage.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/storage/storage.go b/internal/storage/storage.go index b4531bb91f..4623fb0feb 100644 --- a/internal/storage/storage.go +++ b/internal/storage/storage.go @@ -23,6 +23,8 @@ type RecordingStorage interface { // PluginClients returns a map of storage plugin clients keyed on the plugin name. PluginClients() map[string]plgpb.StoragePluginServiceClient + + CreateTemp(ctx context.Context, p string) (TempFile, error) } // Bucket is a resource that represents a bucket in an external object store @@ -54,3 +56,9 @@ type File interface { io.Writer io.StringWriter } + +// TempFile is a temporary File. It will get removed when Closed. +type TempFile interface { + File + io.Seeker +}