Update the runtime for k8s name formatting and move Get to Read endpoint (#978)

* Update the runtime for k8s name formatting and move Get to Read endpoint

* strip regex validation
This commit is contained in:
Asim Aslam 2019-11-25 16:31:14 +00:00 committed by GitHub
parent 95045be83d
commit 252667398e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 268 additions and 589 deletions

3
go.sum
View File

@ -84,6 +84,7 @@ github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMEl
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decker502/dnspod-go v0.2.0/go.mod h1:qsurYu1FgxcDwfSwXJdLt4kRsBLZeosEb9uq4Sy+08g= github.com/decker502/dnspod-go v0.2.0/go.mod h1:qsurYu1FgxcDwfSwXJdLt4kRsBLZeosEb9uq4Sy+08g=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
@ -321,6 +322,7 @@ github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
@ -364,6 +366,7 @@ github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM= github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM=

View File

@ -176,9 +176,9 @@ func (r *runtime) Create(s *Service, opts ...CreateOption) error {
return nil return nil
} }
// Get returns all instances of requested service // Read returns all instances of requested service
// If no service name is provided we return all the track services. // If no service name is provided we return all the track services.
func (r *runtime) Get(name string, opts ...GetOption) ([]*Service, error) { func (r *runtime) Read(name string, opts ...ReadOption) ([]*Service, error) {
r.Lock() r.Lock()
defer r.Unlock() defer r.Unlock()
@ -186,7 +186,7 @@ func (r *runtime) Get(name string, opts ...GetOption) ([]*Service, error) {
return nil, errors.New("missing service name") return nil, errors.New("missing service name")
} }
gopts := GetOptions{} gopts := ReadOptions{}
for _, o := range opts { for _, o := range opts {
o(&gopts) o(&gopts)
} }

View File

@ -2,7 +2,6 @@
package client package client
import ( import (
"regexp"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -18,8 +17,6 @@ const (
var ( var (
// DefaultImage is default micro image // DefaultImage is default micro image
DefaultImage = "micro/go-micro" DefaultImage = "micro/go-micro"
// ServiceRegexp is used to validate service name
ServiceRegexp = regexp.MustCompile("^" + dns1123LabelFmt + "$")
) )
// Kubernetes client // Kubernetes client
@ -36,9 +33,9 @@ type Kubernetes interface {
List(*Resource) error List(*Resource) error
} }
// DefaultService returns default micro kubernetes service definition // NewService returns default micro kubernetes service definition
func DefaultService(name, version string) *Service { func NewService(name, version string) *Service {
log.Debugf("kubernetes default service: name: %s, version: %s", name, version) log.Tracef("kubernetes default service: name: %s, version: %s", name, version)
Labels := map[string]string{ Labels := map[string]string{
"name": name, "name": name,
@ -73,9 +70,9 @@ func DefaultService(name, version string) *Service {
} }
} }
// DefaultService returns default micro kubernetes deployment definition // NewService returns default micro kubernetes deployment definition
func DefaultDeployment(name, version, source string) *Deployment { func NewDeployment(name, version string) *Deployment {
log.Debugf("kubernetes default deployment: name: %s, version: %s, source: %s", name, version, source) log.Tracef("kubernetes default deployment: name: %s, version: %s", name, version)
Labels := map[string]string{ Labels := map[string]string{
"name": name, "name": name,
@ -90,15 +87,11 @@ func DefaultDeployment(name, version, source string) *Deployment {
} }
Metadata := &Metadata{ Metadata := &Metadata{
Name: depName, Name: depName,
Namespace: "default", Namespace: "default",
Version: version, Version: version,
Labels: Labels, Labels: Labels,
Annotations: map[string]string{ Annotations: map[string]string{},
"source": source,
"owner": "micro",
"group": "micro",
},
} }
// TODO: we need to figure out this version stuff // TODO: we need to figure out this version stuff
@ -108,7 +101,7 @@ func DefaultDeployment(name, version, source string) *Deployment {
buildUnixTimeUTC := time.Unix(buildTime, 0) buildUnixTimeUTC := time.Unix(buildTime, 0)
Metadata.Annotations["build"] = buildUnixTimeUTC.Format(time.RFC3339) Metadata.Annotations["build"] = buildUnixTimeUTC.Format(time.RFC3339)
} else { } else {
log.Debugf("could not parse build: %v", err) log.Tracef("could not parse build: %v", err)
} }
// enable go modules by default // enable go modules by default
@ -129,7 +122,7 @@ func DefaultDeployment(name, version, source string) *Deployment {
Name: name, Name: name,
Image: DefaultImage, Image: DefaultImage,
Env: []EnvVar{env}, Env: []EnvVar{env},
Command: []string{"go", "run", source}, Command: []string{"go", "run", "main.go"},
Ports: []ContainerPort{{ Ports: []ContainerPort{{
Name: name + "-port", Name: name + "-port",
ContainerPort: 8080, ContainerPort: 8080,

View File

@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"strings"
"text/template" "text/template"
) )
@ -85,3 +86,17 @@ func CertsFromPEM(pemCerts []byte) ([]*x509.Certificate, error) {
} }
return certs, nil return certs, nil
} }
// Format is used to format a string value into a k8s valid name
func Format(v string) string {
// to lower case
v = strings.ToLower(v)
// dots to dashes
v = strings.ReplaceAll(v, ".", "-")
// limit to 253 chars
if len(v) > 253 {
v = v[:253]
}
// return new name
return v
}

View File

@ -8,19 +8,38 @@ import (
func TestTemplates(t *testing.T) { func TestTemplates(t *testing.T) {
name := "foo" name := "foo"
version := "123" version := "123"
source := "github.com/foo/bar"
// Render default service // Render default service
s := DefaultService(name, version) s := NewService(name, version)
bs := new(bytes.Buffer) bs := new(bytes.Buffer)
if err := renderTemplate(templates["service"], bs, s); err != nil { if err := renderTemplate(templates["service"], bs, s); err != nil {
t.Errorf("Failed to render kubernetes service: %v", err) t.Errorf("Failed to render kubernetes service: %v", err)
} }
// Render default deployment // Render default deployment
d := DefaultDeployment(name, version, source) d := NewDeployment(name, version)
bd := new(bytes.Buffer) bd := new(bytes.Buffer)
if err := renderTemplate(templates["deployment"], bd, d); err != nil { if err := renderTemplate(templates["deployment"], bd, d); err != nil {
t.Errorf("Failed to render kubernetes deployment: %v", err) t.Errorf("Failed to render kubernetes deployment: %v", err)
} }
} }
func TestFormatName(t *testing.T) {
testCases := []struct {
name string
expect string
}{
{"foobar", "foobar"},
{"foo-bar", "foo-bar"},
{"foo.bar", "foo-bar"},
{"Foo.Bar", "foo-bar"},
{"go.micro.foo.bar", "go-micro-foo-bar"},
}
for _, test := range testCases {
v := Format(test.name)
if v != test.expect {
t.Fatalf("Expected name %s for %s got: %s", test.expect, test.name, v)
}
}
}

View File

@ -5,7 +5,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"strconv" "strconv"
"strings"
"sync" "sync"
"time" "time"
@ -86,19 +85,19 @@ func (k *kubernetes) Create(s *runtime.Service, opts ...runtime.CreateOption) er
o(&options) o(&options)
} }
svcName := s.Name // quickly prevalidate the name and version
name := s.Name
if len(s.Version) > 0 { if len(s.Version) > 0 {
svcName = strings.Join([]string{s.Name, s.Version}, "-") name = name + "-" + s.Version
} }
if !client.ServiceRegexp.MatchString(svcName) { // format as we'll format in the deployment
return fmt.Errorf("invalid service name: %s", svcName) name = client.Format(name)
}
// create new kubernetes micro service // create new kubernetes micro service
service := newService(s, options) service := newService(s, options)
log.Debugf("Runtime queueing service %s for start action", service.Name) log.Debugf("Runtime queueing service %s version %s for start action", service.Name, service.Version)
// push into start queue // push into start queue
k.queue <- &task{ k.queue <- &task{
@ -109,9 +108,9 @@ func (k *kubernetes) Create(s *runtime.Service, opts ...runtime.CreateOption) er
return nil return nil
} }
// getMicroService queries kubernetes for micro service // getService queries kubernetes for micro service
// NOTE: this function is not thread-safe // NOTE: this function is not thread-safe
func (k *kubernetes) getMicroService(labels map[string]string) ([]*runtime.Service, error) { func (k *kubernetes) getService(labels map[string]string) ([]*runtime.Service, error) {
// get the service status // get the service status
serviceList := new(client.ServiceList) serviceList := new(client.ServiceList)
r := &client.Resource{ r := &client.Resource{
@ -137,31 +136,55 @@ func (k *kubernetes) getMicroService(labels map[string]string) ([]*runtime.Servi
// collect info from kubernetes service // collect info from kubernetes service
for _, kservice := range serviceList.Items { for _, kservice := range serviceList.Items {
// name of the service
name := kservice.Metadata.Labels["name"] name := kservice.Metadata.Labels["name"]
// version of the service
version := kservice.Metadata.Labels["version"] version := kservice.Metadata.Labels["version"]
svcMap[name] = &runtime.Service{
// save as service
svcMap[name+version] = &runtime.Service{
Name: name, Name: name,
Version: version, Version: version,
Metadata: make(map[string]string), Metadata: make(map[string]string),
} }
// copy annotations metadata into service metadata // copy annotations metadata into service metadata
for k, v := range kservice.Metadata.Annotations { for k, v := range kservice.Metadata.Annotations {
svcMap[name].Metadata[k] = v svcMap[name+version].Metadata[k] = v
} }
} }
// collect additional info from kubernetes deployment // collect additional info from kubernetes deployment
for _, kdep := range depList.Items { for _, kdep := range depList.Items {
// name of the service
name := kdep.Metadata.Labels["name"] name := kdep.Metadata.Labels["name"]
if svc, ok := svcMap[name]; ok { // versio of the service
// set the service source version := kdep.Metadata.Labels["version"]
// access existing service map based on name + version
if svc, ok := svcMap[name+version]; ok {
// we're expecting our own service name in metadata
if _, ok := kdep.Metadata.Annotations["name"]; !ok {
continue
}
// set the service name, version and source
// based on existing annotations we stored
svc.Name = kdep.Metadata.Annotations["name"]
svc.Version = kdep.Metadata.Annotations["version"]
svc.Source = kdep.Metadata.Annotations["source"] svc.Source = kdep.Metadata.Annotations["source"]
// delete from metadata
delete(kdep.Metadata.Annotations, "name")
delete(kdep.Metadata.Annotations, "version")
delete(kdep.Metadata.Annotations, "source")
// copy all annotations metadata into service metadata // copy all annotations metadata into service metadata
for k, v := range kdep.Metadata.Annotations { for k, v := range kdep.Metadata.Annotations {
svc.Metadata[k] = v svc.Metadata[k] = v
} }
// parse out deployment status // parse out deployment status and inject into service metadata
if len(kdep.Status.Conditions) > 0 { if len(kdep.Status.Conditions) > 0 {
status := kdep.Status.Conditions[0].Type status := kdep.Status.Conditions[0].Type
// pick the last known condition type and mark the service status with it // pick the last known condition type and mark the service status with it
@ -186,6 +209,7 @@ func (k *kubernetes) getMicroService(labels map[string]string) ([]*runtime.Servi
// collect all the services and return // collect all the services and return
services := make([]*runtime.Service, 0, len(serviceList.Items)) services := make([]*runtime.Service, 0, len(serviceList.Items))
for _, service := range svcMap { for _, service := range svcMap {
services = append(services, service) services = append(services, service)
} }
@ -193,8 +217,8 @@ func (k *kubernetes) getMicroService(labels map[string]string) ([]*runtime.Servi
return services, nil return services, nil
} }
// Get returns all instances of given service // Read returns all instances of given service
func (k *kubernetes) Get(name string, opts ...runtime.GetOption) ([]*runtime.Service, error) { func (k *kubernetes) Read(name string, opts ...runtime.ReadOption) ([]*runtime.Service, error) {
k.Lock() k.Lock()
defer k.Unlock() defer k.Unlock()
@ -203,13 +227,16 @@ func (k *kubernetes) Get(name string, opts ...runtime.GetOption) ([]*runtime.Ser
return nil, errors.New("missing service name") return nil, errors.New("missing service name")
} }
// format the name
name = client.Format(name)
// set the default labels // set the default labels
labels := map[string]string{ labels := map[string]string{
"micro": "service", "micro": "service",
"name": name, "name": name,
} }
var options runtime.GetOptions var options runtime.ReadOptions
for _, o := range opts { for _, o := range opts {
o(&options) o(&options)
} }
@ -221,7 +248,7 @@ func (k *kubernetes) Get(name string, opts ...runtime.GetOption) ([]*runtime.Ser
log.Debugf("Runtime querying service %s", name) log.Debugf("Runtime querying service %s", name)
return k.getMicroService(labels) return k.getService(labels)
} }
// List the managed services // List the managed services
@ -235,7 +262,7 @@ func (k *kubernetes) List() ([]*runtime.Service, error) {
log.Debugf("Runtime listing all micro services") log.Debugf("Runtime listing all micro services")
return k.getMicroService(labels) return k.getService(labels)
} }
// Update the service in place // Update the service in place

View File

@ -18,9 +18,23 @@ type service struct {
} }
func newService(s *runtime.Service, c runtime.CreateOptions) *service { func newService(s *runtime.Service, c runtime.CreateOptions) *service {
kservice := client.DefaultService(s.Name, s.Version) // use pre-formatted name/version
kdeploy := client.DefaultDeployment(s.Name, s.Version, s.Source) name := client.Format(s.Name)
version := client.Format(s.Version)
kservice := client.NewService(name, version)
kdeploy := client.NewDeployment(name, version)
// attach our values to the deployment; name, version, source
kdeploy.Metadata.Annotations["name"] = s.Name
kdeploy.Metadata.Annotations["version"] = s.Version
kdeploy.Metadata.Annotations["source"] = s.Source
// associate owner:group to be later augmented
kdeploy.Metadata.Annotations["owner"] = "micro"
kdeploy.Metadata.Annotations["group"] = "micro"
// define the environment values used by the container
env := make([]client.EnvVar, 0, len(c.Env)) env := make([]client.EnvVar, 0, len(c.Env))
for _, evar := range c.Env { for _, evar := range c.Env {
evarPair := strings.Split(evar, "=") evarPair := strings.Split(evar, "=")
@ -35,10 +49,11 @@ func newService(s *runtime.Service, c runtime.CreateOptions) *service {
// if Exec/Command has been supplied override the default command // if Exec/Command has been supplied override the default command
if len(s.Exec) > 0 { if len(s.Exec) > 0 {
kdeploy.Spec.Template.PodSpec.Containers[0].Command = s.Exec kdeploy.Spec.Template.PodSpec.Containers[0].Command = s.Exec
} else { } else if len(c.Command) > 0 {
if len(c.Command) > 0 { kdeploy.Spec.Template.PodSpec.Containers[0].Command = c.Command
kdeploy.Spec.Template.PodSpec.Containers[0].Command = c.Command } else if len(s.Source) > 0 {
} // default command for our k8s service should be source
kdeploy.Spec.Template.PodSpec.Containers[0].Command = []string{"go", "run", s.Source}
} }
return &service{ return &service{

View File

@ -55,17 +55,17 @@ func WithOutput(out io.Writer) CreateOption {
} }
} }
type GetOption func(o *GetOptions) type ReadOption func(o *ReadOptions)
// GetOptions queries runtime services // ReadOptions queries runtime services
type GetOptions struct { type ReadOptions struct {
// Version queries services with given version // Version queries services with given version
Version string Version string
} }
// WithVersion confifgures service version // WithVersion confifgures service version
func WithVersion(version string) GetOption { func WithVersion(version string) ReadOption {
return func(o *GetOptions) { return func(o *ReadOptions) {
o.Version = version o.Version = version
} }
} }

View File

@ -1,108 +0,0 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: runtime.proto
package go_micro_runtime
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option
// Client API for Runtime service
type RuntimeService interface {
Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
}
type runtimeService struct {
c client.Client
name string
}
func NewRuntimeService(name string, c client.Client) RuntimeService {
if c == nil {
c = client.NewClient()
}
if len(name) == 0 {
name = "go.micro.runtime"
}
return &runtimeService{
c: c,
name: name,
}
}
func (c *runtimeService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
req := c.c.NewRequest(c.name, "Runtime.Create", in)
out := new(CreateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *runtimeService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
req := c.c.NewRequest(c.name, "Runtime.Delete", in)
out := new(DeleteResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Runtime service
type RuntimeHandler interface {
Create(context.Context, *CreateRequest, *CreateResponse) error
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
}
func RegisterRuntimeHandler(s server.Server, hdlr RuntimeHandler, opts ...server.HandlerOption) error {
type runtime interface {
Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
}
type Runtime struct {
runtime
}
h := &runtimeHandler{hdlr}
return s.Handle(s.NewHandler(&Runtime{h}, opts...))
}
type runtimeHandler struct {
RuntimeHandler
}
func (h *runtimeHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
return h.RuntimeHandler.Create(ctx, in, out)
}
func (h *runtimeHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
return h.RuntimeHandler.Delete(ctx, in, out)
}

View File

@ -1,257 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: runtime.proto
package go_micro_runtime
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Service struct {
// name of the service
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// git url of the source
Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
// local path of the source
Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
// command to execute
Exec []string `protobuf:"bytes,4,rep,name=exec,proto3" json:"exec,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Service) Reset() { *m = Service{} }
func (m *Service) String() string { return proto.CompactTextString(m) }
func (*Service) ProtoMessage() {}
func (*Service) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{0}
}
func (m *Service) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Service.Unmarshal(m, b)
}
func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Service.Marshal(b, m, deterministic)
}
func (m *Service) XXX_Merge(src proto.Message) {
xxx_messageInfo_Service.Merge(m, src)
}
func (m *Service) XXX_Size() int {
return xxx_messageInfo_Service.Size(m)
}
func (m *Service) XXX_DiscardUnknown() {
xxx_messageInfo_Service.DiscardUnknown(m)
}
var xxx_messageInfo_Service proto.InternalMessageInfo
func (m *Service) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Service) GetSource() string {
if m != nil {
return m.Source
}
return ""
}
func (m *Service) GetPath() string {
if m != nil {
return m.Path
}
return ""
}
func (m *Service) GetExec() []string {
if m != nil {
return m.Exec
}
return nil
}
type CreateRequest struct {
Service *Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateRequest) Reset() { *m = CreateRequest{} }
func (m *CreateRequest) String() string { return proto.CompactTextString(m) }
func (*CreateRequest) ProtoMessage() {}
func (*CreateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{1}
}
func (m *CreateRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateRequest.Unmarshal(m, b)
}
func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateRequest.Marshal(b, m, deterministic)
}
func (m *CreateRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateRequest.Merge(m, src)
}
func (m *CreateRequest) XXX_Size() int {
return xxx_messageInfo_CreateRequest.Size(m)
}
func (m *CreateRequest) XXX_DiscardUnknown() {
xxx_messageInfo_CreateRequest.DiscardUnknown(m)
}
var xxx_messageInfo_CreateRequest proto.InternalMessageInfo
func (m *CreateRequest) GetService() *Service {
if m != nil {
return m.Service
}
return nil
}
type CreateResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateResponse) Reset() { *m = CreateResponse{} }
func (m *CreateResponse) String() string { return proto.CompactTextString(m) }
func (*CreateResponse) ProtoMessage() {}
func (*CreateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{2}
}
func (m *CreateResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateResponse.Unmarshal(m, b)
}
func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateResponse.Marshal(b, m, deterministic)
}
func (m *CreateResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateResponse.Merge(m, src)
}
func (m *CreateResponse) XXX_Size() int {
return xxx_messageInfo_CreateResponse.Size(m)
}
func (m *CreateResponse) XXX_DiscardUnknown() {
xxx_messageInfo_CreateResponse.DiscardUnknown(m)
}
var xxx_messageInfo_CreateResponse proto.InternalMessageInfo
type DeleteRequest struct {
Service *Service `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteRequest) ProtoMessage() {}
func (*DeleteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{3}
}
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteRequest.Unmarshal(m, b)
}
func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic)
}
func (m *DeleteRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeleteRequest.Merge(m, src)
}
func (m *DeleteRequest) XXX_Size() int {
return xxx_messageInfo_DeleteRequest.Size(m)
}
func (m *DeleteRequest) XXX_DiscardUnknown() {
xxx_messageInfo_DeleteRequest.DiscardUnknown(m)
}
var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo
func (m *DeleteRequest) GetService() *Service {
if m != nil {
return m.Service
}
return nil
}
type DeleteResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{4}
}
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteResponse.Unmarshal(m, b)
}
func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic)
}
func (m *DeleteResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeleteResponse.Merge(m, src)
}
func (m *DeleteResponse) XXX_Size() int {
return xxx_messageInfo_DeleteResponse.Size(m)
}
func (m *DeleteResponse) XXX_DiscardUnknown() {
xxx_messageInfo_DeleteResponse.DiscardUnknown(m)
}
var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*Service)(nil), "go.micro.runtime.Service")
proto.RegisterType((*CreateRequest)(nil), "go.micro.runtime.CreateRequest")
proto.RegisterType((*CreateResponse)(nil), "go.micro.runtime.CreateResponse")
proto.RegisterType((*DeleteRequest)(nil), "go.micro.runtime.DeleteRequest")
proto.RegisterType((*DeleteResponse)(nil), "go.micro.runtime.DeleteResponse")
}
func init() { proto.RegisterFile("runtime.proto", fileDescriptor_86e2dd377c869464) }
var fileDescriptor_86e2dd377c869464 = []byte{
// 229 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x91, 0xbf, 0x4e, 0x86, 0x30,
0x14, 0xc5, 0x41, 0x08, 0xc4, 0x6b, 0x30, 0xa4, 0x83, 0xa9, 0x2e, 0x92, 0x4e, 0x4e, 0x1d, 0xe0,
0x11, 0x64, 0x75, 0xa9, 0xb3, 0x03, 0x36, 0x37, 0x4a, 0x22, 0x14, 0xdb, 0x62, 0x7c, 0x23, 0x5f,
0xd3, 0xf4, 0x0f, 0x03, 0xca, 0x37, 0x7d, 0xdb, 0xe9, 0xc9, 0xc9, 0xef, 0x9c, 0x9b, 0x42, 0xa5,
0xd7, 0xd9, 0x8e, 0x13, 0xf2, 0x45, 0x2b, 0xab, 0x48, 0xfd, 0xa6, 0xf8, 0x34, 0x4a, 0xad, 0x78,
0xf4, 0xd9, 0x0b, 0x94, 0xcf, 0xa8, 0xbf, 0x46, 0x89, 0x84, 0x40, 0x3e, 0x0f, 0x13, 0xd2, 0xb4,
0x49, 0x1f, 0x2e, 0x85, 0xd7, 0xe4, 0x06, 0x0a, 0xa3, 0x56, 0x2d, 0x91, 0x5e, 0x78, 0x37, 0xbe,
0x5c, 0x76, 0x19, 0xec, 0x3b, 0xcd, 0x42, 0xd6, 0x69, 0xe7, 0xe1, 0x37, 0x4a, 0x9a, 0x37, 0x99,
0xf3, 0x9c, 0x66, 0x3d, 0x54, 0x8f, 0x1a, 0x07, 0x8b, 0x02, 0x3f, 0x57, 0x34, 0x96, 0x74, 0x50,
0x9a, 0xd0, 0xe7, 0x7b, 0xae, 0xda, 0x5b, 0xfe, 0x77, 0x13, 0x8f, 0x83, 0xc4, 0x96, 0x64, 0x35,
0x5c, 0x6f, 0x14, 0xb3, 0xa8, 0xd9, 0xa0, 0xe3, 0xf6, 0xf8, 0x81, 0xe7, 0x73, 0x37, 0x4a, 0xe0,
0xb6, 0x3f, 0x29, 0x94, 0x22, 0xc4, 0xc9, 0x13, 0x14, 0xa1, 0x95, 0xdc, 0xff, 0x67, 0xed, 0xae,
0xba, 0x6b, 0x4e, 0x07, 0xe2, 0xe0, 0xc4, 0xe1, 0x42, 0xd9, 0x11, 0x6e, 0x77, 0xcc, 0x11, 0x6e,
0xbf, 0x93, 0x25, 0xaf, 0x85, 0xff, 0xd1, 0xee, 0x37, 0x00, 0x00, 0xff, 0xff, 0x99, 0xc5, 0x97,
0x12, 0xe2, 0x01, 0x00, 0x00,
}

View File

@ -1,31 +0,0 @@
syntax = "proto3";
package go.micro.runtime;
service Runtime {
rpc Create(CreateRequest) returns (CreateResponse) {};
rpc Delete(DeleteRequest) returns (DeleteResponse) {};
}
message Service {
// name of the service
string name = 1;
// git url of the source
string source = 2;
// local path of the source
string path = 3;
// command to execute
repeated string exec = 4;
}
message CreateRequest {
Service service = 1;
}
message CreateResponse {}
message DeleteRequest {
Service service = 1;
}
message DeleteResponse {}

View File

@ -16,8 +16,8 @@ type Runtime interface {
Init(...Option) error Init(...Option) error
// Create registers a service // Create registers a service
Create(*Service, ...CreateOption) error Create(*Service, ...CreateOption) error
// Get returns service or fails with error // Read returns the service
Get(string, ...GetOption) ([]*Service, error) Read(string, ...ReadOption) ([]*Service, error)
// Update the service in place // Update the service in place
Update(*Service) error Update(*Service) error
// Remove a service // Remove a service

View File

@ -54,8 +54,8 @@ func toCreateOptions(opts *pb.CreateOptions) []runtime.CreateOption {
return options return options
} }
func toGetOptions(opts *pb.GetOptions) []runtime.GetOption { func toReadOptions(opts *pb.ReadOptions) []runtime.ReadOption {
options := []runtime.GetOption{} options := []runtime.ReadOption{}
// version options // version options
if len(opts.Version) > 0 { if len(opts.Version) > 0 {
options = append(options, runtime.WithVersion(opts.Version)) options = append(options, runtime.WithVersion(opts.Version))
@ -83,17 +83,17 @@ func (r *Runtime) Create(ctx context.Context, req *pb.CreateRequest, rsp *pb.Cre
return nil return nil
} }
func (r *Runtime) Get(ctx context.Context, req *pb.GetRequest, rsp *pb.GetResponse) error { func (r *Runtime) Read(ctx context.Context, req *pb.ReadRequest, rsp *pb.ReadResponse) error {
if len(req.Name) == 0 { if len(req.Name) == 0 {
return errors.BadRequest("go.micro.runtime", "blank service") return errors.BadRequest("go.micro.runtime", "blank service")
} }
var options []runtime.GetOption var options []runtime.ReadOption
if req.Options != nil { if req.Options != nil {
options = toGetOptions(req.Options) options = toReadOptions(req.Options)
} }
services, err := r.Runtime.Get(req.Name, options...) services, err := r.Runtime.Read(req.Name, options...)
if err != nil { if err != nil {
return errors.InternalServerError("go.micro.runtime", err.Error()) return errors.InternalServerError("go.micro.runtime", err.Error())
} }

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: runtime.proto // source: micro/go-micro/runtime/service/proto/runtime.proto
package go_micro_runtime package go_micro_runtime
@ -42,7 +42,7 @@ func (m *Service) Reset() { *m = Service{} }
func (m *Service) String() string { return proto.CompactTextString(m) } func (m *Service) String() string { return proto.CompactTextString(m) }
func (*Service) ProtoMessage() {} func (*Service) ProtoMessage() {}
func (*Service) Descriptor() ([]byte, []int) { func (*Service) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{0} return fileDescriptor_4bc91a8efec81434, []int{0}
} }
func (m *Service) XXX_Unmarshal(b []byte) error { func (m *Service) XXX_Unmarshal(b []byte) error {
@ -121,7 +121,7 @@ func (m *CreateOptions) Reset() { *m = CreateOptions{} }
func (m *CreateOptions) String() string { return proto.CompactTextString(m) } func (m *CreateOptions) String() string { return proto.CompactTextString(m) }
func (*CreateOptions) ProtoMessage() {} func (*CreateOptions) ProtoMessage() {}
func (*CreateOptions) Descriptor() ([]byte, []int) { func (*CreateOptions) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{1} return fileDescriptor_4bc91a8efec81434, []int{1}
} }
func (m *CreateOptions) XXX_Unmarshal(b []byte) error { func (m *CreateOptions) XXX_Unmarshal(b []byte) error {
@ -175,7 +175,7 @@ func (m *CreateRequest) Reset() { *m = CreateRequest{} }
func (m *CreateRequest) String() string { return proto.CompactTextString(m) } func (m *CreateRequest) String() string { return proto.CompactTextString(m) }
func (*CreateRequest) ProtoMessage() {} func (*CreateRequest) ProtoMessage() {}
func (*CreateRequest) Descriptor() ([]byte, []int) { func (*CreateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{2} return fileDescriptor_4bc91a8efec81434, []int{2}
} }
func (m *CreateRequest) XXX_Unmarshal(b []byte) error { func (m *CreateRequest) XXX_Unmarshal(b []byte) error {
@ -220,7 +220,7 @@ func (m *CreateResponse) Reset() { *m = CreateResponse{} }
func (m *CreateResponse) String() string { return proto.CompactTextString(m) } func (m *CreateResponse) String() string { return proto.CompactTextString(m) }
func (*CreateResponse) ProtoMessage() {} func (*CreateResponse) ProtoMessage() {}
func (*CreateResponse) Descriptor() ([]byte, []int) { func (*CreateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{3} return fileDescriptor_4bc91a8efec81434, []int{3}
} }
func (m *CreateResponse) XXX_Unmarshal(b []byte) error { func (m *CreateResponse) XXX_Unmarshal(b []byte) error {
@ -241,7 +241,7 @@ func (m *CreateResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_CreateResponse proto.InternalMessageInfo var xxx_messageInfo_CreateResponse proto.InternalMessageInfo
type GetOptions struct { type ReadOptions struct {
// version of the service // version of the service
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -249,118 +249,118 @@ type GetOptions struct {
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *GetOptions) Reset() { *m = GetOptions{} } func (m *ReadOptions) Reset() { *m = ReadOptions{} }
func (m *GetOptions) String() string { return proto.CompactTextString(m) } func (m *ReadOptions) String() string { return proto.CompactTextString(m) }
func (*GetOptions) ProtoMessage() {} func (*ReadOptions) ProtoMessage() {}
func (*GetOptions) Descriptor() ([]byte, []int) { func (*ReadOptions) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{4} return fileDescriptor_4bc91a8efec81434, []int{4}
} }
func (m *GetOptions) XXX_Unmarshal(b []byte) error { func (m *ReadOptions) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetOptions.Unmarshal(m, b) return xxx_messageInfo_ReadOptions.Unmarshal(m, b)
} }
func (m *GetOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *ReadOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetOptions.Marshal(b, m, deterministic) return xxx_messageInfo_ReadOptions.Marshal(b, m, deterministic)
} }
func (m *GetOptions) XXX_Merge(src proto.Message) { func (m *ReadOptions) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetOptions.Merge(m, src) xxx_messageInfo_ReadOptions.Merge(m, src)
} }
func (m *GetOptions) XXX_Size() int { func (m *ReadOptions) XXX_Size() int {
return xxx_messageInfo_GetOptions.Size(m) return xxx_messageInfo_ReadOptions.Size(m)
} }
func (m *GetOptions) XXX_DiscardUnknown() { func (m *ReadOptions) XXX_DiscardUnknown() {
xxx_messageInfo_GetOptions.DiscardUnknown(m) xxx_messageInfo_ReadOptions.DiscardUnknown(m)
} }
var xxx_messageInfo_GetOptions proto.InternalMessageInfo var xxx_messageInfo_ReadOptions proto.InternalMessageInfo
func (m *GetOptions) GetVersion() string { func (m *ReadOptions) GetVersion() string {
if m != nil { if m != nil {
return m.Version return m.Version
} }
return "" return ""
} }
type GetRequest struct { type ReadRequest struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Options *GetOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` Options *ReadOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *GetRequest) Reset() { *m = GetRequest{} } func (m *ReadRequest) Reset() { *m = ReadRequest{} }
func (m *GetRequest) String() string { return proto.CompactTextString(m) } func (m *ReadRequest) String() string { return proto.CompactTextString(m) }
func (*GetRequest) ProtoMessage() {} func (*ReadRequest) ProtoMessage() {}
func (*GetRequest) Descriptor() ([]byte, []int) { func (*ReadRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{5} return fileDescriptor_4bc91a8efec81434, []int{5}
} }
func (m *GetRequest) XXX_Unmarshal(b []byte) error { func (m *ReadRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetRequest.Unmarshal(m, b) return xxx_messageInfo_ReadRequest.Unmarshal(m, b)
} }
func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *ReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic) return xxx_messageInfo_ReadRequest.Marshal(b, m, deterministic)
} }
func (m *GetRequest) XXX_Merge(src proto.Message) { func (m *ReadRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetRequest.Merge(m, src) xxx_messageInfo_ReadRequest.Merge(m, src)
} }
func (m *GetRequest) XXX_Size() int { func (m *ReadRequest) XXX_Size() int {
return xxx_messageInfo_GetRequest.Size(m) return xxx_messageInfo_ReadRequest.Size(m)
} }
func (m *GetRequest) XXX_DiscardUnknown() { func (m *ReadRequest) XXX_DiscardUnknown() {
xxx_messageInfo_GetRequest.DiscardUnknown(m) xxx_messageInfo_ReadRequest.DiscardUnknown(m)
} }
var xxx_messageInfo_GetRequest proto.InternalMessageInfo var xxx_messageInfo_ReadRequest proto.InternalMessageInfo
func (m *GetRequest) GetName() string { func (m *ReadRequest) GetName() string {
if m != nil { if m != nil {
return m.Name return m.Name
} }
return "" return ""
} }
func (m *GetRequest) GetOptions() *GetOptions { func (m *ReadRequest) GetOptions() *ReadOptions {
if m != nil { if m != nil {
return m.Options return m.Options
} }
return nil return nil
} }
type GetResponse struct { type ReadResponse struct {
Services []*Service `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"` Services []*Service `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
} }
func (m *GetResponse) Reset() { *m = GetResponse{} } func (m *ReadResponse) Reset() { *m = ReadResponse{} }
func (m *GetResponse) String() string { return proto.CompactTextString(m) } func (m *ReadResponse) String() string { return proto.CompactTextString(m) }
func (*GetResponse) ProtoMessage() {} func (*ReadResponse) ProtoMessage() {}
func (*GetResponse) Descriptor() ([]byte, []int) { func (*ReadResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{6} return fileDescriptor_4bc91a8efec81434, []int{6}
} }
func (m *GetResponse) XXX_Unmarshal(b []byte) error { func (m *ReadResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetResponse.Unmarshal(m, b) return xxx_messageInfo_ReadResponse.Unmarshal(m, b)
} }
func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *ReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_GetResponse.Marshal(b, m, deterministic) return xxx_messageInfo_ReadResponse.Marshal(b, m, deterministic)
} }
func (m *GetResponse) XXX_Merge(src proto.Message) { func (m *ReadResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_GetResponse.Merge(m, src) xxx_messageInfo_ReadResponse.Merge(m, src)
} }
func (m *GetResponse) XXX_Size() int { func (m *ReadResponse) XXX_Size() int {
return xxx_messageInfo_GetResponse.Size(m) return xxx_messageInfo_ReadResponse.Size(m)
} }
func (m *GetResponse) XXX_DiscardUnknown() { func (m *ReadResponse) XXX_DiscardUnknown() {
xxx_messageInfo_GetResponse.DiscardUnknown(m) xxx_messageInfo_ReadResponse.DiscardUnknown(m)
} }
var xxx_messageInfo_GetResponse proto.InternalMessageInfo var xxx_messageInfo_ReadResponse proto.InternalMessageInfo
func (m *GetResponse) GetServices() []*Service { func (m *ReadResponse) GetServices() []*Service {
if m != nil { if m != nil {
return m.Services return m.Services
} }
@ -378,7 +378,7 @@ func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteRequest) ProtoMessage() {} func (*DeleteRequest) ProtoMessage() {}
func (*DeleteRequest) Descriptor() ([]byte, []int) { func (*DeleteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{7} return fileDescriptor_4bc91a8efec81434, []int{7}
} }
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
@ -416,7 +416,7 @@ func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) { func (*DeleteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{8} return fileDescriptor_4bc91a8efec81434, []int{8}
} }
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
@ -448,7 +448,7 @@ func (m *UpdateRequest) Reset() { *m = UpdateRequest{} }
func (m *UpdateRequest) String() string { return proto.CompactTextString(m) } func (m *UpdateRequest) String() string { return proto.CompactTextString(m) }
func (*UpdateRequest) ProtoMessage() {} func (*UpdateRequest) ProtoMessage() {}
func (*UpdateRequest) Descriptor() ([]byte, []int) { func (*UpdateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{9} return fileDescriptor_4bc91a8efec81434, []int{9}
} }
func (m *UpdateRequest) XXX_Unmarshal(b []byte) error { func (m *UpdateRequest) XXX_Unmarshal(b []byte) error {
@ -486,7 +486,7 @@ func (m *UpdateResponse) Reset() { *m = UpdateResponse{} }
func (m *UpdateResponse) String() string { return proto.CompactTextString(m) } func (m *UpdateResponse) String() string { return proto.CompactTextString(m) }
func (*UpdateResponse) ProtoMessage() {} func (*UpdateResponse) ProtoMessage() {}
func (*UpdateResponse) Descriptor() ([]byte, []int) { func (*UpdateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{10} return fileDescriptor_4bc91a8efec81434, []int{10}
} }
func (m *UpdateResponse) XXX_Unmarshal(b []byte) error { func (m *UpdateResponse) XXX_Unmarshal(b []byte) error {
@ -517,7 +517,7 @@ func (m *ListRequest) Reset() { *m = ListRequest{} }
func (m *ListRequest) String() string { return proto.CompactTextString(m) } func (m *ListRequest) String() string { return proto.CompactTextString(m) }
func (*ListRequest) ProtoMessage() {} func (*ListRequest) ProtoMessage() {}
func (*ListRequest) Descriptor() ([]byte, []int) { func (*ListRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{11} return fileDescriptor_4bc91a8efec81434, []int{11}
} }
func (m *ListRequest) XXX_Unmarshal(b []byte) error { func (m *ListRequest) XXX_Unmarshal(b []byte) error {
@ -549,7 +549,7 @@ func (m *ListResponse) Reset() { *m = ListResponse{} }
func (m *ListResponse) String() string { return proto.CompactTextString(m) } func (m *ListResponse) String() string { return proto.CompactTextString(m) }
func (*ListResponse) ProtoMessage() {} func (*ListResponse) ProtoMessage() {}
func (*ListResponse) Descriptor() ([]byte, []int) { func (*ListResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_86e2dd377c869464, []int{12} return fileDescriptor_4bc91a8efec81434, []int{12}
} }
func (m *ListResponse) XXX_Unmarshal(b []byte) error { func (m *ListResponse) XXX_Unmarshal(b []byte) error {
@ -583,9 +583,9 @@ func init() {
proto.RegisterType((*CreateOptions)(nil), "go.micro.runtime.CreateOptions") proto.RegisterType((*CreateOptions)(nil), "go.micro.runtime.CreateOptions")
proto.RegisterType((*CreateRequest)(nil), "go.micro.runtime.CreateRequest") proto.RegisterType((*CreateRequest)(nil), "go.micro.runtime.CreateRequest")
proto.RegisterType((*CreateResponse)(nil), "go.micro.runtime.CreateResponse") proto.RegisterType((*CreateResponse)(nil), "go.micro.runtime.CreateResponse")
proto.RegisterType((*GetOptions)(nil), "go.micro.runtime.GetOptions") proto.RegisterType((*ReadOptions)(nil), "go.micro.runtime.ReadOptions")
proto.RegisterType((*GetRequest)(nil), "go.micro.runtime.GetRequest") proto.RegisterType((*ReadRequest)(nil), "go.micro.runtime.ReadRequest")
proto.RegisterType((*GetResponse)(nil), "go.micro.runtime.GetResponse") proto.RegisterType((*ReadResponse)(nil), "go.micro.runtime.ReadResponse")
proto.RegisterType((*DeleteRequest)(nil), "go.micro.runtime.DeleteRequest") proto.RegisterType((*DeleteRequest)(nil), "go.micro.runtime.DeleteRequest")
proto.RegisterType((*DeleteResponse)(nil), "go.micro.runtime.DeleteResponse") proto.RegisterType((*DeleteResponse)(nil), "go.micro.runtime.DeleteResponse")
proto.RegisterType((*UpdateRequest)(nil), "go.micro.runtime.UpdateRequest") proto.RegisterType((*UpdateRequest)(nil), "go.micro.runtime.UpdateRequest")
@ -594,39 +594,42 @@ func init() {
proto.RegisterType((*ListResponse)(nil), "go.micro.runtime.ListResponse") proto.RegisterType((*ListResponse)(nil), "go.micro.runtime.ListResponse")
} }
func init() { proto.RegisterFile("runtime.proto", fileDescriptor_86e2dd377c869464) } func init() {
proto.RegisterFile("micro/go-micro/runtime/service/proto/runtime.proto", fileDescriptor_4bc91a8efec81434)
var fileDescriptor_86e2dd377c869464 = []byte{ }
// 485 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcb, 0x6f, 0x94, 0x40, var fileDescriptor_4bc91a8efec81434 = []byte{
0x18, 0x2f, 0xcb, 0x16, 0xea, 0x87, 0x98, 0xcd, 0xc4, 0x98, 0x71, 0xe3, 0x63, 0xc3, 0x41, 0x7b, // 498 bytes of a gzipped FileDescriptorProto
0xe2, 0xb0, 0x8d, 0xc6, 0xc7, 0xb1, 0x34, 0x7b, 0x71, 0x63, 0x42, 0x63, 0xe2, 0x75, 0x64, 0xbf, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4b, 0x6f, 0xd3, 0x40,
0x28, 0xb1, 0x30, 0xc8, 0x0c, 0x1b, 0x7b, 0xf2, 0xe4, 0x1f, 0xed, 0xcd, 0xcc, 0x6b, 0xdb, 0xa5, 0x10, 0xae, 0xe3, 0xd4, 0x2e, 0x63, 0x8c, 0xa2, 0x15, 0x42, 0x4b, 0x25, 0x20, 0xf2, 0xa5, 0xbd,
0xd0, 0xcb, 0xde, 0xbe, 0x17, 0x3f, 0x7e, 0x0f, 0x02, 0xc4, 0x6d, 0x57, 0xcb, 0xb2, 0xc2, 0xb4, 0xe0, 0x48, 0xae, 0x10, 0xaf, 0x63, 0x53, 0x71, 0x21, 0x42, 0x72, 0xc5, 0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f2, 0x26, 0xa3, 0x6f,
0x48, 0x8e, 0xc8, 0x0a, 0xa6, 0x2a, 0x05, 0x32, 0x20, 0xe3, 0x56, 0x58, 0xf3, 0x17, 0x63, 0x6b, 0xc4, 0x7e, 0xfd, 0x74, 0x3e, 0xbe, 0x60, 0xe9, 0x1e, 0x91, 0x0f, 0x30, 0x55, 0x39, 0x91, 0x91,
0x07, 0xf4, 0x2d, 0xd0, 0xbf, 0xd4, 0xb3, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0xce, 0x6e, 0x5c, 0x1d, 0xd4, 0xf3, 0xb1, 0xe3, 0x2d, 0xd0, 0x0a, 0x02, 0xe3, 0xf1, 0x10, 0xaf, 0xbd, 0x0c,
0x31, 0x63, 0x05, 0x00, 0x00, 0x87, 0x78, 0xf5, 0xe2, 0xd1, 0x70, 0xc6, 0xda, 0x21, 0xb8, 0xbd, 0xe8, 0x86, 0xe0, 0x7a, 0xa9,
0x68, 0x99, 0x2a, 0x88, 0x21, 0x99, 0x3b, 0x79, 0x0d, 0xc9, 0xdc, 0xcd, 0x2f, 0x39, 0xfa, 0x1a,
0xe8, 0x3f, 0xeb, 0xc5, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x95, 0xdf, 0xf9, 0x8f, 0x05,
0x00, 0x00,
} }

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-micro. DO NOT EDIT. // Code generated by protoc-gen-micro. DO NOT EDIT.
// source: runtime.proto // source: micro/go-micro/runtime/service/proto/runtime.proto
package go_micro_runtime package go_micro_runtime
@ -35,7 +35,7 @@ var _ server.Option
type RuntimeService interface { type RuntimeService interface {
Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
Get(ctx context.Context, in *GetRequest, opts ...client.CallOption) (*GetResponse, error) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
@ -69,9 +69,9 @@ func (c *runtimeService) Create(ctx context.Context, in *CreateRequest, opts ...
return out, nil return out, nil
} }
func (c *runtimeService) Get(ctx context.Context, in *GetRequest, opts ...client.CallOption) (*GetResponse, error) { func (c *runtimeService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
req := c.c.NewRequest(c.name, "Runtime.Get", in) req := c.c.NewRequest(c.name, "Runtime.Read", in)
out := new(GetResponse) out := new(ReadResponse)
err := c.c.Call(ctx, req, out, opts...) err := c.c.Call(ctx, req, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -113,7 +113,7 @@ func (c *runtimeService) List(ctx context.Context, in *ListRequest, opts ...clie
type RuntimeHandler interface { type RuntimeHandler interface {
Create(context.Context, *CreateRequest, *CreateResponse) error Create(context.Context, *CreateRequest, *CreateResponse) error
Get(context.Context, *GetRequest, *GetResponse) error Read(context.Context, *ReadRequest, *ReadResponse) error
Delete(context.Context, *DeleteRequest, *DeleteResponse) error Delete(context.Context, *DeleteRequest, *DeleteResponse) error
Update(context.Context, *UpdateRequest, *UpdateResponse) error Update(context.Context, *UpdateRequest, *UpdateResponse) error
List(context.Context, *ListRequest, *ListResponse) error List(context.Context, *ListRequest, *ListResponse) error
@ -122,7 +122,7 @@ type RuntimeHandler interface {
func RegisterRuntimeHandler(s server.Server, hdlr RuntimeHandler, opts ...server.HandlerOption) error { func RegisterRuntimeHandler(s server.Server, hdlr RuntimeHandler, opts ...server.HandlerOption) error {
type runtime interface { type runtime interface {
Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
Get(ctx context.Context, in *GetRequest, out *GetResponse) error Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
List(ctx context.Context, in *ListRequest, out *ListResponse) error List(ctx context.Context, in *ListRequest, out *ListResponse) error
@ -142,8 +142,8 @@ func (h *runtimeHandler) Create(ctx context.Context, in *CreateRequest, out *Cre
return h.RuntimeHandler.Create(ctx, in, out) return h.RuntimeHandler.Create(ctx, in, out)
} }
func (h *runtimeHandler) Get(ctx context.Context, in *GetRequest, out *GetResponse) error { func (h *runtimeHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
return h.RuntimeHandler.Get(ctx, in, out) return h.RuntimeHandler.Read(ctx, in, out)
} }
func (h *runtimeHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error { func (h *runtimeHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {

View File

@ -4,7 +4,7 @@ package go.micro.runtime;
service Runtime { service Runtime {
rpc Create(CreateRequest) returns (CreateResponse) {}; rpc Create(CreateRequest) returns (CreateResponse) {};
rpc Get(GetRequest) returns (GetResponse) {}; rpc Read(ReadRequest) returns (ReadResponse) {};
rpc Delete(DeleteRequest) returns (DeleteResponse) {}; rpc Delete(DeleteRequest) returns (DeleteResponse) {};
rpc Update(UpdateRequest) returns (UpdateResponse) {}; rpc Update(UpdateRequest) returns (UpdateResponse) {};
rpc List(ListRequest) returns (ListResponse) {}; rpc List(ListRequest) returns (ListResponse) {};
@ -41,17 +41,17 @@ message CreateRequest {
message CreateResponse {} message CreateResponse {}
message GetOptions { message ReadOptions {
// version of the service // version of the service
string version = 2; string version = 2;
} }
message GetRequest { message ReadRequest {
string name = 1; string name = 1;
GetOptions options = 2; ReadOptions options = 2;
} }
message GetResponse { message ReadResponse {
repeated Service services = 1; repeated Service services = 1;
} }

View File

@ -75,23 +75,23 @@ func (s *svc) Create(svc *runtime.Service, opts ...runtime.CreateOption) error {
return nil return nil
} }
// Get returns the service with the given name from the runtime // Read returns the service with the given name from the runtime
func (s *svc) Get(name string, opts ...runtime.GetOption) ([]*runtime.Service, error) { func (s *svc) Read(name string, opts ...runtime.ReadOption) ([]*runtime.Service, error) {
options := runtime.GetOptions{} options := runtime.ReadOptions{}
// apply requested options // apply requested options
for _, o := range opts { for _, o := range opts {
o(&options) o(&options)
} }
// runtime service create request // runtime service create request
req := &pb.GetRequest{ req := &pb.ReadRequest{
Name: name, Name: name,
Options: &pb.GetOptions{ Options: &pb.ReadOptions{
Version: options.Version, Version: options.Version,
}, },
} }
resp, err := s.runtime.Get(context.Background(), req) resp, err := s.runtime.Read(context.Background(), req)
if err != nil { if err != nil {
return nil, err return nil, err
} }