blob: 10b73775851a9a3995007de43a731855f161f862 [file] [log] [blame]
Bogdan Caprita3c319212015-08-19 18:12:53 -07001// Copyright 2015 The Vanadium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package discovery
6
Jungho Ahnd5871542015-09-08 18:48:11 -07007import (
8 "github.com/pborman/uuid"
9
10 "v.io/v23/discovery"
11)
12
Jungho Ahn24112322015-09-15 10:10:24 -070013const pkgPath = "v.io/x/ref/runtime/internal/discovery"
14
Bogdan Caprita3c319212015-08-19 18:12:53 -070015// ds is an implementation of discovery.T.
16type ds struct {
Jungho Ahnd5871542015-09-08 18:48:11 -070017 plugins []Plugin
18}
19
20// Advertisement holds a set of service properties to advertise.
21type Advertisement struct {
22 discovery.Service
23
24 // The service UUID to advertise.
25 ServiceUuid uuid.UUID
26
27 // TODO(jhahn): Add proximity.
Jungho Ahnc235ccc2015-09-22 09:51:11 -070028 // TODO(jhahn): Use proximity for Lost.
29 Lost bool
Jungho Ahnd5871542015-09-08 18:48:11 -070030}
31
32// TODO(jhahn): Need a better API.
33func New(plugins []Plugin) discovery.T {
34 ds := &ds{plugins: make([]Plugin, len(plugins))}
35 copy(ds.plugins, plugins)
36 return ds
Bogdan Caprita3c319212015-08-19 18:12:53 -070037}