| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| package discovery |
| |
| // Service represents service information for service discovery. |
| type Service struct { |
| // The universal unique identifier of a service instance. |
| // If this is not specified, a random unique identifier will be assigned. |
| InstanceId string |
| // Optional name of the service instance. |
| InstanceName string |
| // The interface that the service implements. |
| // E.g., 'v.io/v23/services/vtrace.Store'. |
| InterfaceName string |
| // The service attributes. |
| // E.g., {'resolution': '1024x768'}. |
| Attrs Attributes |
| // The addresses (vanadium object names) that the service is served on. |
| // E.g., '/host:port/a/b/c', '/ns.dev.v.io:8101/blah/blah'. |
| Addrs []string |
| } |
| |
| // Attributes represents service attributes as a key/value pair. |
| // |
| // The key must be US-ASCII printable characters, excluding the '=' character |
| // and should not start with '_' character. |
| type Attributes map[string]string |
| |
| // Found represents a service that is discovered by scan. |
| type Found struct { |
| Service Service |
| // TODO(jhahn): Add proximity. |
| } |
| |
| // Lost represents a service that is lost during scan. |
| type Lost struct { |
| InstanceId string |
| } |
| |
| // Update represents a discovery update. |
| type Update union { |
| Found Found |
| Lost Lost |
| } |