|
ePOST API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.post.log.Log
public class Log
Class which represents a log in the POST system. Clients can use this log in order to get lists of sublogs, or walk backwards down all of the entries. Log classes are stored in PAST at specific locations, and are updated whenever a change is made to the log. This class also provides the proper synchronization so that quick calls to the addLogEntry() method do not overwrite each other.
Nested Class Summary | |
---|---|
protected class |
Log.AddLogEntryTask
This class encapsulates the logic needed to add a log entry to the current log. |
Field Summary | |
---|---|
protected java.util.Vector |
buffer
A vector of ongoing buffered tasks - in case two addLogEntries() are called in quick succession. |
protected java.util.HashMap |
children
A map of the names of the child logs to their references. |
protected java.util.HashMap |
childrenCache
A cache of references to our children |
protected Id |
location
The location of this log in PAST. |
protected Logger |
logger
|
protected static int |
N_TOP_ENTRIES
Number of topEntryReferences to keep around. |
protected java.lang.Object |
name
Some unique identifier to name this log. |
protected Post |
post
The current local POST service. |
protected LogEntry |
topEntry
The most recent entry in this log. |
protected LogEntryReference |
topEntryReference
A reference to the most recent entry in this log. |
protected LogEntryReference[] |
topEntryReferences
References to the last n entries in this log. |
Constructor Summary | |
---|---|
Log(java.lang.Object name,
Id location,
Post post)
Constructs a Log for use in POST |
Method Summary | |
---|---|
void |
addChildLog(Log log,
Continuation command)
This method adds a child log to this log, essentially forming a tree of logs. |
void |
addLogEntry(LogEntry entry,
Continuation command)
This method appends an entry into the user's log, and updates the pointer to the top of the log to reflect the new object. |
ContentHashReference |
buildContentHashReference(Id[] location,
byte[][] key)
This method is not supported (you CAN NOT store a log as a content-hash block). |
SecureReference |
buildSecureReference(Id location,
byte[] key)
This method is not supported (you CAN NOT store a log as a secure block). |
SignedReference |
buildSignedReference(Id location)
Builds a LogReference object to this log, given a location. |
boolean |
cache()
Returns whether or not this log should be cached |
void |
getChildLog(java.lang.Object name,
Continuation command)
This method returns a the specific child log of this log, given the child log's name. |
java.lang.Object[] |
getChildLogNames()
This method returns an array of the names of all of the current child logs of this log. |
Id |
getLocation()
|
void |
getLogEntryReferences(java.util.Set set,
LogEntry entry,
Continuation command)
This method returns a list of all the handles stored in the folder or any subfolders. |
java.lang.Object |
getName()
|
protected void |
getRealTopEntry(Continuation command)
Internal method to get the *actual* top entry |
void |
getTopEntry(Continuation command)
This method returns a reference to the most recent entry in the log, which can then be used to walk down the log. |
LogEntryReference |
getTopEntryReference()
Returns the reference to the most recent log entry |
void |
removeChildLog(java.lang.Object name,
Continuation command)
This method removes a child log from this log. |
void |
setName(java.lang.Object name,
Continuation command)
Sets the name of this log. |
void |
setPost(Post post)
Sets the current local Post service. |
protected void |
sync(Continuation command)
Helper method to sync this log object on the network. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Id location
protected java.lang.Object name
protected java.util.HashMap children
protected transient Post post
protected transient java.util.Vector buffer
protected LogEntryReference topEntryReference
protected static final int N_TOP_ENTRIES
protected LogEntryReference[] topEntryReferences
protected transient LogEntry topEntry
protected transient java.util.HashMap childrenCache
protected transient Logger logger
Constructor Detail |
---|
public Log(java.lang.Object name, Id location, Post post)
name
- Some unique identifier for this loglocation
- The location of this log in PASTMethod Detail |
---|
public boolean cache()
public Id getLocation()
public java.lang.Object getName()
public void setName(java.lang.Object name, Continuation command)
name
- The new namecommand
- The command to run once donepublic void setPost(Post post)
post
- The current local Post serviceprotected void sync(Continuation command)
command
- The command to run once donepublic void addChildLog(Log log, Continuation command)
log
- The log to add as a child.command
- The command to run once donepublic void removeChildLog(java.lang.Object name, Continuation command)
log
- The log to removecommand
- The command to run once donepublic java.lang.Object[] getChildLogNames()
public void getChildLog(java.lang.Object name, Continuation command)
name
- The name of the log to return.command
- The command to run once done.public void addLogEntry(LogEntry entry, Continuation command)
entry
- The log entry to append to the log.command
- The command to run once donepublic LogEntryReference getTopEntryReference()
public void getTopEntry(Continuation command)
protected final void getRealTopEntry(Continuation command)
public void getLogEntryReferences(java.util.Set set, LogEntry entry, Continuation command)
public SignedReference buildSignedReference(Id location)
buildSignedReference
in interface PostData
location
- The location of this object.
public ContentHashReference buildContentHashReference(Id[] location, byte[][] key)
buildContentHashReference
in interface PostData
location
- The locationkey
-
java.lang.IllegalArgumentException
- Alwayspublic SecureReference buildSecureReference(Id location, byte[] key)
buildSecureReference
in interface PostData
location
- The location of the datakey
- The for the data
java.lang.IllegalArgumentException
- Alwayspublic java.lang.String toString()
toString
in class java.lang.Object
|
ePOST API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |