|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tranche.commons.Debuggable
org.tranche.logs.activity.ActivityLog
public class ActivityLog
Activity log used to log all requests that impact data held by Tranche server.
| Field Summary | |
|---|---|
static java.lang.String |
BACKUP_SUFFIX
|
static java.lang.String |
DEFAULT_FILE_NAME_ACTIVITIES
|
static java.lang.String |
DEFAULT_FILE_NAME_SIGNATURES_ENTRIES
|
static java.lang.String |
DEFAULT_FILE_NAME_SIGNATURES_INDEX
|
| Constructor Summary | |
|---|---|
ActivityLog()
Instantiate an activity log used to log all requests that impact data held by Tranche server. |
|
ActivityLog(java.io.File directoryForLogs)
Instantiate an activity log used to log all requests that impact data held by Tranche server. |
|
ActivityLog(java.io.File activitiesLogFile,
java.io.File signaturesIndexFile,
java.io.File signaturesFile)
Instantiate an activity log used to log all requests that impact data held by Tranche server. |
|
| Method Summary | |
|---|---|
void |
close()
Close down the activity log. |
boolean |
contains(long timestamp,
byte action,
BigHash hash)
Performs search to find whether contains an entry representing parameters. |
java.io.File |
getActivitiesLogFile()
|
int |
getActivityCount(long fromTimestamp,
long toTimestamp,
byte mask)
Returns count of all activities between timestamps that match mask. |
long |
getActivityLogEntriesCount()
|
long |
getAvgReadTimeInMillis()
Average time per entry (in milliseconds) spent reading in data. |
long |
getAvgWriteTimeInMillis()
Average time per entry(in milliseconds) spent writing out data. |
java.io.File |
getBackupActivitiesLogFile()
|
java.io.File |
getBackupSignaturesFile()
|
java.io.File |
getBackupSignaturesIndexFile()
|
long |
getLastRecordedTimestamp()
Returns the last recorded timestamp for activity log. |
java.io.File |
getSignaturesFile()
|
java.io.File |
getSignaturesIndexFile()
|
static void |
main(java.lang.String[] args)
|
java.util.List<Activity> |
read(long fromTimestamp,
long toTimestamp,
int limit,
byte mask)
Returns all activities between timestamps up until a specified limit that match the supplied mask. |
void |
write(Activity activity)
Writes activity to various files. |
| Methods inherited from class org.tranche.commons.Debuggable |
|---|
debugErr, debugErr, debugOut, isDebug, setDebug |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_FILE_NAME_ACTIVITIES
public static final java.lang.String DEFAULT_FILE_NAME_SIGNATURES_INDEX
public static final java.lang.String DEFAULT_FILE_NAME_SIGNATURES_ENTRIES
public static final java.lang.String BACKUP_SUFFIX
| Constructor Detail |
|---|
public ActivityLog()
throws java.io.IOException,
java.lang.Exception
Instantiate an activity log used to log all requests that impact data held by Tranche server.
This constructor will create log files in the persistent directory using the default file names.
java.io.IOException - If log files do not exist and cannot be created or other I/O exception
java.lang.ExceptionPersistentFileUtil#getPersistentDirectory()
public ActivityLog(java.io.File directoryForLogs)
throws java.io.IOException,
java.lang.Exception
Instantiate an activity log used to log all requests that impact data held by Tranche server.
This contrustor will create log files in the specified directory using the default file names.
directoryForLogs - Directory
java.io.IOException - If log files do not exist and cannot be created or other I/O exception
java.lang.Exception
public ActivityLog(java.io.File activitiesLogFile,
java.io.File signaturesIndexFile,
java.io.File signaturesFile)
throws java.io.IOException,
java.lang.Exception
Instantiate an activity log used to log all requests that impact data held by Tranche server.
This constructor uses specified log file locations.
activitiesLogFile - signaturesIndexFile - signaturesFile -
java.io.IOException - If log files do not exist and cannot be created or other I/O exception
java.lang.Exception| Method Detail |
|---|
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
public void write(Activity activity)
throws java.io.IOException,
java.security.cert.CertificateEncodingException
Writes activity to various files.
Thread safe.
activity -
java.io.IOException
java.security.cert.CertificateEncodingException
public boolean contains(long timestamp,
byte action,
BigHash hash)
throws java.io.IOException,
java.lang.Exception
Performs search to find whether contains an entry representing parameters.
timestamp - action - hash -
java.io.IOException
java.lang.Exception
public java.util.List<Activity> read(long fromTimestamp,
long toTimestamp,
int limit,
byte mask)
throws java.lang.Exception
Returns all activities between timestamps up until a specified limit that match the supplied mask.
fromTimestamp - Starting timestamp (inclusive)toTimestamp - Ending timestamp (inclusive)limit - Limit to number of entries to return. Should use Integer.MAX_VALUE if want all entriesmask - Used to match activity bytes. If all the bits in the mask are included in the activity byte, then the activity will be included. For example, if the mask is Activity.ACTION_TYPE_SET, then all logs that have this bit set (set data and set meta data) will be included. However, if Activity.SET_DATA is the mask, then only set data actions will match (since there are two bits set in the mask, making it more restrictive). 0 is least restrictive (restricts nothing) and 0xFF is most restrictive (restricts everything but itself).
java.lang.Exception
public int getActivityCount(long fromTimestamp,
long toTimestamp,
byte mask)
throws java.io.IOException,
java.lang.Exception
Returns count of all activities between timestamps that match mask.
fromTimestamp - Starting timestamp (inclusive)toTimestamp - Ending timestamp (inclusive)mask - Used to match activity bytes. If all the bits in the mask are included in the activity byte, then the activity will be included. For example, if the mask is Activity.ACTION_TYPE_SET, then all logs that have this bit set (set data and set meta data) will be included. However, if Activity.SET_DATA is the mask, then only set data actions will match (since there are two bits set in the mask, making it more restrictive). 0 is least restrictive (restricts nothing) and 0xFF is most restrictive (restricts everything but itself).
java.io.IOException
java.lang.Exceptionpublic long getAvgWriteTimeInMillis()
Average time per entry(in milliseconds) spent writing out data.
public long getAvgReadTimeInMillis()
Average time per entry (in milliseconds) spent reading in data.
public void close()
throws java.io.IOException
Close down the activity log. Once closed, cannot reopen.
Thread safe.
java.io.IOExceptionpublic java.io.File getActivitiesLogFile()
public java.io.File getSignaturesIndexFile()
public java.io.File getSignaturesFile()
public java.io.File getBackupActivitiesLogFile()
public java.io.File getBackupSignaturesIndexFile()
public java.io.File getBackupSignaturesFile()
public long getActivityLogEntriesCount()
public long getLastRecordedTimestamp()
throws java.io.IOException
Returns the last recorded timestamp for activity log. If not found, returns -1.
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||