Bogdan Caprita | 3c31921 | 2015-08-19 18:12:53 -0700 | [diff] [blame] | 1 | // 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 | |
| 5 | package discovery |
| 6 | |
Jungho Ahn | d587154 | 2015-09-08 18:48:11 -0700 | [diff] [blame] | 7 | import ( |
| 8 | "github.com/pborman/uuid" |
| 9 | |
| 10 | "v.io/v23/discovery" |
| 11 | ) |
| 12 | |
Jungho Ahn | 2411232 | 2015-09-15 10:10:24 -0700 | [diff] [blame] | 13 | const pkgPath = "v.io/x/ref/runtime/internal/discovery" |
| 14 | |
Bogdan Caprita | 3c31921 | 2015-08-19 18:12:53 -0700 | [diff] [blame] | 15 | // ds is an implementation of discovery.T. |
| 16 | type ds struct { |
Jungho Ahn | d587154 | 2015-09-08 18:48:11 -0700 | [diff] [blame] | 17 | plugins []Plugin |
| 18 | } |
| 19 | |
| 20 | // Advertisement holds a set of service properties to advertise. |
| 21 | type Advertisement struct { |
| 22 | discovery.Service |
| 23 | |
| 24 | // The service UUID to advertise. |
| 25 | ServiceUuid uuid.UUID |
| 26 | |
| 27 | // TODO(jhahn): Add proximity. |
Jungho Ahn | c235ccc | 2015-09-22 09:51:11 -0700 | [diff] [blame] | 28 | // TODO(jhahn): Use proximity for Lost. |
| 29 | Lost bool |
Jungho Ahn | d587154 | 2015-09-08 18:48:11 -0700 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | // TODO(jhahn): Need a better API. |
| 33 | func New(plugins []Plugin) discovery.T { |
| 34 | ds := &ds{plugins: make([]Plugin, len(plugins))} |
| 35 | copy(ds.plugins, plugins) |
| 36 | return ds |
Bogdan Caprita | 3c31921 | 2015-08-19 18:12:53 -0700 | [diff] [blame] | 37 | } |