hashicorp/go-eventlogger

Add API to register nodes, use resulting nodeids in RegisterPipeline

ncabatoff opened this issue · 2 comments

Right now we expect the user to link their own pipeline and pass in its head link. We should change it so that instead they pass in a list of nodes, and we build the linkages ourselves. That way we don't have to worry about them messing with the links after they've already registered the pipeline.

This change would probably also un-embed the Node interface from LinkableNode. We would instead stores Node objects inside objects that are the actual graph nodes, so users would implement only the Process/Reopen/Name/Type part and not have any control as to how they get wired up.

While we're changing RegisterPipeline, we may as well convert it to an options struct style argument as Brian suggested for future extensibility.

Also going to use this PR to add a RegisterNode API that returns a nodeid and make RegisterPipeline take a list of nodeids. This'll make it easier for us to collapse the pipelines into a DAG in future, and allow for the same sink to be used safely in more than one pipeline.

Another tiny change I'm planning to squeeze in: make FileSink take a formatter name rather than assuming json.