Rice Pastry API

org.mpisws.p2p.transport.peerreview.commitment
Class AuthenticatorStoreImpl<Identifier>

java.lang.Object
  extended by org.mpisws.p2p.transport.peerreview.commitment.AuthenticatorStoreImpl<Identifier>
All Implemented Interfaces:
AuthenticatorStore<Identifier>

public class AuthenticatorStoreImpl<Identifier>
extends java.lang.Object
implements AuthenticatorStore<Identifier>


Field Summary
protected  boolean allowDuplicateSeqs
           
 
Constructor Summary
AuthenticatorStoreImpl(PeerReview<Identifier> peerreview, boolean allowDuplicateSeqs)
           
 
Method Summary
 void addAuthenticator(Identifier id, Authenticator authenticator)
          Also writes it to disk.
protected  void addAuthenticatorToMemory(Identifier id, Authenticator authenticator)
          Add a new authenticator.
 void destroy()
           
protected  java.util.SortedSet<Authenticator> findSubject(Identifier id)
           
 void flush(Identifier id)
           
 void flushAll()
           
 void flushAuthenticatorsFor(Identifier id, long minseq, long maxseq)
           
protected  void flushAuthenticatorsFromMemory(Identifier id, long minseq, long maxseq)
          Discard the authenticators in a certain sequence range (presumably because we just checked them against the corresponding log segment, and they were okay)
 void garbageCollect()
          Commits the Authenticators in memory to disk, overwriting the old store.
 java.util.List<Authenticator> getAuthenticators(Identifier id, long minseq, long maxseq)
          Retrieve all the authenticators within a given range of sequence numbers
 int getAuthenticatorSizeBytes()
           
 Authenticator getLastAuthenticatorBefore(Identifier id, long seq)
           
 Authenticator getMostRecentAuthenticator(Identifier id)
           
 int getNumSubjects()
           
 Authenticator getOldestAuthenticator(Identifier id)
           
 java.util.List<Identifier> getSubjects()
           
 int numAuthenticatorsFor(Identifier id)
           
 int numAuthenticatorsFor(Identifier id, long minseq, long maxseq)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allowDuplicateSeqs

protected boolean allowDuplicateSeqs
Constructor Detail

AuthenticatorStoreImpl

public AuthenticatorStoreImpl(PeerReview<Identifier> peerreview,
                              boolean allowDuplicateSeqs)
Method Detail

destroy

public void destroy()

addAuthenticatorToMemory

protected void addAuthenticatorToMemory(Identifier id,
                                        Authenticator authenticator)
Add a new authenticator. Note that in memory, the authenticators are sorted by nodeID and by sequence number, whereas on disk, they are not sorted at all.


flushAuthenticatorsFromMemory

protected void flushAuthenticatorsFromMemory(Identifier id,
                                             long minseq,
                                             long maxseq)
Discard the authenticators in a certain sequence range (presumably because we just checked them against the corresponding log segment, and they were okay)


findSubject

protected java.util.SortedSet<Authenticator> findSubject(Identifier id)

addAuthenticator

public void addAuthenticator(Identifier id,
                             Authenticator authenticator)
                      throws java.io.IOException
Description copied from interface: AuthenticatorStore
Also writes it to disk.

Specified by:
addAuthenticator in interface AuthenticatorStore<Identifier>
Throws:
java.io.IOException

flushAuthenticatorsFor

public void flushAuthenticatorsFor(Identifier id,
                                   long minseq,
                                   long maxseq)
Specified by:
flushAuthenticatorsFor in interface AuthenticatorStore<Identifier>

garbageCollect

public void garbageCollect()
                    throws java.io.IOException
Description copied from interface: AuthenticatorStore
Commits the Authenticators in memory to disk, overwriting the old store. Since the authenticator file on disk is append-only, we need to garbage collect it from time to time. When this becomes necessary, we clear the file and then write out the authenticators currently in memory.

Specified by:
garbageCollect in interface AuthenticatorStore<Identifier>
Throws:
java.io.IOException

getAuthenticatorSizeBytes

public int getAuthenticatorSizeBytes()
Specified by:
getAuthenticatorSizeBytes in interface AuthenticatorStore<Identifier>

getAuthenticators

public java.util.List<Authenticator> getAuthenticators(Identifier id,
                                                       long minseq,
                                                       long maxseq)
Description copied from interface: AuthenticatorStore
Retrieve all the authenticators within a given range of sequence numbers

Specified by:
getAuthenticators in interface AuthenticatorStore<Identifier>

getLastAuthenticatorBefore

public Authenticator getLastAuthenticatorBefore(Identifier id,
                                                long seq)
Specified by:
getLastAuthenticatorBefore in interface AuthenticatorStore<Identifier>

getMostRecentAuthenticator

public Authenticator getMostRecentAuthenticator(Identifier id)
Specified by:
getMostRecentAuthenticator in interface AuthenticatorStore<Identifier>

getNumSubjects

public int getNumSubjects()
Specified by:
getNumSubjects in interface AuthenticatorStore<Identifier>

getOldestAuthenticator

public Authenticator getOldestAuthenticator(Identifier id)
Specified by:
getOldestAuthenticator in interface AuthenticatorStore<Identifier>

getSubjects

public java.util.List<Identifier> getSubjects()
Specified by:
getSubjects in interface AuthenticatorStore<Identifier>

numAuthenticatorsFor

public int numAuthenticatorsFor(Identifier id)
Specified by:
numAuthenticatorsFor in interface AuthenticatorStore<Identifier>

numAuthenticatorsFor

public int numAuthenticatorsFor(Identifier id,
                                long minseq,
                                long maxseq)
Specified by:
numAuthenticatorsFor in interface AuthenticatorStore<Identifier>

flush

public void flush(Identifier id)
Specified by:
flush in interface AuthenticatorStore<Identifier>

flushAll

public void flushAll()
Specified by:
flushAll in interface AuthenticatorStore<Identifier>

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.