public class HopCount extends BaseTable
Field | Type | Description |
---|---|---|
id | BIGINT | Primary Key |
jobid | BIGINT | Reference:jobs.id |
linktype | VARCHAR(255) | |
parentidhash | VARCHAR(40) | |
distance | BIGINT | |
deathmark | CHAR(1) |
Modifier and Type | Class and Description |
---|---|
protected static class |
HopCount.Answer
This class represents an answer - which consists both of an answer value, and also the dependencies
of that answer (i.e.
|
protected class |
HopCount.DocumentHash
The Document Hash structure contains the document nodes we are interested in, including those we need answers
for to proceed.
|
protected static class |
HopCount.DocumentNode
This class keeps track of the data associated with a node in the hash map.
|
protected static class |
HopCount.DocumentReference
This class describes a document reference.
|
protected static class |
HopCount.NodeQueue
A queue object allows document nodes to be ordered appropriately for the most efficient execution.
|
protected static class |
HopCount.NodeReference
This class describes a node link reference.
|
protected static class |
HopCount.Question
A class describing a document identifier and a link type, to be used in looking up the appropriate node in
the hash.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
_rcsid |
static int |
ANSWER_INFINITY |
static int |
ANSWER_UNKNOWN |
protected HopDeleteDeps |
deleteDepsManager
Hop "delete" dependencies manager
|
static java.lang.String |
distanceField |
static java.lang.String |
idField |
protected IntrinsicLink |
intrinsicLinkManager
Intrinsic link table manager.
|
static java.lang.String |
jobIDField |
static java.lang.String |
linkTypeField |
protected ILockManager |
lockManager
Lock manager
|
static int |
MARK_DELETING |
static int |
MARK_NORMAL |
static int |
MARK_QUEUED |
static java.lang.String |
markForDeathField |
protected static java.util.Map |
markMap |
static java.lang.String |
parentIDHashField |
protected static java.lang.Boolean |
storeHopCount
If the global cluster property "storehopcount" is set to false(defaults to true), disable support for hopcount handling completely,
the hopcount will never be recorded in the "intrinsiclink" or "hopcount" tables for any job at all.
|
protected IThreadContext |
threadContext
Thread context
|
dbInterface, tableName
Constructor and Description |
---|
HopCount(IThreadContext tc,
IDBInterface database)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean[] |
addToProcessingQueue(java.lang.Long jobID,
java.lang.String[] affectedLinkTypes,
java.lang.String[] documentIDHashes,
HopCount.Answer[] startingAnswers,
java.lang.String sourceDocumentIDHash,
java.lang.String linkType,
int hopcountMethod)
Add documents to the processing queue.
|
void |
deinstall()
Uninstall.
|
void |
deleteDocumentIdentifiers(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
java.lang.String[] documentHashes,
int hopcountMethod)
Remove a set of document identifier hashes.
|
void |
deleteMatchingDocuments(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
java.lang.String joinTableName,
java.lang.String joinTableIDColumn,
java.lang.String joinTableJobColumn,
java.lang.String joinTableCriteria,
java.util.ArrayList joinTableParams,
int hopcountMethod)
Remove a set of document identifiers specified as a criteria.
|
void |
deleteOwner(java.lang.Long jobID)
Delete an owner (and clean up the corresponding hopcount rows).
|
protected void |
doDeleteDocuments(java.lang.Long jobID,
java.lang.String[] documentHashes)
Invalidate links that start with a specific set of documents.
|
protected void |
doDeleteDocuments(java.lang.Long jobID,
java.lang.String joinTableName,
java.lang.String joinTableIDColumn,
java.lang.String joinTableJobColumn,
java.lang.String joinTableCriteria,
java.util.ArrayList joinTableParams)
Invalidate links that start with a specific set of documents, described by
a table join.
|
protected void |
doDeleteInvalidation(java.lang.Long jobID,
java.lang.String[] sourceDocumentHashes)
Invalidate targets of links which have a given set of source documents.
|
protected void |
doFinish(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
java.lang.String[] sourceDocumentHashes,
int hopcountMethod)
Method that does the work of "finishing" a set of child references.
|
protected boolean[] |
doRecord(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
java.lang.String sourceDocumentIDHash,
java.lang.String[] targetDocumentIDHashes,
java.lang.String linkType,
int hopcountMethod,
java.lang.String processID)
Do the work of recording source-target references.
|
int[] |
findHopCounts(java.lang.Long jobID,
java.lang.String[] parentIdentifierHashes,
java.lang.String linkType)
Calculate a bunch of hop-counts.
|
void |
finishParents(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
java.lang.String[] sourceDocumentHashes,
int hopcountMethod)
Complete a recalculation pass for a set of source documents.
|
void |
finishSeedReferences(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
int hopcountMethod)
Finish seed references.
|
protected IResultSet |
getDocumentChildren(java.lang.Long jobID,
java.lang.String documentIDHash)
Get document's children.
|
void |
install(java.lang.String jobsTable,
java.lang.String jobsColumn)
Install or upgrade.
|
protected void |
markForDelete(java.lang.Long jobID,
java.util.ArrayList list,
java.lang.String commonNewExpression,
java.util.ArrayList commonNewList) |
protected void |
markForDocumentDelete(java.lang.Long jobID,
java.util.ArrayList list) |
static java.lang.String |
markToString(int mark)
Go from mark to string.
|
protected int |
maxClauseMarkForDelete(java.lang.Long jobID) |
protected int |
maxClauseMarkForDocumentDelete(java.lang.Long jobID) |
protected int |
maxClausePerformFindMissingRecords(java.lang.Long jobID,
java.lang.String[] affectedLinkTypes)
Calculate max clauses
|
protected int |
maxClausePerformGetCachedDistanceDeps() |
protected int |
maxClausePerformGetCachedDistances(java.lang.Long jobID)
Calculate the max clauses.
|
protected int |
maxClauseProcessFind(java.lang.Long jobID,
java.lang.String linkType)
Find max clause count.
|
protected void |
performFindMissingRecords(java.lang.Long jobID,
java.lang.String[] affectedLinkTypes,
java.util.ArrayList list,
java.util.Map<HopCount.Question,java.lang.Long> matchMap)
Limited find for missing records.
|
protected void |
performGetCachedDistanceDeps(java.util.Map<java.lang.Long,HopCount.DocumentNode> depsMap,
java.util.ArrayList list)
Do a limited fetch of cached distance dependencies
|
protected void |
performGetCachedDistances(HopCount.DocumentNode[] rval,
java.util.Map<HopCount.Question,java.lang.Integer> indexMap,
java.util.Map<java.lang.Long,HopCount.DocumentNode> depsMap,
java.lang.Long jobID,
java.util.ArrayList ltList,
java.util.ArrayList list)
Do a limited fetch of cached distances
|
protected void |
performMarkAddDeps(java.lang.String query,
java.util.ArrayList list)
Do the work of marking add-dep-dependent links in the hopcount table.
|
protected void |
processFind(int[] rval,
java.util.Map rvalMap,
java.lang.Long jobID,
java.lang.String linkType,
java.util.ArrayList list)
Process a portion of a find request for hopcount information.
|
boolean |
processQueue(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
int hopcountMethod)
Process a stage of the propagation queue for a job.
|
protected HopCount.DocumentNode[] |
readCachedNodes(java.lang.Long jobID,
HopCount.Question[] unansweredQuestions)
Find the cached distance from a set of identifiers to the root.
|
boolean |
recordReference(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
java.lang.String sourceDocumentIDHash,
java.lang.String targetDocumentIDHash,
java.lang.String linkType,
int hopcountMethod,
java.lang.String processID)
Record a reference from source to target.
|
boolean[] |
recordReferences(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
java.lang.String sourceDocumentIDHash,
java.lang.String[] targetDocumentIDHashes,
java.lang.String linkType,
int hopcountMethod,
java.lang.String processID)
Record a set of references from source to target.
|
void |
recordSeedReferences(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
java.lang.String[] targetDocumentIDHashes,
int hopcountMethod,
java.lang.String processID)
Record references from a set of documents to the root.
|
void |
restart()
Clean up after all process IDs.
|
void |
restart(java.lang.String processID)
Reset, at startup time.
|
void |
restartCluster()
Restart entire cluster.
|
void |
revertParents(java.lang.Long jobID,
java.lang.String[] sourceDocumentHashes)
Revert newly-added links, because of a possibly incomplete document processing phase.
|
static int |
stringToMark(java.lang.String value)
Go from string to mark.
|
protected void |
writeCachedDistance(java.lang.Long jobID,
java.lang.String[] legalLinkTypes,
HopCount.DocumentNode dn,
int hopcountMethod)
Write a distance into the cache.
|
addTableIndex, analyzeTable, beginTransaction, buildConjunctionClause, constructCountClause, constructDistinctOnClause, constructDoubleCastClause, constructOffsetLimitClause, constructRegexpClause, constructSubstringClause, endTransaction, findConjunctionClauseMax, getDatabaseCacheKey, getDBInterface, getMaxInClause, getMaxOrClause, getSleepAmt, getTableIndexes, getTableName, getTableSchema, getTransactionID, getWindowedReportMaxRows, makeTableKey, noteModifications, performAddIndex, performAlter, performCommit, performCreate, performDelete, performDrop, performInsert, performModification, performQuery, performQuery, performRemoveIndex, performUpdate, prepareRowForSave, readRow, reindexTable, signalRollback, sleepFor
public static final java.lang.String _rcsid
public static final int ANSWER_UNKNOWN
public static final int ANSWER_INFINITY
public static final java.lang.String idField
public static final java.lang.String jobIDField
public static final java.lang.String linkTypeField
public static final java.lang.String parentIDHashField
public static final java.lang.String distanceField
public static final java.lang.String markForDeathField
public static final int MARK_NORMAL
public static final int MARK_QUEUED
public static final int MARK_DELETING
protected static java.util.Map markMap
protected IntrinsicLink intrinsicLinkManager
protected HopDeleteDeps deleteDepsManager
protected IThreadContext threadContext
protected final ILockManager lockManager
protected static java.lang.Boolean storeHopCount
public HopCount(IThreadContext tc, IDBInterface database) throws ManifoldCFException
database
- is the database handle.ManifoldCFException
public void install(java.lang.String jobsTable, java.lang.String jobsColumn) throws ManifoldCFException
ManifoldCFException
public void deinstall() throws ManifoldCFException
ManifoldCFException
public static int stringToMark(java.lang.String value) throws ManifoldCFException
value
- is the string.ManifoldCFException
public static java.lang.String markToString(int mark) throws ManifoldCFException
mark
- is the mark.ManifoldCFException
public void deleteOwner(java.lang.Long jobID) throws ManifoldCFException
ManifoldCFException
public void restart(java.lang.String processID) throws ManifoldCFException
processID
- is the process ID.ManifoldCFException
public void restart() throws ManifoldCFException
ManifoldCFException
public void restartCluster() throws ManifoldCFException
ManifoldCFException
public void recordSeedReferences(java.lang.Long jobID, java.lang.String[] legalLinkTypes, java.lang.String[] targetDocumentIDHashes, int hopcountMethod, java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public void finishSeedReferences(java.lang.Long jobID, java.lang.String[] legalLinkTypes, int hopcountMethod) throws ManifoldCFException
ManifoldCFException
public boolean recordReference(java.lang.Long jobID, java.lang.String[] legalLinkTypes, java.lang.String sourceDocumentIDHash, java.lang.String targetDocumentIDHash, java.lang.String linkType, int hopcountMethod, java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public boolean[] recordReferences(java.lang.Long jobID, java.lang.String[] legalLinkTypes, java.lang.String sourceDocumentIDHash, java.lang.String[] targetDocumentIDHashes, java.lang.String linkType, int hopcountMethod, java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public void finishParents(java.lang.Long jobID, java.lang.String[] legalLinkTypes, java.lang.String[] sourceDocumentHashes, int hopcountMethod) throws ManifoldCFException
ManifoldCFException
public void revertParents(java.lang.Long jobID, java.lang.String[] sourceDocumentHashes) throws ManifoldCFException
ManifoldCFException
protected boolean[] doRecord(java.lang.Long jobID, java.lang.String[] legalLinkTypes, java.lang.String sourceDocumentIDHash, java.lang.String[] targetDocumentIDHashes, java.lang.String linkType, int hopcountMethod, java.lang.String processID) throws ManifoldCFException
ManifoldCFException
public void deleteMatchingDocuments(java.lang.Long jobID, java.lang.String[] legalLinkTypes, java.lang.String joinTableName, java.lang.String joinTableIDColumn, java.lang.String joinTableJobColumn, java.lang.String joinTableCriteria, java.util.ArrayList joinTableParams, int hopcountMethod) throws ManifoldCFException
ManifoldCFException
public void deleteDocumentIdentifiers(java.lang.Long jobID, java.lang.String[] legalLinkTypes, java.lang.String[] documentHashes, int hopcountMethod) throws ManifoldCFException
ManifoldCFException
public int[] findHopCounts(java.lang.Long jobID, java.lang.String[] parentIdentifierHashes, java.lang.String linkType) throws ManifoldCFException
ManifoldCFException
protected int maxClauseProcessFind(java.lang.Long jobID, java.lang.String linkType)
protected void processFind(int[] rval, java.util.Map rvalMap, java.lang.Long jobID, java.lang.String linkType, java.util.ArrayList list) throws ManifoldCFException
ManifoldCFException
public boolean processQueue(java.lang.Long jobID, java.lang.String[] legalLinkTypes, int hopcountMethod) throws ManifoldCFException
jobID
- is the job we need to have the hopcount propagated for.ManifoldCFException
protected int maxClausePerformFindMissingRecords(java.lang.Long jobID, java.lang.String[] affectedLinkTypes)
protected void performFindMissingRecords(java.lang.Long jobID, java.lang.String[] affectedLinkTypes, java.util.ArrayList list, java.util.Map<HopCount.Question,java.lang.Long> matchMap) throws ManifoldCFException
ManifoldCFException
protected boolean[] addToProcessingQueue(java.lang.Long jobID, java.lang.String[] affectedLinkTypes, java.lang.String[] documentIDHashes, HopCount.Answer[] startingAnswers, java.lang.String sourceDocumentIDHash, java.lang.String linkType, int hopcountMethod) throws ManifoldCFException
jobID
- is the job the documents belong to.affectedLinkTypes
- are the set of affected link types.documentIDHashes
- are the documents to add.startingAnswers
- are the hopcounts and delete dependencies for the source document as they are currently known.
The size of this array is the same as the size of the affectedLinkTypes array.sourceDocumentIDHash
- is the source document identifier for the links from source to target documents.linkType
- is the link type for this queue addition.hopcountMethod
- is the desired method of managing hopcounts.ManifoldCFException
protected void performMarkAddDeps(java.lang.String query, java.util.ArrayList list) throws ManifoldCFException
ManifoldCFException
protected void doFinish(java.lang.Long jobID, java.lang.String[] legalLinkTypes, java.lang.String[] sourceDocumentHashes, int hopcountMethod) throws ManifoldCFException
ManifoldCFException
protected void doDeleteDocuments(java.lang.Long jobID, java.lang.String joinTableName, java.lang.String joinTableIDColumn, java.lang.String joinTableJobColumn, java.lang.String joinTableCriteria, java.util.ArrayList joinTableParams) throws ManifoldCFException
ManifoldCFException
protected void doDeleteDocuments(java.lang.Long jobID, java.lang.String[] documentHashes) throws ManifoldCFException
ManifoldCFException
protected int maxClauseMarkForDocumentDelete(java.lang.Long jobID)
protected void markForDocumentDelete(java.lang.Long jobID, java.util.ArrayList list) throws ManifoldCFException
ManifoldCFException
protected void doDeleteInvalidation(java.lang.Long jobID, java.lang.String[] sourceDocumentHashes) throws ManifoldCFException
ManifoldCFException
protected int maxClauseMarkForDelete(java.lang.Long jobID)
protected void markForDelete(java.lang.Long jobID, java.util.ArrayList list, java.lang.String commonNewExpression, java.util.ArrayList commonNewList) throws ManifoldCFException
ManifoldCFException
protected IResultSet getDocumentChildren(java.lang.Long jobID, java.lang.String documentIDHash) throws ManifoldCFException
ManifoldCFException
protected HopCount.DocumentNode[] readCachedNodes(java.lang.Long jobID, HopCount.Question[] unansweredQuestions) throws ManifoldCFException
ManifoldCFException
protected int maxClausePerformGetCachedDistanceDeps()
protected void performGetCachedDistanceDeps(java.util.Map<java.lang.Long,HopCount.DocumentNode> depsMap, java.util.ArrayList list) throws ManifoldCFException
ManifoldCFException
protected int maxClausePerformGetCachedDistances(java.lang.Long jobID)
protected void performGetCachedDistances(HopCount.DocumentNode[] rval, java.util.Map<HopCount.Question,java.lang.Integer> indexMap, java.util.Map<java.lang.Long,HopCount.DocumentNode> depsMap, java.lang.Long jobID, java.util.ArrayList ltList, java.util.ArrayList list) throws ManifoldCFException
ManifoldCFException
protected void writeCachedDistance(java.lang.Long jobID, java.lang.String[] legalLinkTypes, HopCount.DocumentNode dn, int hopcountMethod) throws ManifoldCFException
ManifoldCFException