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:
robk-tahoe 2008-10-03 10:13:09 -07:00
parent 183dd587d5
commit 236c52bf8b

View File

@ -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