Skip to content
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

Extend RunlistStream/Create LookupStream to allow on-demand run lookup #53

Open
Schamper opened this issue Aug 12, 2024 · 0 comments
Open

Comments

@Schamper
Copy link
Member

It's been bothering me for a while that RunlistStream always requires a fully resolved runlist to function. Sometimes resolving a full runlist is expensive and slow, and you don't always need the entire runlist (e.g. you're only reading a small portion or randomly seeking through a large file).

RunlistStream (or a new class, LookupStream? TBD) should allow subclasses to define something like a _lookup(self, offset, length) -> Iterator[tuple[int, int]] method that will resolve run lookup on-demand. For example, in dissect.extfs or dissect.btrfs, this could be used to query the extent BTree to lookup the proper extent/run and return the (physical offset, size) tuple for that. Making it a generator will allow for lazy evaluation too.

For dissect.btrfs, this would also resolve fox-it/dissect.btrfs#10.

@Schamper Schamper added the enhancement New feature or request label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants