You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hash() is not typically implemented in pyfilesystem according to: https://docs.pyfilesystem.org/en/latest/implementers.html#helper-methods however, in this case it could be argued that there is a performance benefit to getting the hash from the server rather than downloading+computing it client-side.
Note that this only works for md5 and crc32c. Therefore the implementation could just fallback to the parent class otherwise. An implementation might look like this (complelely untested):
def hash(self, path, name):
if name.lower() == 'md5':
_path = self.validatepath(path)
_key = self._path_to_key(_path)
blob = self._get_blob(_key)
if not blob:
raise errors.ResourceNotFound(path)
return blob.md5_hash
else:
return super().hash(self, path, name)
The text was updated successfully, but these errors were encountered:
GCP can compute the md5 hash server-side: https://googleapis.dev/python/storage/latest/blobs.html#google.cloud.storage.blob.Blob.md5_hash
hash()
is not typically implemented in pyfilesystem according to: https://docs.pyfilesystem.org/en/latest/implementers.html#helper-methods however, in this case it could be argued that there is a performance benefit to getting the hash from the server rather than downloading+computing it client-side.Note that this only works for md5 and crc32c. Therefore the implementation could just fallback to the parent class otherwise. An implementation might look like this (complelely untested):
The text was updated successfully, but these errors were encountered: