mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
fuse/impl_a: fix a suspected bug in caching
from my examination of the tahoe_fuse ('impl_a') code, it looks like the intention is to cache the file contents in memory while it's open, since it does in fact do that. however it looks like it also ignored that cache entirely, and made an individual tahoe webapi GET request for each and every read() operation regardless of the relative size of the read block and the file in question. this changes that to make read() use the data in memory rather than fetch the data over again. if there's something more subtle going on, please let me know.
This commit is contained in:
parent
183dd587d5
commit
236c52bf8b
@ -201,9 +201,11 @@ class TahoeFS (fuse.Fuse):
|
||||
return self.rootdir.resolve_path(parts)
|
||||
|
||||
def _get_contents(self, path):
|
||||
node = self._get_node(path)
|
||||
contents = node.open().read()
|
||||
self.filecontents[path] = contents
|
||||
contents = self.filecontents.get(path)
|
||||
if contents is None:
|
||||
node = self._get_node(path)
|
||||
contents = node.open().read()
|
||||
self.filecontents[path] = contents
|
||||
return contents
|
||||
|
||||
@trace_calls
|
||||
|
Loading…
Reference in New Issue
Block a user