def open(file_must_exist = false)
      if @dirty_flag.is_locked?
        PEROBS.log.fatal "Index file #{@nodes.file_name} is already " +
          "locked"
      end
      if file_must_exist && !@nodes.file_exist?
        PEROBS.log.fatal "Index file #{@nodes.file_name} does not exist"
      end

      @node_cache.clear
      @nodes.open

      if @nodes.total_entries == 0
        # We've created a new nodes file
        node = BTreeNode::create(self)
      else
        # We are loading an existing tree.
        node = BTreeNode::load_and_link(self, @nodes.first_entry)
        @first_leaf = BTreeNode::load_and_link(
          self, @nodes.get_custom_data('first_leaf'))
        @last_leaf = BTreeNode::load_and_link(
          self, @nodes.get_custom_data('last_leaf'))
      end
      set_root(node)

      # Get the total number of entries that are stored in the tree.
      @size = @nodes.get_custom_data('btree_size')
    end
def open(file_must_exist = false)
      if @dirty_flag.is_locked?
        PEROBS.log.fatal "Index file #{@nodes.file_name} is already " +
          "locked"
      end
      if file_must_exist && !@nodes.file_exist?
        PEROBS.log.fatal "Index file #{@nodes.file_name} does not exist"
      end

      @node_cache.clear
      @nodes.open

      if @nodes.total_entries == 0
        # We've created a new nodes file
        node = BTreeNode::create(self)
      else
        # We are loading an existing tree.
        node = BTreeNode::load_and_link(self, @nodes.first_entry)
        @first_leaf = BTreeNode::load_and_link(
          self, @nodes.get_custom_data('first_leaf'))
        @last_leaf = BTreeNode::load_and_link(
          self, @nodes.get_custom_data('last_leaf'))
      end
      set_root(node)

      # Get the total number of entries that are stored in the tree.
      @size = @nodes.get_custom_data('btree_size')
    end
Create a new BTree object.
 @param dir [String] Directory to store the tree file
 @param name [String] Base name of the BTree related files in 'dir'
 @param order [Integer] The maximum number of keys per node. This number
        must be odd and larger than 2 and smaller than 2**16 - 1.
 @param progressmeter [ProgressMeter] reference to a ProgressMeter object
 Open the tree file.