cs3org / wopiserver

A vendor-neutral application gateway compatible with the WOPI specifications.
Apache License 2.0
52 stars 27 forks source link

Optimize stats in cs3 storage interface #107

Closed glpatcern closed 11 months ago

glpatcern commented 1 year ago

Stats in cs3 also provide all extended attributes of a file in the form of arbitrary_metadata properties. As xattrs are extensively used throughout the code and currently cost an additional, redundant Stat call, an easy optimization is to cache the results and make getxattr calls just a cache lookup.

The only caveat is for stats that require an up-to-date VersionInfo aka etag, which can't be cached.

On the way, the code could also be improved by using https://googleapis.dev/python/protobuf/latest/google/protobuf/json_format.html