|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.captp.tables.SwissTable
Untamed:
Field Summary | |
private ESecureRandom |
myEntropy
Provides new unguessable SwissNumbers. |
private WeakKeyMap |
mySelfishToSwiss
Maps from NEAR Selfish objects to SwissNumbers. |
private FlexSet |
mySwissDBs
OneArgFuncs that handle lookup faulting. |
private WeakValueMap |
mySwissToRef
Maps from SwissNumber to anything. |
Constructor Summary | |
SwissTable(ESecureRandom entropy)
Enabled: |
Method Summary | |
void |
addFaultHandler(OneArgFunc swissDB)
Enabled: A SwissDB is able to supplement the SwissTable's internal mySwissToRef table with further storage that gets faulted on demand. |
BigInteger |
getIdentity(Object obj)
Enabled: Returns the SwissNumber which represents the identity of this near Selfish object in this vat. |
BigInteger |
getNewSwiss(Object ref)
Enabled: Returns a SwissNumber with which this ref can be looked up. |
Object |
lookupSwiss(BigInteger swissNum)
Enabled: Lookup an object by SwissNumber. |
BigInteger |
nextSwiss()
Enabled: A convenience method typically used to obtain new SwissBases (archashes of SwissNumbers). |
BigInteger |
registerIdentity(Object obj,
BigInteger swissBase)
Enabled: Registers obj to have the identity 'swissBase cryptoHash()'. |
BigInteger |
registerNewSwiss(Object ref,
BigInteger swissBase)
Enabled: Registers ref at 'swissBase.cryptoHash()'. |
void |
removeFaultHandler(OneArgFunc swissDB)
Enabled: Removes a registered (by addFaultHandler) swissDB. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final WeakKeyMap mySelfishToSwiss
private final WeakValueMap mySwissToRef
Note: can't handle null values.
private final ESecureRandom myEntropy
private final FlexSet mySwissDBs
Constructor Detail |
public SwissTable(ESecureRandom entropy)
Method Detail |
public Object lookupSwiss(BigInteger swissNum) throws IndexOutOfBoundsException
If not found, throw an IndexOutOfBoundsException. This is necessary since null is a valid return value. (By decree, the SwissNumber 0 designates null.)
IndexOutOfBoundsException
public void addFaultHandler(OneArgFunc swissDB)
When the SwissTable's lookupSwiss fails to find the swissNum in the internal table, it invokes each of its registered swissDBs with a hash of the swissNumber being looked up. This is known as a swissHash, and represents the identity of the object without providing any authority to access the object. A swissDB which has stored a representation of the object elsewhere should then register the object using registerIdentity or registerSwiss, both of which require the swissBase -- the archash of the swissNumber being looked up. In other words,
swissBase cryptoHash() -> swissNum swissNum crytoHash() -> swissHash
If an already registered swissDB is re-registered, an exception is thrown.
public void removeFaultHandler(OneArgFunc swissDB)
If not there, this method does nothing.
public BigInteger getIdentity(Object obj)
If not 'Ref.isSelfish(obj)", then this will throw an Exception.
This returns the unique SwissNumber which represents the designated near selfish object's unique identity within this vat. If the object wasn't yet associated with a SwissNumber, it will be now.
public BigInteger getNewSwiss(Object ref)
This method always assigns and returns a new unique SwissNumber, even for NEAR Selfish objects that already have one, with one exception. The swissNumber for null is always 0.
public BigInteger registerIdentity(Object obj, BigInteger swissBase)
The cryptoHash of a SwissBase is a SwissNumber, so we also say that the archash of a SwissNumber is a SwissBase. (Of course, our security rests on the assumption that the archash is infeasible to compute.) Since an unconfined client of an object can often get its SwissNumber, something more is needed to establish authority to associate an object with a SwissNumber. For this "something more", we use knowledge of the archash of the number.
The object is given the new identity 'swissBase cryptoHash()', assuming this doesn't conflict with any existing registrations. If it does, an exception is thrown.
public BigInteger registerNewSwiss(Object ref, BigInteger swissBase)
registerNewSwiss() is to registerIdentity() as getNewSwiss() is to getIdentity(). 'swissBase.cryptoHash()' must not already be registered, or an exception will be thrown. If ref is null, an exception is thrown (since we assume its infeasible to find the archash of zero).
public BigInteger nextSwiss()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |