java.lang.Object | +--net.captp.tables.SwissTable
Untamed:
SwissTable(ESecureRandom entropy)
void
addFaultHandler(OneArgFunc swissDB)
BigInteger
getIdentity(Object obj)
BigInteger
getNewSwiss(Object ref)
BigInteger
nextSwiss()
BigInteger
registerIdentity(Object obj,
BigInteger swissBase)
BigInteger
registerNewSwiss(Object ref,
BigInteger swissBase)
void
removeFaultHandler(OneArgFunc swissDB)
private final WeakKeyMap mySelfishToSwiss
private final WeakValueMap mySwissToRef
Note: can't handle null values.
private final ESecureRandom myEntropy
private final FlexSet mySwissDBs
public SwissTable(ESecureRandom entropy)
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.)
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()