20.08.2013 Views

a Grid Computing System - Utopia

a Grid Computing System - Utopia

a Grid Computing System - Utopia

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3. The Basic Building Block - ONTA (Object Network Transfer Architecture)<br />

when a file is downloaded by ONTA from the network. These two situations are different in the<br />

sense that when storing an archive after using the object writer, a local temporary file is already<br />

created, at it should just be renamed to a unique file name. When downloading a file, first a unique<br />

filename should be obtained and than this file name should be used to store the downloaded file.<br />

For handling this cases the API consists of two calls:<br />

public String put (File f)<br />

public String getFileName(AliceURL appl)<br />

All the files are stored starting at a root directory that is selected by using a string parameter<br />

passed to the constructor of the file manager when the class is instantiated. All the files are stored<br />

starting at this directory, which is specified by the user through the use of the GUI. There is an issue<br />

of creating too many files inside the same directory and the ONTA file manager uses a hierarchical<br />

approach, so there are never more than a maximum number of files inside a directory. If that<br />

number is reached, a new subdirectory is created and all the other files with the same root directory<br />

start will be stored in that subdirectory. We do this in order to minimize the file system overhead<br />

induce by a larger number of files being located in the same directory, thus additional level of<br />

indirection being needed.<br />

The put (File f) method stores a local temporary file to a unique filename inside the ONTA root<br />

directory. This actually just gets a new file name, creates a new directory if needed (if the current<br />

one is full - that is the maximum number of files has been reached) and moves the file there.<br />

The second method, getFileName(AliceURL appl) should be used by all the client protocols<br />

to store a file when it is downloaded. Since all the references contain the application that they<br />

are related to inside the object reference taken from the space, the file manager has the ability<br />

to store all the files downloaded on behalf of an application in the same directory. This greatly<br />

improves the ability to have a good file structure organization and to be able to clean up the unused<br />

files much easier. So, given an application ID (in form of an AliceURL), this call will return a<br />

unique filename in a directory unique for that application (if this directory does not exists, it will<br />

be created). Storing files for different applications in different directories also resolves the issue of<br />

files with the same filename being downloaded in the same directory.<br />

To clean up files that are not used anymore, the file manager offers two calls to handle this:<br />

public void markNotUsed(String name)<br />

public void deleteUnused()<br />

The first method adds a file with a given name (the name returned by one of the two calls<br />

presented above should be used) to a list of files that are not longer needed. When deleteUnused()<br />

is called, all the files in the list are physically deleted from the disk.<br />

30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!