class_docstr: Persistent data structure for replay buffer
  
  Features:
  - Perfectly compatible with collections.RandomAccessQueue
  - Persist replay buffer data on storage to survive restart
    - [todo] remove popleft'd data from disk
  - Reuse replay buffer data to another training session
    - Track back the replay buffer lineage
  Non-it-is-for:
  - Extend replay buffer by spilling to the disk
  
  TODOs
  - Optimize writes; buffered writes with threads or something
  
  Arguments:
      basedir (str): Path to the directory where replay buffer data is stored.
      maxlen (int): Max length of queue. Appended data beyond
          this limit is only removed from memory, not from storage.
      ancestor (str): Path to pre-generated replay buffer.
      logger: logger
class_docstr_tok: ["Persistent","data","structure","for","replay","buffer","Features",":","-","Perfectly","compatible","with","collections.RandomAccessQueue","-","Persist","replay","buffer","data","on","storage","to","survive","restart","-","[","todo","]","remove","popleft","'d","data","from","disk","-","Reuse","replay","buffer","data","to","another","training","session","-","Track","back","the","replay","buffer","lineage","Non-it-is-for",":","-","Extend","replay","buffer","by","spilling","to","the","disk","TODOs","-","Optimize","writes",";","buffered","writes","with","threads","or","something","Arguments",":","basedir","(","str",")",":","Path","to","the","directory","where","replay","buffer","data","is","stored",".","maxlen","(","int",")",":","Max","length","of","queue",".","Appended","data","beyond","this","limit","is","only","removed","from","memory",",","not","from","storage",".","ancestor","(","str",")",":","Path","to","pre-generated","replay","buffer",".","logger",":","logger"]
code: def _setup_fs(self, fs):
      # In __init__() fs is fixed to None, but this is reserved for
      # future extension support non-posix file systems such as HDFS
      if fs is None:
          if _chainerio_available:
              # _chainerio_available must be None for now
              raise NotImplementedError(
                  "Internal Error: chainerio support is not yet implemented"
              )
          else:
              # When chainerio is not installed
              self.fs = _VanillaFS(
                  open=open, exists=os.path.exists, makedirs=os.makedirs
              )
      else:
          self.fs = fs
  
imports: import binascii
  import collections
  import os
  import pickle
  from datetime import datetime
  from struct import calcsize, pack, unpack
  from pfrl.collections.random_access_queue import RandomAccessQueue
label_desc: Use image node_id 19 for calling the PersistentRandomAccessQueue obj's underlying member method code with example usage: obj._setup_fs(fs) without return types