x/ref: Implement ListenForPeers

This CL does the following things.
1. modify the underlying queue implementation
- It now handles both Peer and Invite through the copyable interface.
- copyable introduces the concept of a "lost" invite or peer.
- When the copyable is removed from the queue, a "lost" version is
  inserted in its stead.
- "lost" elements are only visible to cursors that have seen the
  corresponding found elements.
- "lost" elements remain within the queue, and thus affect its "size".
- Garbage collection of the "lost" elements occurs once everybody
  qualified to see the element has seen it via "next" OR has canceled
  and unregistered themselves from the queue.
- Tests adjusted to take into account "lost" updates.
  New tests added to take into account "lost" update garbage collection.
2. ListenForPeers is updated.
- Tests remain the same; it ignores the "lost" Invites.
3. ListenForInvites was added.
- Tests added by mocking out discovery.

Change-Id: I2ba36a59621a7e13d16dc722610c34d2f2a835b8
3 files changed
tree: f73f5e73ab0c0795663975c877382248992a0154
  1. cmd/
  2. examples/
  3. internal/
  4. lib/
  5. runtime/
  6. services/
  7. test/
  8. .gitignore
  9. AUTHORS
  10. CONTRIBUTING.md
  11. CONTRIBUTORS
  12. envvar.go
  13. envvar_test.go
  14. LICENSE
  15. PATENTS
  16. README.md
  17. VERSION
README.md

Vanadium

This repository contains a reference implementation of the Vanadium APIs.

Unlike the APIs in https://github.com/vanadium/go.v23, which promises to provide backward compatibility this repository makes no such promises.