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

ls protocol format is unfriendly #14

Open
whyrusleeping opened this issue Jan 1, 2017 · 4 comments
Open

ls protocol format is unfriendly #14

whyrusleeping opened this issue Jan 1, 2017 · 4 comments

Comments

@whyrusleeping
Copy link
Member

I'm still not on board with the protocol here. It feels broken.

Multistream select's primary operation is reading a length prefixed newline delimited string. Lets call this operation readLpNd().

Interacting with multistream normally just requires calling readLpNd twice, and passing the stream on to someone else. When reading an ls, i'd expect something similar, for example:

numProtos := readLpNd()
for i := 0; i < numProtos; i++ {
    proto := readLpNd()
    fmt.Println("ls response: ", proto)
}

Where the first read reads in a number encoded in either hex or base10 ascii (since the point is somewhat to have human readability).

Instead, I have to do some weird nonsense to read the ls response:

firstline := readLpNd()
lengthOfWholeMessage := readUvarint(firstline) // this value is effectively useless
numberOfProtocols := readUvarint(firstline)
for i := 0; i < numberOfProtocols; i++ {
    // same as above
}

This just feels rather off, and isnt very user friendly (especially users who might try to manually interact with the protocol)

@whyrusleeping
Copy link
Member Author

Its also really inconvenient to create these messages.

@daviddias daviddias assigned jbenet, daviddias and whyrusleeping and unassigned jbenet Jan 2, 2017
@daviddias
Copy link
Member

Although ease of implementation is super valuable, is it worth to create a breaking change in the spec now?

@whyrusleeping
Copy link
Member Author

Yeah, as far as i can tell nobody uses multistream ls. the only tool (mss-nc) that can easily ls things doesnt follow the spec anyways

@creationix
Copy link

If all messages are text based, I think newline delimited is much better for implementations and for testing with tools like nc.

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

No branches or pull requests

4 participants