public class TracePushAPI extends PipedPushAPI
Modifier and Type | Class and Description |
---|---|
protected static class |
TracePushAPI.SortedTick |
protected static class |
TracePushAPI.SortedTickComparator |
class |
TracePushAPI.StatSlice
Piece of stat.
|
defaultLogger, isBestEffortOnStopSession, jlogger, logger, parent
DEFAULT_CHECKPOINT_NAME, STREAMING_BLOCK_SIZE
Constructor and Description |
---|
TracePushAPI(PushAPI source)
Create a new TracePushAPI
|
TracePushAPI(PushAPI source,
long logOperationsFrequency)
Create a new TracePushAPI
|
Modifier and Type | Method and Description |
---|---|
void |
addDocument(Document document)
Adds a document.
|
void |
addDocumentList(Document[] documents)
Adds a set of documents.
|
boolean |
areDocumentsSearchable(java.math.BigInteger serial)
Checks whether documents sent prior a given setCheckpoint operation
are searchable.
|
protected static java.lang.String |
bytesToString(long bytes) |
protected PushAPIException |
catchOperation(int operation,
java.lang.Exception e) |
protected void |
clear() |
void |
clearAllCheckpoints()
Resets all the checkpoints values.
|
long |
countSyncedEntries(java.lang.String rootPath,
EnumerationMode mode)
Counts the number of synchronized entries.
|
static PushAPI |
createPushAPIPlugin(PushAPI papi,
java.lang.String[] keys,
java.lang.String[] values)
Create a new TracePushAPI (PushAPI plugin pipe constructor)
|
void |
deleteDocument(java.lang.String uri)
Deletes a document specified by its URI.
|
void |
deleteDocumentList(int[] did,
int[] slices)
Deletes a list of documents specified by their dids and slices.
|
void |
deleteDocumentList(java.lang.String[] uris)
Deletes a list of documents specified by their URIs.
|
void |
deleteDocumentRootPath(java.lang.String rootPath,
boolean recursive,
boolean clearCache)
Deletes a set of documents corresponding to a URI prefix.
|
void |
deleteDocumentsWithPrefix(java.lang.String prefix,
boolean clearCache)
Deletes a set of documents corresponding to a URI prefix.
|
protected static long |
documentSize(Document document)
Get a Document estimated size.
|
protected void |
endOperation(int operation,
long start) |
protected void |
endOperations() |
java.lang.Iterable<CheckpointInfo> |
enumerateCheckpointInfo()
Enumerates all the checkpoints known by the system (synchronized).
|
java.lang.Iterable<CheckpointInfo> |
enumerateCheckpointInfo(boolean showSynchronizedOnly)
Enumerates all the checkpoints.
|
java.lang.Iterable<SyncedEntry> |
enumerateSyncedEntries(java.lang.String rootPath,
EnumerationMode mode)
Enumerates synchronized entries.
|
protected void |
finalize()
Finalizer.
|
protected static java.lang.String |
formatK(long i) |
java.lang.String |
getCheckpoint(java.lang.String name)
Gets the value of a named checkpoint in the indexing process.
|
CheckpointInfo |
getCheckpoint(java.lang.String name,
boolean showSynchronizedOnly)
Gets the checkpoint detailed information.
|
java.lang.String |
getConnectorName()
Gets the name of the connector associated to this push client.
|
protected static long |
getCurrentThreadCpuTime() |
DocumentStatus |
getDocumentStatus(java.lang.String uri)
Gets document status.
|
DocumentStatus[] |
getDocumentStatusList(java.lang.String[] uris)
Gets the status of a given list of documents in the push server.
|
protected java.lang.String |
getFamilyOperationName(int op) |
protected java.lang.String |
getOperationName(int op) |
protected void |
incBytes(long size) |
protected void |
incOperationFamily(int fop) |
protected void |
incOperationFamily(int fop,
int count) |
protected static java.lang.String |
nsToString(long ns) |
void |
ping()
Tests the connection with the server.
|
java.math.BigInteger |
setCheckpoint(java.lang.String value,
java.lang.String name,
boolean sync)
Sets a checkpoint in the push server.
|
protected void |
startOperations() |
void |
startPushSession()
Starts a new session on the push server.
|
void |
stopPushSession(boolean releaseConnections)
Stops the current session on the push server.
|
void |
sync()
Deprecated.
since V6R2015x, replaced by
synchronize() |
java.math.BigInteger |
synchronize()
Forces the synchronization of all pending operations before returning.
|
protected void |
testDocument(Document doc)
Run all asked tests on a given document
|
protected void |
testDocument(java.lang.String uri,
java.lang.String stamp,
MetaContainer metas)
Run all asked tests on a given document
|
protected void |
testDocuments(Document... docs)
Run all asked tests on all given documents
|
protected void |
testDocuments(java.lang.String[] uriList,
java.lang.String[] stampList,
MetaContainer[] metaContainerList)
Run all asked tests on all given documents
|
protected void |
testMandatoryStamp(Document doc)
Test if the given document contain a non null stamp
|
protected void |
testNullMetas(MetaContainer metaContainer)
Test if all document's metas have a non null name and non null values
|
protected void |
testNullURI(Document doc)
Test if the given document has a non null URI
|
protected void |
testUniqueStreams(Document doc)
Test if all document's parts give a new stream each time getStream is called
|
void |
triggerIndexingJob()
Forces the processing of all pending operations synchronized to disk.
|
void |
triggerIndexingJobWhenIdle()
Wait for indexing to be idle, and forces the processing of all pending
operations synchronized to disk.
|
void |
updateDocument(Document doc,
java.lang.String[] fields)
Partially updates a document.
|
void |
updateDocumentList(Document[] docList,
java.lang.String[][] fieldsList)
Updates a set of documents.
|
void |
updateDocumentMetas(java.lang.String uri,
java.lang.String stamp,
MetaContainer metaContainer)
Updates the stamp and the meta data of a document, using a strict meta to field
mapping.
|
void |
updateDocumentMetasList(java.lang.String[] uriList,
java.lang.String[] stampList,
MetaContainer[] metaContainerList)
Updates a set of the stamp and meta data for given documents.
|
areDocumentsSearchable, clearCheckpoints, debug, error, getBestEffortOnStopSession, getLogger, getParent, info, isTraceEnabled, log, setBestEffortOnStopSession, setLogger, suggestSyncedEntries, trace, warning
countSyncedEntries, deleteDocumentRootPath, deleteDocumentRootPath, deleteDocumentsWithPrefix, enumerateSyncedEntries, getCheckpoint, getDocumentDidsAndSlices, setCheckpoint, setCheckpoint, setCheckpoint
protected long start
protected long end
protected boolean testMandatoryStamp
protected boolean testNullURI
protected boolean testAPICompliance
protected boolean testNullMetas
protected TracePushAPI.StatSlice[] tick
protected TracePushAPI.StatSlice[] fcount
protected java.lang.Long volumeBytes
protected final java.util.concurrent.locks.ReentrantLock volumeBytesLock
public static final long DEFAULT_LOG_OPERATIONS_FREQUENCY
protected final java.lang.ThreadLocal<java.lang.Long> threadTime
protected static java.lang.management.ThreadMXBean threadBean
protected static boolean isCurrentThreadCpuTimeSupported
protected static final int OPERATION_MIN
protected static final int OPERATION_ADDDOCUMENT
protected static final int OPERATION_ADDDOCUMENTLIST
protected static final int OPERATION_AREDOCUMENTSSEARCHABLE
protected static final int OPERATION_CLEARALLCHECKPOINTS
protected static final int OPERATION_COUNTSYNCEDENTRIES
protected static final int OPERATION_DELETEDOCUMENT
protected static final int OPERATION_DELETEDOCUMENTLIST
protected static final int OPERATION_DELETEDOCUMENTLIST_DID
protected static final int OPERATION_DELETEDOCUMENTROOTPATH
protected static final int OPERATION_ENUMERATECHECKPOINTINFO
protected static final int OPERATION_ENUMERATESYNCEDENTRIES
protected static final int OPERATION_GETCHECKPOINT
protected static final int OPERATION_GETCONNECTORNAME
protected static final int OPERATION_GETDOCUMENTSTATUS
protected static final int OPERATION_GETDOCUMENTSTATUSLIST
protected static final int OPERATION_PING
protected static final int OPERATION_SETCHECKPOINT
protected static final int OPERATION_STARTPUSHSESSION
protected static final int OPERATION_STOPPUSHSESSION
protected static final int OPERATION_SYNC
protected static final int OPERATION_TRIGGERINDEXINGJOB
protected static final int OPERATION_UPDATEDOCUMENT
protected static final int OPERATION_UPDATEDOCUMENTLIST
protected static final int OPERATION_UPDATEDOCUMENTMETAS
protected static final int OPERATION_UPDATEDOCUMENTMETASLIST
protected static final int OPERATION_IN_CONNECTOR
protected static final int OPERATION_TRIGGERINDEXINGJOBWHENIDLE
protected static final int OPERATION_GETCHECKPOINTINFO
protected static final int OPERATION_ENUMERATESTATEDCHECKPOINTINFO
protected static final int OPERATION_DELETEDOCUMENSWITHPREFIX
protected static final int OPERATION_MAX
protected static final int OPERATION_FAMILY_MIN
protected static final int OPERATION_FAMILY_ADDDOCUMENT
protected static final int OPERATION_FAMILY_DELETEDOCUMENT
protected static final int OPERATION_FAMILY_UPDATEDOCUMENT
protected static final int OPERATION_FAMILY_UPDATEDOCUMENTMETAS
protected static final int OPERATION_FAMILY_MAX
public TracePushAPI(PushAPI source, long logOperationsFrequency)
source
- The parent PushAPIlogOperationsFrequency
- Number of operations before adding a log entrypublic TracePushAPI(PushAPI source)
source
- The parent PushAPIprotected void clear()
public static PushAPI createPushAPIPlugin(PushAPI papi, java.lang.String[] keys, java.lang.String[] values) throws java.lang.Exception
papi
- upstream PushAPIkeys
- configuration keys (see below)keys
- configuration valuesjava.lang.Exception
protected java.lang.String getOperationName(int op)
protected java.lang.String getFamilyOperationName(int op)
protected static long getCurrentThreadCpuTime()
protected void startOperations()
protected void endOperations()
protected static java.lang.String nsToString(long ns)
protected static java.lang.String formatK(long i)
protected static java.lang.String bytesToString(long bytes)
protected void endOperation(int operation, long start)
protected PushAPIException catchOperation(int operation, java.lang.Exception e)
protected void incOperationFamily(int fop, int count)
protected void incBytes(long size)
protected void incOperationFamily(int fop)
protected void finalize() throws java.io.IOException
finalize
in class java.lang.Object
java.io.IOException
protected static long documentSize(Document document)
public void addDocument(Document document) throws PushAPIException
PushAPI
addDocument
in class PipedPushAPI
document
- Document to be added.PushAPIException
- upon errorpublic void addDocumentList(Document[] documents) throws PushAPIException
PushAPI
addDocumentList
in class PipedPushAPI
documents
- Documents to be added.PushAPIException
- upon error.public boolean areDocumentsSearchable(java.math.BigInteger serial) throws PushAPIException
PushAPI
areDocumentsSearchable
in class PipedPushAPI
serial
- the serial returned by a setCheckpoint operationPushAPIException
- upon errorpublic void clearAllCheckpoints() throws PushAPIException
PushAPI
clearAllCheckpoints
in class PipedPushAPI
PushAPIException
- upon errorpublic long countSyncedEntries(java.lang.String rootPath, EnumerationMode mode) throws PushAPIException
PushAPI
countSyncedEntries
in class PipedPushAPI
rootPath
- URI prefix used to select a subset of the corpus. Empty string can
be used to delete the whole collection. The character '/' is used
to build a hierarchical view of your corpus.mode
- the enumeration mode.PushAPIException
- upon error.public void deleteDocument(java.lang.String uri) throws PushAPIException
PushAPI
deleteDocument
in class PipedPushAPI
uri
- the URI of the document to deletePushAPIException
- upon errorpublic void deleteDocumentList(java.lang.String[] uris) throws PushAPIException
PushAPI
deleteDocumentList
in class PipedPushAPI
uris
- the list of URIs of the documents to deletePushAPIException
- upon errorpublic void deleteDocumentList(int[] did, int[] slices) throws PushAPIException
PushAPI
deleteDocumentList
in class PipedPushAPI
slices
- the list of slices to delete.PushAPIException
public void deleteDocumentRootPath(java.lang.String rootPath, boolean recursive, boolean clearCache) throws PushAPIException
PushAPI
rootPath
prefix will be deleted.deleteDocumentRootPath
in class PipedPushAPI
rootPath
- a URI prefix used to select the documents to be deleted."A"
would select all URIs in the form
"A/xyz"
"A/B"
would select all URIs in the form
"A/B/xyz"
recursive
- The recursive flag indicates if the URI pattern specified in
rootPath should match multiple depth levels in the URI tree. For
example the rootPath "A/B"
will always match "A/B/C"
, but will match "A/B/C/D"
only if recursive
is true
. In CloudView 5.1 recursive is always
true.clearCache
- The clearCache flag indicates if we want to delete documents
from the document cache when they are deleted from the index.PushAPIException
public void deleteDocumentsWithPrefix(java.lang.String prefix, boolean clearCache) throws PushAPIException
PushAPI
prefix
will be deleted.deleteDocumentsWithPrefix
in class PipedPushAPI
prefix
- a URI prefix used to select the documents to be deleted.clearCache
- The clearCache flag indicates if we want to delete documents
from the document cache when they are deleted from the index.PushAPIException
public java.lang.Iterable<CheckpointInfo> enumerateCheckpointInfo() throws PushAPIException
PushAPI
enumerateCheckpointInfo
in class PipedPushAPI
PushAPIException
- upon errorPushAPI.setCheckpoint(String, String, boolean)
,
PushAPI.synchronize()
public java.lang.Iterable<CheckpointInfo> enumerateCheckpointInfo(boolean showSynchronizedOnly) throws PushAPIException
PushAPI
enumerateCheckpointInfo
in class PipedPushAPI
showSynchronizedOnly
- if true, then returns synchronized (i.e safe) checkpoints,
otherwise returns the unsynchronized checkpoints (in memory only)
when more recent than the synchronized ones.PushAPIException
- upon errorPushAPI.setCheckpoint(String, String, boolean)
,
PushAPI.synchronize()
public java.lang.Iterable<SyncedEntry> enumerateSyncedEntries(java.lang.String rootPath, EnumerationMode mode) throws PushAPIException
PushAPI
enumerateSyncedEntries
in class PipedPushAPI
rootPath
- URI prefix used to select a subset of the corpus. Empty string can
be used to enumerate the whole collection. The character '/' is used
to build a hierarchical view of your corpus.mode
- the enumeration mode.PushAPIException
- upon error#sync()}
public java.lang.String getCheckpoint(java.lang.String name) throws PushAPIException
PushAPI
getCheckpoint
in class PipedPushAPI
name
- the name of the checkpointPushAPIException
- upon errorPushAPI.setCheckpoint(String, String, boolean)
public CheckpointInfo getCheckpoint(java.lang.String name, boolean showSynchronizedOnly) throws PushAPIException
PushAPI
getCheckpoint
in class PipedPushAPI
name
- the name of the checkpoint to retrieve.showSynchronizedOnly
- if true, then returns the last synchronized (i.e safe) checkpoint,
otherwise returns the unsynchronized checkpoint (in memory only)
when more recent than the last synchronized one.CheckpointInfo.value
is empty, then it means the checkpoint is not defined.PushAPIException
PushAPI.setCheckpoint(String, String, boolean)
public java.lang.String getConnectorName()
PushAPI
getConnectorName
in class PipedPushAPI
public DocumentStatus getDocumentStatus(java.lang.String uri) throws PushAPIException
PushAPI
areDocumentsSearchable
method.getDocumentStatus
in class PipedPushAPI
uri
- the URI to be looked up.getDocumentStatus
method always returns a non-null
DocumentStatus
object. To check if
the document actually exists in the index, please use the
DocumentStatus.isExist()
method.PushAPIException
DocumentStatus
public DocumentStatus[] getDocumentStatusList(java.lang.String[] uris) throws PushAPIException
PushAPI
getDocumentStatusList
in class PipedPushAPI
uris
- the URIs of the documents for which the status should be retrieved.PushAPIException
- upon errorpublic void ping() throws PushAPIException
PushAPI
ping
in class PipedPushAPI
PushAPIException
- upon error (invalid connector name or IO error)public java.math.BigInteger setCheckpoint(java.lang.String value, java.lang.String name, boolean sync) throws PushAPIException
PushAPI
PushAPI.areDocumentsSearchable(BigInteger)
for more information.setCheckpoint
in class PipedPushAPI
value
- the value of the checkpoint.name
- the name of the checkpoint.sync
- if all the pending operations in the task log should be
synchronized to disk before returning.PushAPIException
- upon errorPushAPI.synchronize()
,
PushAPI.areDocumentsSearchable(BigInteger)
public void startPushSession() throws PushAPIException
PushAPI
stopPushSession
),
if the push server restarts for any reason, an exception will be thrown.
The connector should then engage a recovery procedure.startPushSession
in class PipedPushAPI
PushAPISessionExistsException
- if the session is already started.PushAPIException
- if any another error occurred.public void stopPushSession(boolean releaseConnections) throws PushAPIException
PushAPI
stopPushSession
in class PipedPushAPI
PushAPISessionNotFoundException
- if session is not started.PushAPIException
- if another error occurred.startPushSession}
public void sync() throws PushAPIException
synchronize()
PushAPI
PushAPI.synchronize()
has been introduced and returns a serial.sync
in class PipedPushAPI
PushAPIException
- upon errorpublic java.math.BigInteger synchronize() throws PushAPIException
PushAPI
synchronize
in class PipedPushAPI
PushAPIException
- upon errorpublic void triggerIndexingJob() throws PushAPIException
PushAPI
triggerIndexingJob
in class PipedPushAPI
PushAPIException
- upon errorpublic void triggerIndexingJobWhenIdle() throws PushAPIException
PushAPI
triggerIndexingJobWhenIdle
in class PipedPushAPI
PushAPIException
- upon errorpublic void updateDocument(Document doc, java.lang.String[] fields) throws PushAPIException
PushAPI
updateDocument
in class PipedPushAPI
doc
- a Document object specifying the URI of the document to be
updated. Parts and metas that are not updated with the document
are fetched from the document cache, so the document cache
*must* be enabled, and only documents added after the document cache
has been enabled can be updated. Old values of multivalued metas will be dropped,
if you want to update a multivalued meta you have to put new values and
also the old values you want to keep in the document.fields
- Not used for the moment.PushAPIException
public void updateDocumentList(Document[] docList, java.lang.String[][] fieldsList) throws PushAPIException
PushAPI
updateDocumentList
in class PipedPushAPI
docList
- the list of documents to updatefieldsList
- for each document, the fields to be updatedPushAPIException
- upon errorPushAPI.updateDocument(Document, String[])
public void updateDocumentMetas(java.lang.String uri, java.lang.String stamp, MetaContainer metaContainer) throws PushAPIException
PushAPI
PushAPI.updateDocument(Document, String[])
which
automatically creates the list of index fields from the meta names found in
the meta data container.PushAPI.updateDocument(Document, String[])
, this gives:
MetaContainer cont = new MetaContainer();
cont.addMeta("organization", "myneworg");
papi.updateDocument("mydocument", null, cont);
If the document does not exist yet, an error is returned by the push
server.updateDocumentMetas
in class PipedPushAPI
uri
- the URI of the document to updatestamp
- the new document stampmetaContainer
- the container of meta to be updatedPushAPIException
- upon errorpublic void updateDocumentMetasList(java.lang.String[] uriList, java.lang.String[] stampList, MetaContainer[] metaContainerList) throws PushAPIException
PushAPI
PushAPI.updateDocument(Document, String[])
which
automatically creates the list of index fields from the meta names found in
the meta data container.updateDocumentMetasList
in class PipedPushAPI
uriList
- the URIs of the documents to updatestampList
- the list of new stampsmetaContainerList
- the list of meta data containersPushAPIException
- upon errorPushAPI.updateDocumentMetas(java.lang.String, java.lang.String, com.exalead.papi.helper.MetaContainer)
protected void testDocuments(Document... docs) throws TraceException
docs
- documents to testTraceException
- if a test failedprotected void testDocuments(java.lang.String[] uriList, java.lang.String[] stampList, MetaContainer[] metaContainerList) throws TraceException
uriList
- list of urisstampList
- list of stampsmetaContainerList
- list of metasTraceException
- if a test failedprotected void testDocument(Document doc) throws TraceException
doc
- document to testTraceException
- if a test failedprotected void testDocument(java.lang.String uri, java.lang.String stamp, MetaContainer metas) throws TraceException
doc
- document to testTraceException
- if a test failedprotected void testMandatoryStamp(Document doc) throws TraceException
doc
- document to testTraceException
- if the test failsprotected void testNullURI(Document doc) throws TraceException
doc
- document to testTraceException
- if the test failsprotected void testUniqueStreams(Document doc) throws TraceException
doc
- document to testTraceException
- if the test failsprotected void testNullMetas(MetaContainer metaContainer) throws TraceException
doc
- document to testTraceException
- if the test failsCopyright © 2021 Dassault Systèmes, All Rights Reserved.