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

zql [3/n] - allow statements to be cleaned up / destroyed #31

Merged
merged 2 commits into from
Mar 15, 2024

Conversation

tantaman
Copy link

@tantaman tantaman commented Mar 13, 2024

Adds an explicit destroy method to Statement.

Destroy starts at the leaves and walk up the graph, destroying readers/writers & operators as they are encountered.

If a writer is encountered with multiple readers only the currently destroyed reader is removed and the walk stops. This would be the case if the graph was forked --

const pipeline1 = source.map();
const pipeline2 = pipeline1.filter();
const pipeline3 = pipeline1.filter();


//      s
//      |
//     p1
//   /    \
// p2      p3

Destroying p2 does not destroy p1. Destroying p3 sometime later would destroy p1.

@tantaman tantaman marked this pull request as draft March 13, 2024 01:02
@tantaman
Copy link
Author

converting to draft -- have a slightly different idea.

@tantaman tantaman force-pushed the mlaw/zql-destruct branch from 75534a9 to a6861ae Compare March 13, 2024 08:02
@tantaman tantaman marked this pull request as ready for review March 13, 2024 08:12
@tantaman tantaman force-pushed the mlaw/zql-destruct branch from a6861ae to 2acfb7a Compare March 13, 2024 13:26
@tantaman tantaman changed the title zql - allow statements to be cleaned up / destroyed zql [3/n] - allow statements to be cleaned up / destroyed Mar 14, 2024
@tantaman tantaman force-pushed the mlaw/zql-destruct branch from 2acfb7a to 2345f54 Compare March 14, 2024 01:48
@tantaman tantaman force-pushed the mlaw/zql-destruct branch from 2345f54 to f614463 Compare March 15, 2024 01:54
Base automatically changed from mlaw/zql-repl to main March 15, 2024 01:58
Calling `destroy` on a leaf destroys the leaf then moves up the pipeline. If the next level upwards has no consumers then it is destroyed as well. If it has consumers, it is kept intact since pipelines can be forked.
@tantaman tantaman force-pushed the mlaw/zql-destruct branch from f614463 to 0348952 Compare March 15, 2024 02:02
@tantaman tantaman merged commit 2a7cf20 into main Mar 15, 2024
4 checks passed
@tantaman tantaman deleted the mlaw/zql-destruct branch March 15, 2024 02:04
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