Added Sync RPC call; it's identical to ListServices for now

This commit is contained in:
Milos Gajdos
2019-09-23 21:08:31 +01:00
parent 04a5d884da
commit 61ee436cc4
4 changed files with 152 additions and 41 deletions

View File

@@ -74,3 +74,14 @@ func (r *Registry) Watch(ctx context.Context, req *pb.WatchRequest, rsp pb.Regis
return nil
}
func (r *Registry) Sync(ctx context.Context, req *pb.SyncRequest, rsp *pb.SyncResponse) error {
services, err := r.Registry.ListServices()
if err != nil {
return errors.InternalServerError("go.micro.registry", err.Error())
}
for _, srv := range services {
rsp.Services = append(rsp.Services, service.ToProto(srv))
}
return nil
}