Skip to content

refactor(s3stream): refactor StreamReader Block object #2685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lifepuzzlefun
Copy link
Contributor

No description provided.

@daniel-y daniel-y requested review from Copilot and removed request for SCNieh and Chillax-0v0 August 8, 2025 04:28
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors the StreamReader's Block object by extracting a new ExternalCacheBlock class to handle external cache operations, separating concerns between internal block management and external cache interactions.

  • Introduces a new ExternalCacheBlock class for handling external cache-specific operations
  • Updates method signatures and variable declarations to use ExternalCacheBlock where appropriate
  • Moves some logic from the existing Block class to the new ExternalCacheBlock class

data.release();
data = null;
}
});
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loadCf field may be null when release() is called, which would cause a NullPointerException. Consider adding a null check before calling whenComplete.

Suggested change
});
if (loadCf != null) {
loadCf.whenComplete((v, ex) -> {
if (data != null) {
data.release();
data = null;
}
});
}

Copilot uses AI. Check for mistakes.

// the data block is first loaded or evict & reload
externalBlock.loadCf = dataBlockCache.getBlock(getOptions, objectReader, index).thenAccept(newData -> {
externalBlock.data = newData;
handleDataBlockChange(newData);
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handleDataBlockChange method is called from ExternalCacheBlock but is defined in the Block class, which will cause a compilation error since ExternalCacheBlock doesn't have access to this method.

Copilot uses AI. Check for mistakes.

}
released = true;
loadCf.whenComplete((nil, ex) -> {
private void handleDataBlockChange(DataBlock newData) {
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handleDataBlockChange method references instance fields (readCompleted, data, freeListenerHandle) from the Block class, but it's being called from ExternalCacheBlock which doesn't have these fields. This will cause compilation errors.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant