ch.claudio.ncsalweb
Class Cache

java.lang.Object
  extended by ch.claudio.ncsalweb.Cache

public final class Cache
extends java.lang.Object

Maintain the local cache and serve the local files. It caches files which where requested locally or for which it observed requests.


Constructor Summary
Cache(ch.claudio.ncsalweb.Router router)
          The cache needs to know where the files to share are.
 
Method Summary
 void getFile(java.net.URL url)
           
 void searchFile(java.lang.String[] searchTerms)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache(ch.claudio.ncsalweb.Router router)
The cache needs to know where the files to share are. This is one or more directories. This information is kept in persistant storage. For each file to share it installs a "proxy" in its cache which contains the location of the real file plus checksum plus signature. The cache needs to know which directory it can use as cache and what the limits are (specified as a maximum absolute size plus a limit on how much space should keep free on the partition. This information must be kept in persistent storage. The layout need to be defined. How are cached files, their hash and signature stored? Maybe one directory containg files named with the hash which contain checksum and a location. A second directory contains the file itself. This way cached and served files are treated equally. The cache should be able to keep sliced files. Sliced files have a individual checksum for parts of a file. This allows to serve parts of files and collect parts from different sources, with less risk of getting wrong blocks. The cache should be able to resume transfer of aborted slices. For that the cache maintains per slice a list of host, where it can be found. The cache should keep for some time information, on which other hosts a slice exists too. Each new slice/file is indexed using plugins depending on the file type. The cache answers search request. The index is a word list. With each word there is a list of files who match plus attributes which specify the kind of match (html-title, mp3id-author etc.) Local/Temp split Two directories are used. One holds the files the user has a special interest in, i.e. own files which should be shared, or remote file one does not want to loose. The other directory holds the remaining files. Thus one know that backing up the "local" directory is enough to keep the important stuff and that the other directory can be destroyed at any time without fear of loosing ones own files. Replication It must be possible to do "directory traversal" in a cache, so that one can replicate more files than just the requested once. Maybe it could be interesting to exchange information so the net can know which data has been replicated how much, so less replicated info is copied more often. But probably this can be subverted to force replication of ones own information. Another idea is, that upon requesting files, a server can also advertise offer the own files, so the other server will replicate them. Good/Bad statistics. Some class (this one?) need to have a list of good and bad guys. Some "points" are attributed automatically, e.g. bad points for hosts who deliver files with wrong signatures. Other points have to be assigned manually, like when a host delivers files which contain copyrighted stuff. Maybe this statistics should be implemented in the Router and not in the Cache.

Parameters:
router -
Method Detail

getFile

public void getFile(java.net.URL url)
Parameters:
url -

searchFile

public void searchFile(java.lang.String[] searchTerms)
Parameters:
searchTerms -