| Index: chrome/common/extensions/docs/server2/caching_file_system.py
|
| diff --git a/chrome/common/extensions/docs/server2/caching_file_system.py b/chrome/common/extensions/docs/server2/caching_file_system.py
|
| index aa5e93ad3af321142bcb2d2dee341d47adfed103..758514a43520453bbaf5c94011d4a7d4fa2d5d10 100644
|
| --- a/chrome/common/extensions/docs/server2/caching_file_system.py
|
| +++ b/chrome/common/extensions/docs/server2/caching_file_system.py
|
| @@ -5,6 +5,8 @@
|
| from file_system import FileSystem, StatInfo, FileNotFoundError
|
| from future import Future
|
|
|
| +from object_store_creator import ObjectStoreCreator
|
| +
|
| class _AsyncUncachedFuture(object):
|
| def __init__(self,
|
| uncached_read_futures,
|
| @@ -32,28 +34,24 @@ class CachingFileSystem(FileSystem):
|
| '''FileSystem which implements a caching layer on top of |file_system|. It's
|
| smart, using Stat() to decided whether to skip Read()ing from |file_system|,
|
| and only Stat()ing directories never files.
|
| -
|
| - Specify |use_existing_values| to continue using whatever has been cached in
|
| - the object stores. By default, the data in the stores is assumed to be stale
|
| - (althought consistent). Using existing values is useful for live instances
|
| - that don't want to touch the file system; not using them is good for the
|
| - cron jobs, where we want to refresh the data.
|
| '''
|
| - def __init__(self,
|
| - file_system,
|
| - object_store_creator_factory,
|
| - use_existing_values=False):
|
| + def __init__(self, file_system, object_store_creator_factory):
|
| self._file_system = file_system
|
| - def create_object_store(category):
|
| + def create_object_store(category, start_configuration=None):
|
| return (object_store_creator_factory.Create(CachingFileSystem)
|
| .Create(category='%s/%s' % (file_system.GetName(), category),
|
| - # By Stat()ing from scratch we'll end up not using the
|
| - # existing values, but also not doing unnecessary Read()s if
|
| - # the files haven't changed from last time.
|
| - start_empty=(not use_existing_values and category == 'stat')))
|
| + start_configuration=start_configuration))
|
| + # Use the existing start configuation.
|
| self._stat_object_store = create_object_store('stat')
|
| - self._read_object_store = create_object_store('read')
|
| - self._read_binary_object_store = create_object_store('read-binary')
|
| + # Force START_POPULATED for the read stores since if Stat is empty we're
|
| + # effectively starting empty - but won't be doing unnecessary Read()s if
|
| + # the files haven't changed from last time.
|
| + self._read_object_store = create_object_store(
|
| + 'read',
|
| + start_configuration=ObjectStoreCreator.START_POPULATED)
|
| + self._read_binary_object_store = create_object_store(
|
| + 'read-binary',
|
| + start_configuration=ObjectStoreCreator.START_POPULATED)
|
|
|
| def Stat(self, path):
|
| '''Stats the directory given, or if a file is given, stats the file's parent
|
|
|