Files
rustfs-console/lib/object-list-state.ts
T
2026-04-17 10:32:33 +08:00

40 lines
1.0 KiB
TypeScript

export interface ObjectListScope {
bucket: string
prefix: string
pageSize: number
showDeleted: boolean
}
interface ObjectListResponseGuardParams {
requestId: number
activeRequestId: number
requestScope: ObjectListScope
activeScope: ObjectListScope
}
export function createObjectListScope(scope: ObjectListScope): ObjectListScope {
return scope
}
export function isSameObjectListScope(left: ObjectListScope, right: ObjectListScope): boolean {
return (
left.bucket === right.bucket &&
left.prefix === right.prefix &&
left.pageSize === right.pageSize &&
left.showDeleted === right.showDeleted
)
}
export function shouldResetObjectListPagination(previousScope: ObjectListScope, nextScope: ObjectListScope): boolean {
return !isSameObjectListScope(previousScope, nextScope)
}
export function shouldApplyObjectListResponse({
requestId,
activeRequestId,
requestScope,
activeScope,
}: ObjectListResponseGuardParams): boolean {
return requestId === activeRequestId && isSameObjectListScope(requestScope, activeScope)
}