Manages a batched document upload/write operation.
More...
#include <DocumentBatchWriter.hpp>
Manages a batched document upload/write operation.
- Since
- 8.0.2
MLCLIENT_API mlclient::utilities::DocumentBatchWriter::DocumentBatchWriter |
( |
IConnection * |
conn | ) |
|
Constructs a DocumentBatchWriter that wraps the provided IConnection instance.
- Since
- 8.0.2
- Parameters
-
conn | The pointer to an IConnection subclass instance. In, but not OWNS. (This class never delete's this pointer) |
MLCLIENT_API void mlclient::utilities::DocumentBatchWriter::addBatchListener |
( |
IBatchNotifiable * |
notifiable | ) |
|
Adds a listener for batch events.
- Parameters
-
MLCLIENT_API void mlclient::utilities::DocumentBatchWriter::assignDocuments |
( |
DocumentSet && |
set | ) |
|
Assigns a set of documents ready for upload.
- Note
- These can hold FileDocumentContent instances, and thus are only loaded during batch request creation (efficient)
- Since
- 8.0.2
- Parameters
-
set | The DocumentSet to upload to MarkLogic |
MLCLIENT_API const int mlclient::utilities::DocumentBatchWriter::getBatchSize |
( |
| ) |
const |
Returns the number of documents sent per batch.
- Returns
- Documents per batch
MLCLIENT_API const TransactionMode mlclient::utilities::DocumentBatchWriter::getMode |
( |
| ) |
const |
Returns the transaction mode used.
- Returns
- The TransactionMode in use
MLCLIENT_API const int mlclient::utilities::DocumentBatchWriter::getParallelTasks |
( |
| ) |
const |
Returns the number of parallel tasks being used.
- Returns
- The number of parallel tasks
MLCLIENT_API const Progress mlclient::utilities::DocumentBatchWriter::getProgress |
( |
| ) |
const |
Returns the current progress data for this class.
- Note
- This is currently an Overall progress, not for the last X seconds.
- Returns
- The current Progress of the batch upload.
MLCLIENT_API const bool mlclient::utilities::DocumentBatchWriter::isCancelled |
( |
| ) |
const |
Has this class been cancelled?
- Returns
- A boolean as to whether we were cancelled (true) or not
MLCLIENT_API const bool mlclient::utilities::DocumentBatchWriter::isComplete |
( |
| ) |
const |
Has this class ran to completion?
- Returns
- A boolean as to whether we ran to completion (true) or not
MLCLIENT_API const bool mlclient::utilities::DocumentBatchWriter::isFinished |
( |
| ) |
const |
Are all asynchronous operations completed?
- Note
- This class can still be working after stop() has been called. E.g. if a batch upload request is in progress
- Returns
- A boolean as to whether this class is now finished
MLCLIENT_API void mlclient::utilities::DocumentBatchWriter::removeBatchListener |
( |
IBatchNotifiable * |
notifiable | ) |
|
Removes a listener for batch events.
- Parameters
-
MLCLIENT_API void mlclient::utilities::DocumentBatchWriter::send |
( |
| ) |
|
Begins the batch operation.
- Note
- This is where the underlying tasks are created and allocated to threads
MLCLIENT_API void mlclient::utilities::DocumentBatchWriter::setBatchParameters |
( |
const int |
parallelTasks, |
|
|
const int |
batchSize, |
|
|
const TransactionMode & |
mode |
|
) |
| |
Sets the parameters for this batch.
- Note
- Defaults to 5 parallel tasks, each holding 10 documents, with mode of PER_BATCH transactions.
-
parallelTasks performs a lot of work before the (thin) call to perform a REST request. Each Connection instance only ever executes one REST request at a time - never in parallel - so be aware of that when loading content. This restriction may be removed in future versions.
- Since
- 8.0.2
- Parameters
-
parallelTasks | The number of paralleltasks to use |
batchSize | The number of documents to submit in each batch (also submits their metadata) |
mode | The batch mode to use |
MLCLIENT_API void mlclient::utilities::DocumentBatchWriter::stop |
( |
| ) |
|
Cancels the batch operation.
- Note
- Some tasks may be in flight still when this is called. They still run to completion.
MLCLIENT_API void mlclient::utilities::DocumentBatchWriter::wait |
( |
| ) |
const |
Causes the calling thread to wait for the completion of all batches assigned to all parallel tasks.
Useful for simple synchronous batch updates
The documentation for this class was generated from the following file: