I am implementing an interpreter-like project for which I need a weird little planning queue. Since I would like to try to avoid rethinking the wheels, I was hoping that someone could give me links to a similar structure or existing work. I know that I can just create several queues while I go, I'm just looking for some perspective from other people who may have better ideas than mine;)
I suppose it might work something like this: a structure is a tree with one root. You get a kind of "insert_iterator" to the root, and then click elements on it (for example, a and b in the example below). However, at any time, you can also split the iterator into several iterators, effectively creating branches. Branches cannot merge into the same queue again, but you can start appearing elements from the front of the queue (again, using the kind of "visitor_iterator") until empty branches cannot be discarded (at your discretion).
x -> y -> z
a -> b -> { g -> h -> i -> j }
f -> b
Any ideas? It seems like a relatively simple structure to realize myself using the queue pool, but I follow the βthink first, code laterβ strategy :)
thank
EDIT: , . , , . , ... COMMIT, ROLLBACK. x β ..., g β ... f β ... COMMIT,
a -> b
, , COMMIT. .
x -> y -> z -> COMMIT
a β b , .
ROLLBACK, , a β b.
! , .