blob: b48dd1edaaf770b8e222788fa5512b2b615ded18 [file] [log] [blame]
// 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
// The service attachments.
// E.g., {'thumbnail': binary_data }.
//
// WARNING: THIS FIELD IS NOT SUPPORTED YET.
Attachments Attachments
}
// 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
// Attachments represents service attachments as a key/value pair. Unlike
// attributes, attachments are mostly for larger binary data and they are
// not queryable. It is recommended to put as small attachments as possible
// since it may require additional RPC calls causing delay in discovery.
//
// The key must be US-ASCII printable characters, excluding the '=' character
// and should not start with '_' character.
type Attachments map[string][]byte
// 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
}