| // 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. |
| "github.com/pborman/uuid" |
| "v.io/x/ref/runtime/internal/discovery" |
| services map[string][]*discovery.Advertisement // GUARDED_BY(mu) |
| func (p *plugin) Advertise(ctx *context.T, ad *discovery.Advertisement) error { |
| key := string(ad.ServiceUuid) |
| p.services[key] = append(ads, ad) |
| if uuid.Equal(a.InstanceUuid, ad.InstanceUuid) { |
| ads = append(ads[:i], ads[i+1:]...) |
| func (p *plugin) Scan(ctx *context.T, serviceUuid uuid.UUID, scanCh chan<- *discovery.Advertisement) error { |
| for key, service := range p.services { |
| if len(serviceUuid) > 0 && key != string(serviceUuid) { |
| for _, ad := range service { |
| func New() discovery.Plugin { |
| return &plugin{services: make(map[string][]*discovery.Advertisement)} |