HashIndex.java
/**
   * Creates an empty HashIndex file.  Used by HashIndex constructor.
   */
Creates an empty HashIndex file.  Used by HashIndex constructor.
Creates an empty HashIndex file . Used by HashIndex constructor .
protected void CreateEmptyHashIndexFile() {
	  Page hashDirectoryPage = new Page();
	  headId = Minibase.DiskManager.allocate_page();
	  for (int i = 0; i < BUCKETS_AMOUNT; i++)
	  {  
		  hashDirectoryPage.setIntValue(INVALID_PAGEID, i * INT_SIZE);
	  }
	  if (null != fileName && fileName.length() > 0)
	  {
		  Minibase.DiskManager.add_file_entry(fileName, headId);
	  }
	  Minibase.BufferManager.pinPage(headId, hashDirectoryPage, PIN_MEMCPY);
	  Minibase.BufferManager.unpinPage(headId, UNPIN_DIRTY);
  }
protected void CreateEmptyHashIndexFile ( ) { Page hashDirectoryPage = new Page ( ) ; headId = Minibase . DiskManager . allocate_page ( ) ; for ( int i = 0 ; i < BUCKETS_AMOUNT ; i ++ ) { hashDirectoryPage . setIntValue ( INVALID_PAGEID , i * INT_SIZE ) ; } if ( null != fileName && fileName . length ( ) > 0 ) { Minibase . DiskManager . add_file_entry ( fileName , headId ) ; } Minibase . BufferManager . pinPage ( headId , hashDirectoryPage , PIN_MEMCPY ) ; Minibase . BufferManager . unpinPage ( headId , UNPIN_DIRTY ) ; }
Creates an empty HashIndex file.
Creates an empty HashIndex file .
// Allocate the index file // Fill the directory page with the 128 primary bucket pages // Set up our director structure.  We will just use a simple page structure // where at each index we have an int for the HashBucket page id. // This will fit into one page with 128 indexes with room to spare (will only 512 of 1024 bytes) // We will just initialize the page ids to invalid at first and allocate them as needed // Only add the file entry when we don't have a temporary file // Save the the changes for the directory page