Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

HTTP/JSON interface issues #656

Closed
abligh opened this issue May 13, 2015 · 1 comment
Closed

HTTP/JSON interface issues #656

abligh opened this issue May 13, 2015 · 1 comment
Labels
Milestone

Comments

@abligh
Copy link
Contributor

abligh commented May 13, 2015

I've come across some practical problems using the HTTP/JSON interface.

What I want to do in essence is replace the current set of peers with a known good set of peers.

Issue 1: I can only add (using /connect) or remove (using /forget) peers, not specify a list of peers replacing the current set. It would be nice if we could do an atomic replace of the peer list with the new peer list, forgetting any that aren't on the new list, and connecting to any new ones. However, you can only add or remove peers one by one.

Issue 2: in order to work around that deficiency, I need to get the list of current peers from weave (using /status-json), parse the JSON (which is a pain), then add or remove the peers as appropriate. There are two sub-issues here: 2A. /status-json does not list the peer IP address and port, so it's impossible to find a given peer. 2B. if the peer has never connected at all (i.e. it's merely configured), it's not listed in /status-json at all; this means that if for example a peer was added which isn't running weave (e.g. is down), it would never get removed. Either that, or /status-json's Peers entry is meant to return only a list of peers that it has negotiated with, in which case it would be very useful to return a list of peers that are configured (perhaps separately).

My current workaround is 'restart weaver' which is not nice.

I think Issue #1 is best addressed through another entry in HandleHTTP which simply takes a comma delimited list of peers and does the appropriate thing. This avoids the need to incorporate a JSON library my end. I suggest a URL of /replace. I'm quite happy to add this myself. However, I'm not entirely sure how to forget a connection that has been initiated but not yet connected - there's a race condition here I think.

I think Issue #2A and #2B are straight bugs. WDYT?

@rade rade added this to the n/a milestone May 14, 2015
@rade
Copy link
Member

rade commented May 14, 2015

It would be nice if we could do an atomic replace of the peer list

#658

get the list of current peers from weave

#659 and #660.

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

No branches or pull requests

3 participants