return new InfinispanIndexOutput(metadataCache, chunksCache, key, chunkSize, fileOps);
}
IndexInputContext openInput(final String name) throws IOException {
final FileCacheKey fileKey = new FileCacheKey(indexName, name);
final FileMetadata fileMetadata = metadataCache.get(fileKey);
if (fileMetadata == null) {
throw new FileNotFoundException("Error loading metadata for index file: " + fileKey);
}
else if (fileMetadata.getSize() <= fileMetadata.getBufferSize()) {
//files smaller than chunkSize don't need a readLock
return new IndexInputContext(chunksCache, fileKey, fileMetadata, null);
}
else {
boolean locked = readLocks.acquireReadLock(name);