/** Allocates internal skip buffers. */ protected void init() { skipBuffer = new RAMOutputStream[numberOfSkipLevels]; for (int i = 0; i < numberOfSkipLevels; i++) { skipBuffer[i] = new RAMOutputStream(); } }
@Override public IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws IOException { ensureOpen(); // Make the file first... RAMFile file = newRAMFile(); // ... then try to find a unique name for it: while (true) { String name = IndexFileNames.segmentFileName(prefix, suffix + "_" + Long.toString(nextTempFileCounter.getAndIncrement(), Character.MAX_RADIX), "tmp"); if (fileMap.putIfAbsent(name, file) == null) { return new RAMOutputStream(name, file, true); } } }
RAMOutputStream writeBuffer = new RAMOutputStream();
@Override public IndexOutput createOutput(String name, IOContext context) throws IOException { ensureOpen(); RAMFile file = newRAMFile(); if (fileMap.putIfAbsent(name, file) != null) { throw new FileAlreadyExistsException(name); } return new RAMOutputStream(name, file, true); }
try (RAMOutputStream out = new RAMOutputStream()) { String lastTermField = null; String lastUpdateField = null;
RAMOutputStream ros = new RAMOutputStream(); outputs.writeFinalOutput(emptyOutput, ros);
meta.writeInt(Lucene70DocValuesFormat.TERMS_DICT_BLOCK_SHIFT); RAMOutputStream addressBuffer = new RAMOutputStream(); meta.writeInt(DIRECT_MONOTONIC_BLOCK_SHIFT); long numBlocks = (size + Lucene70DocValuesFormat.TERMS_DICT_BLOCK_MASK) >>> Lucene70DocValuesFormat.TERMS_DICT_BLOCK_SHIFT;
sorter = new DocOffsetSorter(maxDoc); final IndexOutput out = new RAMOutputStream(file, false); int doc; int i = 0;
RAMOutputStream addressBuffer = new RAMOutputStream(); DirectMonotonicWriter writer = DirectMonotonicWriter.getInstance(meta, addressBuffer, numBlocks, DIRECT_MONOTONIC_BLOCK_SHIFT);
protected void init() { skipBuffer = new RAMOutputStream[numberOfSkipLevels]; for (int i = 0; i < numberOfSkipLevels; i++) { skipBuffer[i] = new RAMOutputStream(); } }
/** Allocates internal skip buffers. */ protected void init() { skipBuffer = new RAMOutputStream[numberOfSkipLevels]; for (int i = 0; i < numberOfSkipLevels; i++) { skipBuffer[i] = new RAMOutputStream(); } }
protected void init() { skipBuffer = new RAMOutputStream[numberOfSkipLevels]; for (int i = 0; i < numberOfSkipLevels; i++) { skipBuffer[i] = new RAMOutputStream(); } }
/** Allocates internal skip buffers. */ protected void init() { skipBuffer = new RAMOutputStream[numberOfSkipLevels]; for (int i = 0; i < numberOfSkipLevels; i++) { skipBuffer[i] = new RAMOutputStream(); } }
/** Allocates internal skip buffers. */ protected void init() { skipBuffer = new RAMOutputStream[numberOfSkipLevels]; for (int i = 0; i < numberOfSkipLevels; i++) { skipBuffer[i] = new RAMOutputStream(); } }
static String buildScrollId(AtomicArray<? extends SearchPhaseResult> searchPhaseResults) throws IOException { try (RAMOutputStream out = new RAMOutputStream()) { out.writeString(searchPhaseResults.length() == 1 ? ParsedScrollId.QUERY_AND_FETCH_TYPE : ParsedScrollId.QUERY_THEN_FETCH_TYPE); out.writeVInt(searchPhaseResults.asList().size()); for (SearchPhaseResult searchPhaseResult : searchPhaseResults.asList()) { out.writeLong(searchPhaseResult.getRequestId()); SearchShardTarget searchShardTarget = searchPhaseResult.getSearchShardTarget(); if (searchShardTarget.getClusterAlias() != null) { out.writeString(RemoteClusterAware.buildRemoteIndexName(searchShardTarget.getClusterAlias(), searchShardTarget.getNodeId())); } else { out.writeString(searchShardTarget.getNodeId()); } } byte[] bytes = new byte[(int) out.getFilePointer()]; out.writeTo(bytes, 0); return Base64.getUrlEncoder().encodeToString(bytes); } }
/** Creates a new, empty file in the directory with the given name. Returns a stream writing this file. */ public final OutputStream createFile(String name) { RAMFile file = new RAMFile(); files.put(name, file); return new RAMOutputStream(file); }
/** Creates a new, empty file in the directory with the given name. Returns a stream writing this file. */ @Override public IndexOutput createOutput(String name, IOContext context) throws IOException { ensureOpen(); RAMFile file = newRAMFile(); RAMFile existing = fileMap.remove(name); if (existing != null) { sizeInBytes.addAndGet(-existing.sizeInBytes); existing.directory = null; } fileMap.put(name, file); return new RAMOutputStream(name, file, true); }
@Override public IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws IOException { ensureOpen(); // Make the file first... RAMFile file = newRAMFile(); // ... then try to find a unique name for it: while (true) { String name = IndexFileNames.segmentFileName(prefix, suffix + "_" + Long.toString(nextTempFileCounter.getAndIncrement(), Character.MAX_RADIX), "tmp"); if (fileMap.putIfAbsent(name, file) == null) { return new RAMOutputStream(name, file, true); } } }
@Override public IndexOutput createOutput(String name, IOContext context) throws IOException { ensureOpen(); RAMFile file = newRAMFile(); if (fileMap.putIfAbsent(name, file) != null) { throw new FileAlreadyExistsException(name); } return new RAMOutputStream(name, file, true); }
static String buildScrollId(AtomicArray<? extends SearchPhaseResult> searchPhaseResults) throws IOException { try (RAMOutputStream out = new RAMOutputStream()) { out.writeString(searchPhaseResults.length() == 1 ? ParsedScrollId.QUERY_AND_FETCH_TYPE : ParsedScrollId.QUERY_THEN_FETCH_TYPE); out.writeVInt(searchPhaseResults.asList().size()); for (SearchPhaseResult searchPhaseResult : searchPhaseResults.asList()) { out.writeLong(searchPhaseResult.getRequestId()); out.writeString(searchPhaseResult.getSearchShardTarget().getNodeId()); } byte[] bytes = new byte[(int) out.getFilePointer()]; out.writeTo(bytes, 0); return Base64.getUrlEncoder().encodeToString(bytes); } }