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

Store large items as files #5

Open
AshleyYakeley opened this issue May 18, 2019 · 10 comments
Open

Store large items as files #5

AshleyYakeley opened this issue May 18, 2019 · 10 comments
Assignees
Milestone

Comments

@AshleyYakeley
Copy link
Owner

Big files are not quickly hashable. So it seems like the best approach is to make files mutable and assign UUIDs to them randomly.

Create a type File, with File <= Entity.

Possibly: create a filetype keyword, like opentype, that would generate subtypes of File.

Possibly: predefined file types for a library of file operations, e.g. image sizes, media durations, etc.

This was referenced Apr 16, 2020
@AshleyYakeley
Copy link
Owner Author

File types are like literal types, they need to be pre-defined.

  • File
  • TextFile
  • ImageFile
  • VideoFile
  • AudioFile

These are somewhat similar to references. We might have TextFile <: TextRef (see #4). But note files are deleteable, and TextRefs might not be.

@AshleyYakeley AshleyYakeley added this to the 0.2 milestone Aug 6, 2020
@AshleyYakeley
Copy link
Owner Author

TextFile <: File <: Entity
TextFile <: TextRef

@AshleyYakeley
Copy link
Owner Author

AshleyYakeley commented Aug 16, 2020

Can we do File a <: a? File would be covariant.

Probably not, due to confluence. When the solver has the constraint File a <: File b, it's not clear whether to reduce that to a <: b (per covariance) or a <: File b.

@AshleyYakeley
Copy link
Owner Author

Note that the type of a file does not imply an encoding. Text can be stored as utf8 or uft16 or whatever. Images can be stored as PNG or JPEG, etc.

@AshleyYakeley
Copy link
Owner Author

UTF8File <: File <: Entity
UTF8File <: WholeRef Text

(files can't do insert/delete like TextRef)

PNGFile <: File <: Entity
PNGFile <: ImageRef

@AshleyYakeley AshleyYakeley modified the milestones: 0.2, 0.3 Dec 16, 2020
@AshleyYakeley
Copy link
Owner Author

AshleyYakeley commented Dec 24, 2020

File API:

File <: Entity;
fileSize: File -> Action Integer;
deleteFile: File -> Action ();
newFile @T: Action T; # T is a "file type"

Format API:

UTF8File <: File;
UTF8File <: WholeRef Text;
PNGFile <: File;
PNGFile <: WholeRef Image;
JPEGFile <: File;
JPEGFile <: WholeRef (Integer, Metadata, Image); # quality factor

or

ImageFile <: File;
ImageFile <: WholeRef (ImageFileType, Metadata, Image);

or

utf8File: File -> WholeRef Text;
pngFile: File -> WholeRef Image;

@AshleyYakeley AshleyYakeley self-assigned this Feb 1, 2021
AshleyYakeley added a commit that referenced this issue Feb 2, 2021
@AshleyYakeley AshleyYakeley modified the milestones: 0.3, 0.4 Apr 5, 2021
@AshleyYakeley AshleyYakeley changed the title Work with files Store very large items as files Jul 13, 2022
@AshleyYakeley AshleyYakeley changed the title Store very large items as files Store large items as files Jul 13, 2022
@AshleyYakeley
Copy link
Owner Author

Not seeing a pressing need for this, for the moment.

@AshleyYakeley AshleyYakeley modified the milestones: 0.4, Future Oct 19, 2022
@AshleyYakeley
Copy link
Owner Author

AshleyYakeley commented Jun 17, 2024

type File {-p,+q};
subtype File {-p,+q} <: WholeModel {-p,+q};

This is definitely wrong. The whole point of files is that they may be too big to be WholeModels.

@AshleyYakeley
Copy link
Owner Author

AshleyYakeley commented Jun 21, 2024

raw interface:

opentype FileEntity;
model.FileEntity: Storage -> FileEntity -> BlobModel;

@AshleyYakeley
Copy link
Owner Author

AshleyYakeley commented Jun 21, 2024

Would like to record the type of the file. For each type T, we need a function from BlobModel to T.

filetype F of T = p;
p: BlobModel -> T;
# F is open entity type
model.File @F: Storage -> F -> T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant