lunatic icon indicating copy to clipboard operation
lunatic copied to clipboard

Naming distributed nodes

Open bkolobara opened this issue 2 years ago • 3 comments

We should be able to name distributed nodes to easier differentiate them. This would also include host function for looking up nodes by name and returning names when getting all nodes.

bkolobara avatar Aug 10 '22 08:08 bkolobara

@withtypes and me were discussing this, here is what we propose to do.

We add a new CLI flag which will accept key=value pairs (this would be a repeated flag), e.g. --tag name=worker01 --tag group=workers.

Then we can add a simple query syntax for looking up nodes by tags. e.g.

let nodes = lunatic::distributed::lookup_nodes("key=group^value=workers");

In the first iteration we would start simple with syntax like "key=k1^value=v1" and "key=k1^value=v1,v2,v3", then later we can expand. Syntax is also something we can discuss further, perhaps we can define a better Postfix syntax which would be easier to parse with more complex queries.

This would allow us to differentiate nodes not just by names but by any user defined values.

kosticmarin avatar Aug 31 '22 09:08 kosticmarin

I like it!

Is the argument to lookup_nodes treated as a filter? For example, would calling lookup_nodes("") return all known nodes? But then you could narrow it down: lookup_nodes("name=specific").

Would all nodes contain a list of their peers or would this lookup be done on the control node?

bkolobara avatar Aug 31 '22 09:08 bkolobara

lookup_nodes would take 'static str, control node would parse the expression and return results.

lookup_nodes("name=specific")

Narrowing down the looks better I agree!

kosticmarin avatar Aug 31 '22 09:08 kosticmarin