Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: Freenet/node/DataStore.java


1   package Freenet.node;
2   import Freenet.Address;
3   import Freenet.Key;
4   import Freenet.support.Callback;
5   import java.io.Serializable;
6   import java.io.IOException;
7   
8   public interface DataStore extends Serializable, Callback {
9   
10      public void tofile(String filename) throws IOException;
11  
12    /**
13     * Searches for a key in the DataStore and if found returns
14     * any data associated with that key.  If none is found,
15     * null is returned.
16     * @param k The key to search for
17     * @return The data associated with the key or null if not found
18     **/
19      public Data searchData(Key k);
20    /**
21      * Searches for a key in the DataStore and if found returns
22      * any reference associated with that key.  If none is found,
23      * null is returned.
24      * @param k The key to search for
25      * @return The reference associated with the key or null
26      *         if not found
27      **/
28      public Address searchRef(Key k);
29    /**
30        * Removes an item from the DataStore given its key
31      * @param k The key of the item to remove
32      **/
33      public void remove(Key k);
34    /**
35      * Returns the reference associated with the closest key
36      * to k.
37      * @param k The key to search for
38      * @return The closest Key to k
39      **/
40      public Key findClosestKey(Key k);
41    /**
42      * Returns the reference associated with the closest key
43      * to k.  The masking key allows the 'next best' key to
44      * be found.  Imagine the entries in the datastore being
45      * sorted in terms of closeness to the key you specify.
46      * With no mask key the reference associated with the
47      * top-most item will be returned.  However, with a mask
48      * key any references associated with keys above the mask
49      * key (including the mask key itself) will be ignored.
50      * This facility allows best-first backtracking.
51      * @param k The key to search for
52      * @param maskKey The masking key (or null for no mask)
53      * @return The closest Key to k (excluding masked keys) or
54      *         null if all keys are masked.
55      **/
56      public Key findClosestKey(Key k, Key maskKey);
57  
58    /**
59      * Adds an item to the DataStore
60      * @param k The key to add
61      * @param r The address to which requests should be directed for
62      *          this key if the data is removed
63      * @param d The data associated with this key
64      **/
65      public void put(Key k, Address r, Data d);
66  
67  }