use of com.carrotsearch.hppc.cursors.IntCursor in project crate by crate.
the class NodeFetchRequest method writeTo.
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeLong(jobId.getMostSignificantBits());
out.writeLong(jobId.getLeastSignificantBits());
out.writeVInt(fetchPhaseId);
out.writeBoolean(closeContext);
if (toFetch == null) {
out.writeVInt(0);
} else {
out.writeVInt(toFetch.size());
for (IntObjectCursor<? extends IntContainer> toFetchCursor : toFetch) {
out.writeVInt(toFetchCursor.key);
out.writeVInt(toFetchCursor.value.size());
for (IntCursor docCursor : toFetchCursor.value) {
out.writeInt(docCursor.value);
}
}
}
}
use of com.carrotsearch.hppc.cursors.IntCursor in project crate by crate.
the class ContextPreparer method prepareOnRemote.
public List<CompletableFuture<Bucket>> prepareOnRemote(Iterable<? extends NodeOperation> nodeOperations, JobExecutionContext.Builder contextBuilder, SharedShardContexts sharedShardContexts) {
ContextPreparer.PreparerContext preparerContext = new PreparerContext(clusterService.localNode().getId(), contextBuilder, logger, distributingDownstreamFactory, nodeOperations, sharedShardContexts);
registerContextPhases(nodeOperations, preparerContext);
logger.trace("prepareOnRemote: nodeOperations={}, targetSourceMap={}", nodeOperations, preparerContext.opCtx.targetToSourceMap);
for (IntCursor cursor : preparerContext.opCtx.findLeafs()) {
prepareSourceOperations(cursor.value, preparerContext);
}
assert preparerContext.opCtx.allNodeOperationContextsBuilt() : "some nodeOperations haven't been processed";
return preparerContext.directResponseFutures;
}
use of com.carrotsearch.hppc.cursors.IntCursor in project crate by crate.
the class ContextPreparer method prepareOnHandler.
public List<CompletableFuture<Bucket>> prepareOnHandler(Iterable<? extends NodeOperation> nodeOperations, JobExecutionContext.Builder contextBuilder, List<Tuple<ExecutionPhase, BatchConsumer>> handlerPhases, SharedShardContexts sharedShardContexts) {
ContextPreparer.PreparerContext preparerContext = new PreparerContext(clusterService.localNode().getId(), contextBuilder, logger, distributingDownstreamFactory, nodeOperations, sharedShardContexts);
for (Tuple<ExecutionPhase, BatchConsumer> handlerPhase : handlerPhases) {
preparerContext.registerLeaf(handlerPhase.v1(), handlerPhase.v2());
}
registerContextPhases(nodeOperations, preparerContext);
logger.trace("prepareOnHandler: nodeOperations={}, handlerPhases={}, targetSourceMap={}", nodeOperations, handlerPhases, preparerContext.opCtx.targetToSourceMap);
IntHashSet leafs = new IntHashSet();
for (Tuple<ExecutionPhase, BatchConsumer> handlerPhase : handlerPhases) {
ExecutionPhase phase = handlerPhase.v1();
createContexts(phase, preparerContext);
leafs.add(phase.phaseId());
}
leafs.addAll(preparerContext.opCtx.findLeafs());
for (IntCursor cursor : leafs) {
prepareSourceOperations(cursor.value, preparerContext);
}
assert preparerContext.opCtx.allNodeOperationContextsBuilt() : "some nodeOperations haven't been processed";
return preparerContext.directResponseFutures;
}
use of com.carrotsearch.hppc.cursors.IntCursor in project crate by crate.
the class JobExecutionContext method start.
public void start() throws Throwable {
for (IntCursor id : orderedContextIds) {
ExecutionSubContext subContext = subContexts.get(id.value);
if (subContext == null || closed.get()) {
// got killed before start was called
break;
}
subContext.start();
}
if (failure != null) {
throw failure;
}
}
use of com.carrotsearch.hppc.cursors.IntCursor in project crate by crate.
the class FetchProjectorContext method nodeIdsToStreamers.
public Map<String, ? extends IntObjectMap<Streamer[]>> nodeIdsToStreamers() {
if (nodeIdToReaderIdToStreamers == null) {
nodeIdToReaderIdToStreamers = new HashMap<>(nodeToReaderIds.size(), 1.0f);
for (Map.Entry<String, IntSet> entry : nodeToReaderIds.entrySet()) {
IntObjectHashMap<Streamer[]> readerIdsToStreamers = new IntObjectHashMap<>();
nodeIdToReaderIdToStreamers.put(entry.getKey(), readerIdsToStreamers);
for (IntCursor readerIdCursor : entry.getValue()) {
FetchSource fetchSource = getFetchSource(readerIdCursor.value);
if (fetchSource == null) {
continue;
}
readerIdsToStreamers.put(readerIdCursor.value, Symbols.streamerArray(fetchSource.references()));
}
}
}
return nodeIdToReaderIdToStreamers;
}
Aggregations