Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider refactoring ProvenanceFileStorage #7118

Closed
sschuberth opened this issue Jun 13, 2023 · 0 comments
Closed

Consider refactoring ProvenanceFileStorage #7118

sschuberth opened this issue Jun 13, 2023 · 0 comments

Comments

@sschuberth
Copy link
Member

The current ProvenanceFileStorage interface and implementations have some potentially confusing quirks:

  • The fun putFile(provenance: KnownProvenance, file: File) function takes a file, but actually only its contents are stored. In particular, the file name is lost and cannot be assumed to be maintained when calling fun getFile(provenance: KnownProvenance): File?. As a result, also the extension of the original file is lost, so one cannot deduce the file type (which implies how its contents are to be interpreted) anymore.
  • As another consequence, only a single file can be associated by a given KnownProvenance per ProvenanceFileStorage instance.
  • Also, as the interface operates on files, data that is in memory needs to be serialized to disk first before it can be stored, which may be inefficient.

As a straight-forward solution to address this, I'd propose to make the interface operator on Input- / OutputStreams rather than files. Alternatively (but with significant more work), the file name could also be (re-)stored, and multiple files (with different names) per storage could be allowed.

sschuberth added a commit that referenced this issue Jun 14, 2023
…iles

Resolves #7118.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
sschuberth added a commit that referenced this issue Jun 19, 2023
…iles

Resolves #7118.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
sschuberth added a commit that referenced this issue Jun 19, 2023
…iles

This avoids the temporary creation of files as well as potential confusion
about persisting the file name, and paves the way for storages that
cannot operate on files but on streams.

Resolves #7118.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
sschuberth added a commit that referenced this issue Jun 19, 2023
…iles

This avoids the temporary creation of files as well as potential confusion
about persisting the file name, and paves the way for storages that
cannot operate on files but on streams.

Resolves #7118.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant