Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrintDAG should take either a PrinterFunc or a buffer #14

Open
jsimnz opened this issue Jul 18, 2019 · 2 comments
Open

PrintDAG should take either a PrinterFunc or a buffer #14

jsimnz opened this issue Jul 18, 2019 · 2 comments

Comments

@jsimnz
Copy link
Contributor

jsimnz commented Jul 18, 2019

The PrintDAG should take either a PrinterFunc(line string) as an argument, or an io.Writer so you can control what the function prints to. I noticed the comments on the PrintDAG function even mention a printerFunc.

Might be a small niche use-case but as an experimental use of the crdt Datastore I've made an HTTP server that takes a go-datastore interface and exposes a basic API, it would be nice to be able to print the DAG and return it over the API. At the moment my only options are using my own fork that implements one of these two options, or some janky stdout copy/buffer stuff (don't want to do).

Thoughts?

@jsimnz
Copy link
Contributor Author

jsimnz commented Jul 18, 2019

Alternatively the function could just return a string, however, then it would probably need a name change to something like DAGToString().

@hsanjuan
Copy link
Collaborator

That function is not really used (I used it mostly for debugging at the beginning). It doesn't even work very well (printing a multi-branched DAG is pretty horrible).

I'm happy changing it to whatever fits your needs. Would you like to make a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants