JS: ETags logic as part of Sources [#90] (#341)

* Simplifies ETag logic into Source, making if-match conditional requests possible.
* Avoid if-match in FetchSource for latency reasons - use cache buster on ETag change
* handle weak ETags correctly
* add mock fetch server for testing ETags [#90]
This commit is contained in:
Brandon Liu
2024-01-31 23:00:24 +08:00
committed by GitHub
parent a0ee7c4906
commit 179b1590b1
6 changed files with 1964 additions and 141 deletions

View File

@@ -54,7 +54,7 @@ class S3Source implements Source {
return this.archive_name;
}
async getBytes(offset: number, length: number): Promise<RangeResponse> {
async getBytes(offset: number, length: number, signal?:AbortSignal, etag?: string): Promise<RangeResponse> {
const resp = await s3client.send(
new GetObjectCommand({
Bucket: process.env.BUCKET!,