Skip to content

Commit 8c51a9c

Browse files
committed
Modularize
1 parent 7d91a46 commit 8c51a9c

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/block-view.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,8 @@ export class BlockView {
195195
try {
196196
const length = range.max - range.min
197197
const offset = range.min
198-
const resultBuffer = await this.featureCache.get(
199-
`${length}_${offset}`,
200-
{ length, offset },
201-
opts?.signal,
202-
)
198+
const resultBuffer = await this.bbi.read(length, offset, opts)
199+
203200
for (const element of offsets) {
204201
if (range.contains(element)) {
205202
processRTreeNode(resultBuffer, element - offset, level)
@@ -430,7 +427,7 @@ export class BlockView {
430427
) {
431428
try {
432429
const { blockType, isCompressed } = this
433-
const { signal, request } = opts
430+
const { request } = opts
434431
const blockGroupsToFetch = groupBlocks(blocks)
435432
await Promise.all(
436433
blockGroupsToFetch.map(async blockGroup => {

src/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,9 @@ export interface RequestOptions2 extends RequestOptions {
6767
scale?: number
6868
basesPerSpan?: number
6969
}
70+
71+
export interface CoordRequest {
72+
chrId: number
73+
start: number
74+
end: number
75+
}

src/util.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,7 @@ export async function abortBreakPoint(signal?: AbortSignal): Promise<void> {
7474
await Promise.resolve()
7575
checkAbortSignal(signal)
7676
}
77+
78+
export function coordFilter(s1: number, e1: number, s2: number, e2: number) {
79+
return s1 < e2 && e1 >= s2
80+
}

0 commit comments

Comments
 (0)