My Python server receives jobs that contain a list of the items to act against, rather like a search query term; an example input:
(Customer:24 OR Customer:25 OR (Group:NW NOT Customer:26))
So when a job is submitted, I have to parse this recipient pattern and resolve all those customers that match, and create the job with that input.
To complicate matters, customers can join and leave groups at any time, and the job should be updated live when this happens.
So as groups change membership, I have to notify all currently-running jobs about it (and they do their thing).
How is best to parse, apply and store (in my RDBMS) this kind of list of constraints?
- Parsing:
eval()
, hand-written FSM eating characters, yacc/bison/?, or? - applying: how would you store these constraints, and evaluate them?
- storing: in a database, a row per term with a evaluation-order and a NOT/AND/OR op field; or as a blob?