def copy(dir, options = {})
      # Make sure all objects are persisted.
      sync

      # Create a new store with the specified directory and options.
      new_db = Store.new(dir, options)
      # Clear the cache.
      new_db.sync
      # Copy all objects of the existing store to the new store.
      i = 0
      each do |ref_obj|
        obj = ref_obj._referenced_object
        obj._transfer(new_db)
        obj._sync
        i += 1
      end
      PEROBS.log.debug "Copied #{i} objects into new database at #{dir}"
      # Flush the new store and close it.
      new_db.exit

      true
    end
def copy(dir, options = {})
      # Make sure all objects are persisted.
      sync

      # Create a new store with the specified directory and options.
      new_db = Store.new(dir, options)
      # Clear the cache.
      new_db.sync
      # Copy all objects of the existing store to the new store.
      i = 0
      each do |ref_obj|
        obj = ref_obj._referenced_object
        obj._transfer(new_db)
        obj._sync
        i += 1
      end
      PEROBS.log.debug "Copied #{i} objects into new database at #{dir}"
      # Flush the new store and close it.
      new_db.exit

      true
    end
Create a new Store.
 @param data_base [String] the name of the database
 @param options [Hash] various options to affect the operation of the
        database. Currently the following options are supported:
        :engine     : The class that provides the back-end storage
                      engine. By default FlatFileDB is used. A user
                      can provide it's own storage engine that must
                      conform to the same API exposed by FlatFileDB.
        :cache_bits : the number of bits used for cache indexing. The
                      cache will hold 2 to the power of bits number of
                      objects. We have separate caches for reading and
                      writing. The default value is 16. It probably makes
                      little sense to use much larger numbers than that.
        :serializer : select the format used to serialize the data. There
                      are 3 different options:
                      :marshal : Native Ruby serializer. Fastest option
                      that can handle most Ruby data types. Big
                      disadvantate is the stability of the format. Data
                      written with one Ruby version may not be readable
                      with another version.
                      :json : About half as fast as marshal, but the
                      format is rock solid and portable between
                      languages. It only supports basic Ruby data types
                      like String, Integer, Float, Array, Hash. This is
                      the default option.
                      :yaml : Can also handle most Ruby data types and is
                      portable between Ruby versions (1.9 and later).
                      Unfortunately, it is 10x slower than marshal.
     :progressmeter : reference to a ProgressMeter object that receives
                      progress information during longer running tasks.
                      It defaults to ProgressMeter which only logs into
                      the log. Use ConsoleProgressMeter or a derived
                      class for more fancy progress reporting.
 Copy the store content into a new Store. The arguments are identical to
 Store.new().
 @param options [Hash] various options to affect the operation of the