Skip to content

Commit

Permalink
simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
original-brownbear committed Jul 26, 2023
1 parent a4aa4c2 commit dbb0e21
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.blobcache.BlobCacheUtils;
import org.elasticsearch.blobcache.common.ByteRange;
import org.elasticsearch.common.blobstore.BlobContainer;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.Channels;
import org.elasticsearch.core.Releasable;
Expand Down Expand Up @@ -94,7 +93,6 @@ public abstract class MetadataCachingIndexInput extends BufferedIndexInput {

private final Logger logger;
private final boolean isCfs;
private final BlobContainer blobContainer;
protected final BlobStoreIndexShardSnapshot.FileInfo fileInfo;
protected final IOContext context;
protected final IndexInputStats stats;
Expand Down Expand Up @@ -124,7 +122,6 @@ protected MetadataCachingIndexInput(
super(name, context);
this.isCfs = IndexFileNames.matchesExtension(name, "cfs");
this.logger = Objects.requireNonNull(logger);
this.blobContainer = Objects.requireNonNull(directory.blobContainer());
this.fileInfo = Objects.requireNonNull(fileInfo);
this.context = Objects.requireNonNull(context);
assert fileInfo.metadata().hashEqualsContents() == false
Expand Down Expand Up @@ -460,7 +457,7 @@ protected InputStream openInputStreamFromBlobStore(final long position, final lo
assert position + readLength <= fileInfo.length()
: "cannot read [" + position + "-" + (position + readLength) + "] from [" + fileInfo + "]";
stats.addBlobStoreBytesRequested(readLength);
return blobContainer.readBlob(fileInfo.name(), position, readLength);
return directory.blobContainer().readBlob(fileInfo.name(), position, readLength);
} else {
final int startPart = getPartNumberForPosition(position);
final int endPart = getPartNumberForPosition(position + readLength - 1);
Expand All @@ -483,7 +480,7 @@ protected InputStream openSlice(int slice) throws IOException {
endInPart = currentPart == endPart
? getRelativePositionInPart(position + readLength - 1) + 1
: fileInfo.partBytes(currentPart);
return blobContainer.readBlob(fileInfo.partName(currentPart), startInPart, endInPart - startInPart);
return directory.blobContainer().readBlob(fileInfo.partName(currentPart), startInPart, endInPart - startInPart);
}
};
}
Expand Down

0 comments on commit dbb0e21

Please sign in to comment.