private void setBufferToCurrentChunk() throws IOException { ChunkCacheKey key = new ChunkCacheKey(fileKey.getIndexName(), filename, currentLoadedChunk, chunkSize, affinitySegmentId); buffer = (byte[]) chunksCache.get(key); if (buffer == null) { throw new IOException("Read past EOF: Chunk value could not be found for key " + key); } currentBufferSize = buffer.length; }
private void setBufferToCurrentChunk() throws IOException { ChunkCacheKey key = new ChunkCacheKey(fileKey.getIndexName(), filename, currentLoadedChunk, chunkSize); buffer = (byte[]) chunksCache.get(key); if (buffer == null) { throw new IOException("Read past EOF: Chunk value could not be found for key " + key); } currentBufferSize = buffer.length; }
private void setBufferToCurrentChunk() throws IOException { ChunkCacheKey key = new ChunkCacheKey(fileKey.getIndexName(), filename, currentLoadedChunk, chunkSize, affinitySegmentId); buffer = (byte[]) chunksCache.get(key); if (buffer == null) { throw new IOException("Read past EOF: Chunk value could not be found for key " + key); } currentBufferSize = buffer.length; }
@Override public void close() { currentBufferSize = 0; bufferPosition = 0; currentLoadedChunk = -1; buffer = null; if (isClone) return; readLocks.deleteOrReleaseReadLock(filename); if (trace) { log.tracef("Closed IndexInput for file:%s in index: %s", filename, fileKey.getIndexName()); } }
private void setBufferToCurrentChunkIfPossible() { ChunkCacheKey key = new ChunkCacheKey(fileKey.getIndexName(), filename, currentLoadedChunk, chunkSize); buffer = (byte[]) chunksCache.get(key); if (buffer == null) { currentLoadedChunk--; bufferPosition = chunkSize; } else { currentBufferSize = buffer.length; } }
@Override public void close() { currentBufferSize = 0; bufferPosition = 0; currentLoadedChunk = -1; buffer = null; if (isClone) return; readLocks.deleteOrReleaseReadLock(filename); if (trace) { log.tracef("Closed IndexInput for file:%s in index: %s", filename, fileKey.getIndexName()); } }
@Override public void close() { currentBufferSize = 0; bufferPosition = 0; currentLoadedChunk = -1; buffer = null; if (isClone) return; readLocks.deleteOrReleaseReadLock(filename); if (trace) { log.tracef("Closed IndexInput for file:%s in index: %s", filename, fileKey.getIndexName()); } }
private void setBufferToCurrentChunkIfPossible() { ChunkCacheKey key = new ChunkCacheKey(fileKey.getIndexName(), filename, currentLoadedChunk, chunkSize, affinitySegmentId); buffer = (byte[]) chunksCache.get(key); if (buffer == null) { currentLoadedChunk--; bufferPosition = chunkSize; } else { currentBufferSize = buffer.length; } }
private void setBufferToCurrentChunkIfPossible() { ChunkCacheKey key = new ChunkCacheKey(fileKey.getIndexName(), filename, currentLoadedChunk, chunkSize, affinitySegmentId); buffer = (byte[]) chunksCache.get(key); if (buffer == null) { currentLoadedChunk--; bufferPosition = chunkSize; } else { currentBufferSize = buffer.length; } }
/** * @param bufferToFlush * @param chunkNumber */ private void storeBufferAsChunk(final byte[] bufferToFlush, final int chunkNumber) { ChunkCacheKey key = new ChunkCacheKey(fileKey.getIndexName(), fileKey.getFileName(), chunkNumber, bufferSize, affinitySegmentId); if (trace) log.tracef("Storing segment chunk: %s", key); chunksCacheForStorage.put(key, bufferToFlush); }
/** * @param bufferToFlush * @param chunkNumber */ private void storeBufferAsChunk(final byte[] bufferToFlush, final int chunkNumber) { ChunkCacheKey key = new ChunkCacheKey(fileKey.getIndexName(), fileKey.getFileName(), chunkNumber, bufferSize, affinitySegmentId); if (trace) log.tracef("Storing segment chunk: %s", key); chunksCacheForStorage.put(key, bufferToFlush); }
/** * @param bufferToFlush * @param chunkNumber */ private void storeBufferAsChunk(final byte[] bufferToFlush, final int chunkNumber) { ChunkCacheKey key = new ChunkCacheKey(fileKey.getIndexName(), fileKey.getFileName(), chunkNumber, bufferSize); if (trace) log.tracef("Storing segment chunk: %s", key); chunksCacheForStorage.put(key, bufferToFlush); }
public InfinispanIndexOutput(final AdvancedCache<FileCacheKey, FileMetadata> metadataCache, final AdvancedCache<ChunkCacheKey, Object> chunksCache, final FileCacheKey fileKey, final int bufferSize, final FileListOperations fileList,final int affinitySegmentId) { super("InfinispanIndexOutput{metadataCache=" + metadataCache + ", chunksCache=" + chunksCache + ", fileKey=" + fileKey + ", bufferSize=" + bufferSize + '}'); this.metadataCache = metadataCache; this.chunksCache = chunksCache; this.affinitySegmentId = affinitySegmentId; this.chunksCacheForStorage = chunksCache.withFlags(Flag.IGNORE_RETURN_VALUES); this.fileKey = fileKey; this.bufferSize = bufferSize; this.fileOps = fileList; this.buffer = new byte[this.bufferSize]; this.firstChunkBuffer = buffer; this.file = new FileMetadata(bufferSize); if (trace) { log.tracef("Opened new IndexOutput for file:%s in index: %s", fileKey.getFileName(), fileKey.getIndexName()); } }
public InfinispanIndexOutput(final AdvancedCache<FileCacheKey, FileMetadata> metadataCache, final AdvancedCache<ChunkCacheKey, Object> chunksCache, final FileCacheKey fileKey, final int bufferSize, final FileListOperations fileList) { this.metadataCache = metadataCache; this.chunksCache = chunksCache; this.chunksCacheForStorage = chunksCache.withFlags(Flag.IGNORE_RETURN_VALUES); this.fileKey = fileKey; this.bufferSize = bufferSize; this.fileOps = fileList; this.buffer = new byte[this.bufferSize]; this.firstChunkBuffer = buffer; this.file = new FileMetadata(bufferSize); if (trace) { log.tracef("Opened new IndexOutput for file:%s in index: %s", fileKey.getFileName(), fileKey.getIndexName()); } }
public InfinispanIndexInput(final IndexInputContext ctx) { super(ctx.fileKey.getFileName()); this.chunksCache = ctx.chunksCache; this.fileKey = ctx.fileKey; this.chunkSize = ctx.fileMetadata.getBufferSize(); this.fileLength = ctx.fileMetadata.getSize(); this.readLocks = ctx.readLocks; this.filename = fileKey.getFileName(); if (trace) { log.tracef("Opened new IndexInput for file:%s in index: %s", filename, fileKey.getIndexName()); } }
public SingleChunkIndexInput(final IndexInputContext iic) { super(iic.fileKey.getFileName()); ChunkCacheKey key = new ChunkCacheKey(iic.fileKey.getIndexName(), iic.fileKey.getFileName(), 0, iic.fileMetadata.getBufferSize(), iic.affinitySegmentId); byte[] b = (byte[]) iic.chunksCache.get(key); if (b == null) { buffer = Util.EMPTY_BYTE_ARRAY; } else { buffer = b; } bufferPosition = 0; }
public SingleChunkIndexInput(final IndexInputContext iic) { super(iic.fileKey.getFileName()); ChunkCacheKey key = new ChunkCacheKey(iic.fileKey.getIndexName(), iic.fileKey.getFileName(), 0, iic.fileMetadata.getBufferSize()); byte[] b = (byte[]) iic.chunksCache.get(key); if (b == null) { buffer = new byte[0]; } else { buffer = b; } bufferPosition = 0; }
public SingleChunkIndexInput(final IndexInputContext iic) { super(iic.fileKey.getFileName()); ChunkCacheKey key = new ChunkCacheKey(iic.fileKey.getIndexName(), iic.fileKey.getFileName(), 0, iic.fileMetadata.getBufferSize(), iic.affinitySegmentId); byte[] b = (byte[]) iic.chunksCache.get(key); if (b == null) { buffer = new byte[0]; } else { buffer = b; } bufferPosition = 0; }
public InfinispanIndexInput(final IndexInputContext ctx) { super(ctx.fileKey.getFileName()); this.chunksCache = ctx.chunksCache; this.fileKey = ctx.fileKey; this.chunkSize = ctx.fileMetadata.getBufferSize(); this.fileLength = ctx.fileMetadata.getSize(); this.readLocks = ctx.readLocks; this.affinitySegmentId = ctx.affinitySegmentId; this.filename = fileKey.getFileName(); if (trace) { log.tracef("Opened new IndexInput for file:%s in index: %s", filename, fileKey.getIndexName()); } }
public InfinispanIndexInput(final IndexInputContext ctx) { super(ctx.fileKey.getFileName()); this.chunksCache = ctx.chunksCache; this.fileKey = ctx.fileKey; this.chunkSize = ctx.fileMetadata.getBufferSize(); this.fileLength = ctx.fileMetadata.getSize(); this.readLocks = ctx.readLocks; this.affinitySegmentId = ctx.affinitySegmentId; this.filename = fileKey.getFileName(); if (trace) { log.tracef("Opened new IndexInput for file:%s in index: %s", filename, fileKey.getIndexName()); } }