| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Package discovery implements RPC service introspection. | 5 // Package discovery implements RPC service introspection. |
| 6 package discovery | 6 package discovery |
| 7 | 7 |
| 8 import ( | 8 import ( |
| 9 "crypto/sha1" | 9 "crypto/sha1" |
| 10 "fmt" | 10 "fmt" |
| 11 | 11 |
| 12 "github.com/golang/protobuf/proto" | 12 "github.com/golang/protobuf/proto" |
| 13 "golang.org/x/net/context" | 13 "golang.org/x/net/context" |
| 14 | 14 |
| 15 "github.com/luci/luci-go/common/proto/google/descriptor" | |
| 16 "github.com/luci/luci-go/grpc/prpc" | 15 "github.com/luci/luci-go/grpc/prpc" |
| 16 "google.golang.org/genproto/protobuf" |
| 17 ) | 17 ) |
| 18 | 18 |
| 19 // New creates a discovery server for all the given services. | 19 // New creates a discovery server for all the given services. |
| 20 // The service descriptions must be registered using | 20 // The service descriptions must be registered using |
| 21 // RegisterDescriptorSetCompressed which is called by init() function | 21 // RegisterDescriptorSetCompressed which is called by init() function |
| 22 // generated by github.com/luci/luci-go/grpc/cmd/cproto. | 22 // generated by github.com/luci/luci-go/grpc/cmd/cproto. |
| 23 func New(serviceNames ...string) (DiscoveryServer, error) { | 23 func New(serviceNames ...string) (DiscoveryServer, error) { |
| 24 desc, err := combineDescriptors(serviceNames) | 24 desc, err := combineDescriptors(serviceNames) |
| 25 if err != nil { | 25 if err != nil { |
| 26 return nil, err | 26 return nil, err |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 hash := sha1.Sum(binary) | 82 hash := sha1.Sum(binary) |
| 83 if !seenFiles[hash] { | 83 if !seenFiles[hash] { |
| 84 result.File = append(result.File, f) | 84 result.File = append(result.File, f) |
| 85 seenFiles[hash] = true | 85 seenFiles[hash] = true |
| 86 } | 86 } |
| 87 | 87 |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 return result, nil | 90 return result, nil |
| 91 } | 91 } |
| OLD | NEW |