Split pods/containers into separate trees in quark_queue - #380
Conversation
24c8711 to
499635f
Compare
PR Review: #380 — Split pods/containers into separate trees in quark_queueAuthor: Tacklebox SummaryThis change moves the pod index onto FindingsSignificant
Minor
VerdictREQUEST_CHANGES — fix the existing-container parent-link path before exposing Verification
|
| while ((pod = RB_ROOT(&qq->pod_by_uid)) != NULL) | ||
| pod_delete(qq, pod); | ||
| /* Clean up any orphaned containers not linked to a pod */ | ||
| while ((container = RB_ROOT(&qq->container_by_id)) != NULL) |
There was a problem hiding this comment.
Do we actually need it? IIUC pod_delete handles this case at https://github.com/elastic/quark/blob/main/quark.c#L891
| return (NULL); | ||
| } | ||
|
|
||
| container = container_lookup(qq, (char *)container_id); |
There was a problem hiding this comment.
Could we use quark_container_get with pod_uid being NULL ? If so, I assume we will not be able to attach a pod_uid later, because of the check in the next line. Is that correct understanding? (the first finding from Nick's review)
Could we add a unit test which verifies and demoes correct use case of the function?
| * initialized). Caller fills in remaining fields (name, ns, phase, etc.). | ||
| */ | ||
| struct quark_pod * | ||
| quark_pod_get(struct quark_queue *qq, const char *uid) |
There was a problem hiding this comment.
Would it make sense to add a unit test?
Summary
pod_by_uidout ofquark_kubeand intoquark_queuedirectly, alongside the existingcontainer_by_idGC_CONTAINERtoenum gc_typeand embedsstruct gc_link gcas the first member ofstruct quark_container, enabling containers to participate in the GC queue independentlygc_unlinkcall incontainer_deleteso containers already in the GC queue are safely dequeued when their parent pod is torn downGC_CONTAINERingc_collect, routing tocontainer_deleteThis is the structural foundation for the public pod/container API in the next PR.
Test plan
make libquark_big.abuilds cleanly🤖 Generated with Claude Code