net.nutch.fs
Class FSDirectory

java.lang.Object
  extended bynet.nutch.fs.FSDirectory

public class FSDirectory
extends Object

FSDirectory stores the filesystem directory state. It handles writing/loading values to disk, and logging changes as we go. It keeps the filename->blockset mapping always-current and logged to disk.

Author:
Mike Cafarella

Constructor Summary
FSDirectory(File dir)
          Create a FileSystem directory, and load its info from the indicated place.
 
Method Summary
 boolean addFile(UTF8 src, Block[] blocks)
          Add the given filename to the fs.
 void close()
          Shutdown the filestore
 Block[] delete(UTF8 src)
          Remove the file from management, return blocks
 Block[] getFile(UTF8 src)
          Get the blocks associated with the file
 UTF8[] getListing(UTF8 src)
          Get a listing of files given path 'src' This function is admittedly very inefficient right now.
 boolean isDir(UTF8 src)
          Check whether it's a directory
 boolean isValidBlock(Block b)
          Returns whether the given block is one pointed-to by a file.
 boolean isValidToCreate(UTF8 src)
          Check whether the filepath could be created
 boolean renameTo(UTF8 src, UTF8 dst)
          Change the filename
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSDirectory

public FSDirectory(File dir)
            throws IOException
Create a FileSystem directory, and load its info from the indicated place.

Method Detail

close

public void close()
           throws IOException
Shutdown the filestore

Throws:
IOException

addFile

public boolean addFile(UTF8 src,
                       Block[] blocks)
Add the given filename to the fs.


renameTo

public boolean renameTo(UTF8 src,
                        UTF8 dst)
Change the filename


delete

public Block[] delete(UTF8 src)
Remove the file from management, return blocks


getListing

public UTF8[] getListing(UTF8 src)
Get a listing of files given path 'src' This function is admittedly very inefficient right now. We'll make it better later.


getFile

public Block[] getFile(UTF8 src)
Get the blocks associated with the file


isValidToCreate

public boolean isValidToCreate(UTF8 src)
Check whether the filepath could be created


isDir

public boolean isDir(UTF8 src)
Check whether it's a directory


isValidBlock

public boolean isValidBlock(Block b)
Returns whether the given block is one pointed-to by a file.



Copyright © 2004 The Nutch Organization.