RamStorage wants /tmp

Issue #450 new
Андрей Григорьев created an issue

It is not obvious that RamStorage needs access to /tmp (via RamStorage.temp_storage method).

Why couldn't RamStorage.temp_storage just return another RamStorage?..

I don't know why it fails there in docker image based on pypy:2-slim, but it is:

  File "/search/main.py", line 39, in refresh_types
    writer.commit()
  File "/usr/local/site-packages/whoosh/writing.py", line 935, in commit
    self._finish()
  File "/usr/local/site-packages/whoosh/writing.py", line 884, in _finish
    self._tempstorage.destroy()
  File "/usr/local/site-packages/whoosh/filedb/filestore.py", line 458, in destroy
    self.clean()
  File "/usr/local/site-packages/whoosh/filedb/filestore.py", line 515, in clean
    files = self.list()
  File "/usr/local/site-packages/whoosh/filedb/filestore.py", line 525, in list
    files = os.listdir(self.folder)
OSError: [Errno 2] No such file or directory: '/tmp/MAIN.tmp'

Comments (2)

  1. Andrew T

    I'd also like to see RamStorage not use the filesystem. I got the exact same exception above when using RamStorage with Whoosh 2.7.4.

  2. Tommy Cuthbertson

    Check out this fix. It works for my particular implementation and seems to jive with the creator's function descriptions. Does anyone see anything potentially problematic with this?

    def destroy(self):
        self.__init__()
    
    ...
    
    def temp_storage(self, name=None):
        return RamStorage()
    
  3. Log in to comment