/* Copyright (C) 2009  CSE,IIT Bombay  http://www.cse.iitb.ac.in

This file is part of the ConStore open source storage facility for concept-nets.

ConStore is free software and distributed under the 
Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License;
you can copy, distribute and transmit the work
with the work attribution in the manner specified by the author or licensor.
You may not use this work for commercial purposes and may not alter, 
transform, or build upon this work.

Please refer the legal code of the license, available at
http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode

ConStore is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  */

package iitb.con.util;

import java.io.IOException;


/**
 * FreeSpaceList is the list which maintains the information about the free blocks in a file. 
 * 
 * @author Prathab K
 *
 */
public interface FreeSpaceList {

    /**
     * Returns the free block location
     * @param size request block size
     * @return free block location
     */
    public long getFreeBlock(long size);

    /**
     * Frees the specified block in the file
     * @param location block location
     * @param size block size
     * @return <tt>true</tt> on success
     */
    public boolean freeTheBlock(long location, long size);
    
    /**
     * Commits the changes to the free space list file
     * @throws IOException if file operation fails
     */
    public void commit() throws IOException;
    
    /**
     * Closes the free space list file
     * @throws IOException if file operation fails
     */
    public void close() throws IOException;
}