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

Use generic for file loading in FileMiddleware #405

Merged
merged 7 commits into from Mar 22, 2024
Merged

Conversation

adam-fowler
Copy link
Member

This will allow for writing custom file loaders that cache file contents or use another source than the local file system for files

This will allow for writing custom file loaders that cache file contents or use another source than the local file system for files
Copy link
Contributor

@Joannis Joannis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the symbol names a lot, but want to check if the FileProvider protocol has all the functions we would need

size: numericCast(lstat.st_size),
modificationDate: Date(timeIntervalSince1970: modificationDate)
)
} catch {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a known error that would be thrown if the file does not exist?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a NIOCore.IOError(2) but this could change when we move to NIOFileSystem.

@adam-fowler
Copy link
Member Author

I like the symbol names a lot, but want to check if the FileProvider protocol has all the functions we would need

Yeah that is a concern. The FileMiddleware covers pretty much all eventualities. The main possibility would be we need another file attribute.

Copy link
Contributor

@Joannis Joannis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one change, then it's fine

Sources/Hummingbird/Files/LocalFileSystem.swift Outdated Show resolved Hide resolved
@adam-fowler adam-fowler merged commit fb2b32e into main Mar 22, 2024
4 of 5 checks passed
@adam-fowler adam-fowler deleted the file-provider branch March 22, 2024 20:08
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

Successfully merging this pull request may close these issues.

None yet

2 participants