-
Notifications
You must be signed in to change notification settings - Fork 826
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
Rework FileAttributes #1782
Comments
Yes, I second this! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature Request
Currently file attribute retrieval in the adapter interface consists of several separate functions:
fileSize()
lastModified()
mimeType()
visibility()
All of these functions return a object of type
FileAttributes
.There are several downsides to this approach:
FileAttributes
object you can not trust it unless you know via which function it was created (ie: is thelastModified
propertynull
because we obtained the object viamimeType()
or is itnull
because it is not set in the underlying storage.fileSize()
andlastModified()
may lead to duplicate API calls to the underlying adapter.In practice most adapters get all meta data in one request:
AsyncAwsS3Adapter
AwsS3V3Adapter
AzureBlobStorageAdapter
GoogleCloudStorageAdapter
SftpAdapter
Some don't:
FtpAdapter
,InMemoryFilesystemAdapter
, note: this should not affect performanceLocal
, note: forlistContents
it is fully hydrated so performance wise this should be fine.ZipArchiveAdapter
WebDAVAdapter
, note: the underlyingpropFind
method does support requesting multiple properties in one callPossible solution
StorageAttributes
object is fully hydratedStorageAttributes
that load unset attributes if needed:This way we can:
Local
adapter we fully hydrate it forlistContents
but not for a single file)new LazyFileAttributes($path, () => $this->fileSize($path)
, ...)metaData()
to the adapter interface.FileSystem
to use this new function to get the metadata and use it when specific properties are requested, since we know now the meta data is fully hydrated (lazily or greedily) it can reuse this metadata for other properties.metaData()
to theFilesystemReader
that returns theStorageAttributes
object for the path.Scenario / Use-case
This feature would reduce API calls when they matter most, since the remote APIs for cloud storage providers all support retrieving meta data in 1 call.
Summary
getMetaData(): StorageAttributes
StorageAttributes
method result ofnull
means not set in the underlying storage instead of not set in the underlying storage, or not loaded by whatever method you used to create this objectThe text was updated successfully, but these errors were encountered: