v3 refactor (#1868)
* Move to v3 Co-authored-by: Ben Toogood <bentoogood@gmail.com>
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
# cli Source
|
||||
|
||||
The cli source reads config from parsed flags via a cli.Context.
|
||||
|
||||
## Format
|
||||
|
||||
We expect the use of the `micro/cli` package. Upper case flags will be lower cased. Dashes will be used as delimiters for nesting.
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
micro.Flags(
|
||||
cli.StringFlag{
|
||||
Name: "database-address",
|
||||
Value: "127.0.0.1",
|
||||
Usage: "the db address",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "database-port",
|
||||
Value: 3306,
|
||||
Usage: "the db port",
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
Becomes
|
||||
|
||||
```json
|
||||
{
|
||||
"database": {
|
||||
"address": "127.0.0.1",
|
||||
"port": 3306
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## New and Load Source
|
||||
|
||||
Because a cli.Context is needed to retrieve the flags and their values, it is recommended to build your source from within a cli.Action.
|
||||
|
||||
```go
|
||||
|
||||
func main() {
|
||||
// New Service
|
||||
service := micro.NewService(
|
||||
micro.Name("example"),
|
||||
micro.Flags(
|
||||
cli.StringFlag{
|
||||
Name: "database-address",
|
||||
Value: "127.0.0.1",
|
||||
Usage: "the db address",
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
var clisrc source.Source
|
||||
|
||||
service.Init(
|
||||
micro.Action(func(c *cli.Context) {
|
||||
clisrc = cli.NewSource(
|
||||
cli.Context(c),
|
||||
)
|
||||
// Alternatively, just setup your config right here
|
||||
}),
|
||||
)
|
||||
|
||||
// ... Load and use that source ...
|
||||
conf := config.NewConfig()
|
||||
conf.Load(clisrc)
|
||||
}
|
||||
```
|
@@ -1,145 +0,0 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/micro/go-micro/v2/cmd"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
)
|
||||
|
||||
type cliSource struct {
|
||||
opts source.Options
|
||||
ctx *cli.Context
|
||||
}
|
||||
|
||||
func (c *cliSource) Read() (*source.ChangeSet, error) {
|
||||
var changes map[string]interface{}
|
||||
|
||||
// directly using app cli flags, to access default values of not specified options
|
||||
for _, f := range c.ctx.App.Flags {
|
||||
name := f.Names()[0]
|
||||
tmp := toEntry(name, c.ctx.Generic(name))
|
||||
mergo.Map(&changes, tmp) // need to sort error handling
|
||||
}
|
||||
|
||||
b, err := c.opts.Encoder.Encode(changes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cs := &source.ChangeSet{
|
||||
Format: c.opts.Encoder.String(),
|
||||
Data: b,
|
||||
Timestamp: time.Now(),
|
||||
Source: c.String(),
|
||||
}
|
||||
cs.Checksum = cs.Sum()
|
||||
|
||||
return cs, nil
|
||||
}
|
||||
|
||||
func toEntry(name string, v interface{}) map[string]interface{} {
|
||||
n := strings.ToLower(name)
|
||||
keys := strings.FieldsFunc(n, split)
|
||||
reverse(keys)
|
||||
tmp := make(map[string]interface{})
|
||||
for i, k := range keys {
|
||||
if i == 0 {
|
||||
tmp[k] = v
|
||||
continue
|
||||
}
|
||||
|
||||
tmp = map[string]interface{}{k: tmp}
|
||||
}
|
||||
return tmp
|
||||
}
|
||||
|
||||
func reverse(ss []string) {
|
||||
for i := len(ss)/2 - 1; i >= 0; i-- {
|
||||
opp := len(ss) - 1 - i
|
||||
ss[i], ss[opp] = ss[opp], ss[i]
|
||||
}
|
||||
}
|
||||
|
||||
func split(r rune) bool {
|
||||
return r == '-' || r == '_'
|
||||
}
|
||||
|
||||
func (c *cliSource) Watch() (source.Watcher, error) {
|
||||
return source.NewNoopWatcher()
|
||||
}
|
||||
|
||||
// Write is unsupported
|
||||
func (c *cliSource) Write(cs *source.ChangeSet) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *cliSource) String() string {
|
||||
return "cli"
|
||||
}
|
||||
|
||||
// NewSource returns a config source for integrating parsed flags from a micro/cli.Context.
|
||||
// Hyphens are delimiters for nesting, and all keys are lowercased. The assumption is that
|
||||
// command line flags have already been parsed.
|
||||
//
|
||||
// Example:
|
||||
// cli.StringFlag{Name: "db-host"},
|
||||
//
|
||||
//
|
||||
// {
|
||||
// "database": {
|
||||
// "host": "localhost"
|
||||
// }
|
||||
// }
|
||||
func NewSource(opts ...source.Option) source.Source {
|
||||
options := source.NewOptions(opts...)
|
||||
|
||||
var ctx *cli.Context
|
||||
|
||||
if c, ok := options.Context.Value(contextKey{}).(*cli.Context); ok {
|
||||
ctx = c
|
||||
} else {
|
||||
// no context
|
||||
// get the default app/flags
|
||||
app := cmd.App()
|
||||
flags := app.Flags
|
||||
|
||||
// create flagset
|
||||
set := flag.NewFlagSet(app.Name, flag.ContinueOnError)
|
||||
|
||||
// apply flags to set
|
||||
for _, f := range flags {
|
||||
f.Apply(set)
|
||||
}
|
||||
|
||||
// parse flags
|
||||
set.SetOutput(ioutil.Discard)
|
||||
set.Parse(os.Args[1:])
|
||||
|
||||
// normalise flags
|
||||
normalizeFlags(app.Flags, set)
|
||||
|
||||
// create context
|
||||
ctx = cli.NewContext(app, set, nil)
|
||||
}
|
||||
|
||||
return &cliSource{
|
||||
ctx: ctx,
|
||||
opts: options,
|
||||
}
|
||||
}
|
||||
|
||||
// WithContext returns a new source with the context specified.
|
||||
// The assumption is that Context is retrieved within an app.Action function.
|
||||
func WithContext(ctx *cli.Context, opts ...source.Option) source.Source {
|
||||
return &cliSource{
|
||||
ctx: ctx,
|
||||
opts: source.NewOptions(opts...),
|
||||
}
|
||||
}
|
@@ -1,115 +0,0 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/micro/go-micro/v2"
|
||||
"github.com/micro/go-micro/v2/cmd"
|
||||
"github.com/micro/go-micro/v2/config"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
)
|
||||
|
||||
func TestCliSourceDefault(t *testing.T) {
|
||||
const expVal string = "flagvalue"
|
||||
|
||||
service := micro.NewService(
|
||||
micro.Flags(
|
||||
// to be able to run inside go test
|
||||
&cli.StringFlag{
|
||||
Name: "test.timeout",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "test.v",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "test.run",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "test.testlogfile",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "flag",
|
||||
Usage: "It changes something",
|
||||
EnvVars: []string{"flag"},
|
||||
Value: expVal,
|
||||
},
|
||||
),
|
||||
)
|
||||
var cliSrc source.Source
|
||||
service.Init(
|
||||
// Loads CLI configuration
|
||||
micro.Action(func(c *cli.Context) error {
|
||||
cliSrc = NewSource(
|
||||
Context(c),
|
||||
)
|
||||
return nil
|
||||
}),
|
||||
)
|
||||
|
||||
config.Load(cliSrc)
|
||||
if fval := config.Get("flag").String("default"); fval != expVal {
|
||||
t.Fatalf("default flag value not loaded %v != %v", fval, expVal)
|
||||
}
|
||||
}
|
||||
|
||||
func test(t *testing.T, withContext bool) {
|
||||
var src source.Source
|
||||
|
||||
// setup app
|
||||
app := cmd.App()
|
||||
app.Name = "testapp"
|
||||
app.Flags = []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "db-host",
|
||||
EnvVars: []string{"db-host"},
|
||||
Value: "myval",
|
||||
},
|
||||
}
|
||||
|
||||
// with context
|
||||
if withContext {
|
||||
// set action
|
||||
app.Action = func(c *cli.Context) error {
|
||||
src = WithContext(c)
|
||||
return nil
|
||||
}
|
||||
|
||||
// run app
|
||||
app.Run([]string{"run", "-db-host", "localhost"})
|
||||
// no context
|
||||
} else {
|
||||
// set args
|
||||
os.Args = []string{"run", "-db-host", "localhost"}
|
||||
src = NewSource()
|
||||
}
|
||||
|
||||
// test config
|
||||
c, err := src.Read()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
var actual map[string]interface{}
|
||||
if err := json.Unmarshal(c.Data, &actual); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
actualDB := actual["db"].(map[string]interface{})
|
||||
if actualDB["host"] != "localhost" {
|
||||
t.Errorf("expected localhost, got %v", actualDB["name"])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestCliSource(t *testing.T) {
|
||||
// without context
|
||||
test(t, false)
|
||||
}
|
||||
|
||||
func TestCliSourceWithContext(t *testing.T) {
|
||||
// with context
|
||||
test(t, true)
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
)
|
||||
|
||||
type contextKey struct{}
|
||||
|
||||
// Context sets the cli context
|
||||
func Context(c *cli.Context) source.Option {
|
||||
return func(o *source.Options) {
|
||||
if o.Context == nil {
|
||||
o.Context = context.Background()
|
||||
}
|
||||
o.Context = context.WithValue(o.Context, contextKey{}, c)
|
||||
}
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"strings"
|
||||
|
||||
"github.com/micro/cli/v2"
|
||||
)
|
||||
|
||||
func copyFlag(name string, ff *flag.Flag, set *flag.FlagSet) {
|
||||
switch ff.Value.(type) {
|
||||
case *cli.StringSlice:
|
||||
default:
|
||||
set.Set(name, ff.Value.String())
|
||||
}
|
||||
}
|
||||
|
||||
func normalizeFlags(flags []cli.Flag, set *flag.FlagSet) error {
|
||||
visited := make(map[string]bool)
|
||||
set.Visit(func(f *flag.Flag) {
|
||||
visited[f.Name] = true
|
||||
})
|
||||
for _, f := range flags {
|
||||
parts := f.Names()
|
||||
if len(parts) == 1 {
|
||||
continue
|
||||
}
|
||||
var ff *flag.Flag
|
||||
for _, name := range parts {
|
||||
name = strings.Trim(name, " ")
|
||||
if visited[name] {
|
||||
if ff != nil {
|
||||
return errors.New("Cannot use two forms of the same flag: " + name + " " + ff.Name)
|
||||
}
|
||||
ff = set.Lookup(name)
|
||||
}
|
||||
}
|
||||
if ff == nil {
|
||||
continue
|
||||
}
|
||||
for _, name := range parts {
|
||||
name = strings.Trim(name, " ")
|
||||
if !visited[name] {
|
||||
copyFlag(name, ff, set)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
2
config/source/env/env.go
vendored
2
config/source/env/env.go
vendored
@@ -7,7 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
var (
|
||||
|
2
config/source/env/env_test.go
vendored
2
config/source/env/env_test.go
vendored
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
func TestEnv_Read(t *testing.T) {
|
||||
|
2
config/source/env/options.go
vendored
2
config/source/env/options.go
vendored
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"strings"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type strippedPrefixKey struct{}
|
||||
|
2
config/source/env/watcher.go
vendored
2
config/source/env/watcher.go
vendored
@@ -1,7 +1,7 @@
|
||||
package env
|
||||
|
||||
import (
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type watcher struct {
|
||||
|
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
cetcd "github.com/coreos/etcd/clientv3"
|
||||
"github.com/coreos/etcd/mvcc/mvccpb"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
// Currently a single etcd reader
|
||||
|
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type addressKey struct{}
|
||||
|
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/coreos/etcd/clientv3"
|
||||
"github.com/coreos/etcd/mvcc/mvccpb"
|
||||
"github.com/micro/go-micro/v2/config/encoder"
|
||||
"github.com/micro/go-micro/v3/config/encoder"
|
||||
)
|
||||
|
||||
func makeEvMap(e encoder.Encoder, data map[string]interface{}, kv []*clientv3.Event, stripPrefix string) map[string]interface{} {
|
||||
|
@@ -7,7 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
cetcd "github.com/coreos/etcd/clientv3"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type watcher struct {
|
||||
|
@@ -5,7 +5,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type file struct {
|
||||
|
@@ -7,8 +7,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/v2/config"
|
||||
"github.com/micro/go-micro/v2/config/source/file"
|
||||
"github.com/micro/go-micro/v3/config"
|
||||
"github.com/micro/go-micro/v3/config/source/file"
|
||||
)
|
||||
|
||||
func TestConfig(t *testing.T) {
|
||||
|
@@ -3,7 +3,7 @@ package file
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/encoder"
|
||||
"github.com/micro/go-micro/v3/config/encoder"
|
||||
)
|
||||
|
||||
func format(p string, e encoder.Encoder) string {
|
||||
|
@@ -3,7 +3,7 @@ package file
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
func TestFormat(t *testing.T) {
|
||||
|
@@ -3,7 +3,7 @@ package file
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type filePathKey struct{}
|
||||
|
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type watcher struct {
|
||||
|
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type watcher struct {
|
||||
|
@@ -4,7 +4,7 @@ import (
|
||||
"errors"
|
||||
"flag"
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
@@ -3,7 +3,7 @@ package flag
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type includeUnsetKey struct{}
|
||||
|
@@ -6,7 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type memory struct {
|
||||
|
@@ -3,7 +3,7 @@ package memory
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type changeSetKey struct{}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
"github.com/micro/go-micro/v3/config/source"
|
||||
)
|
||||
|
||||
type watcher struct {
|
||||
|
@@ -3,9 +3,9 @@ package source
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/micro/go-micro/v2/client"
|
||||
"github.com/micro/go-micro/v2/config/encoder"
|
||||
"github.com/micro/go-micro/v2/config/encoder/json"
|
||||
"github.com/micro/go-micro/v3/client"
|
||||
"github.com/micro/go-micro/v3/config/encoder"
|
||||
"github.com/micro/go-micro/v3/config/encoder/json"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
@@ -25,7 +25,6 @@ func NewOptions(opts ...Option) Options {
|
||||
options := Options{
|
||||
Encoder: json.NewEncoder(),
|
||||
Context: context.Background(),
|
||||
Client: client.DefaultClient,
|
||||
}
|
||||
|
||||
for _, o := range opts {
|
||||
|
@@ -1,38 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
)
|
||||
|
||||
type serviceNameKey struct{}
|
||||
type namespaceKey struct{}
|
||||
type pathKey struct{}
|
||||
|
||||
func ServiceName(name string) source.Option {
|
||||
return func(o *source.Options) {
|
||||
if o.Context == nil {
|
||||
o.Context = context.Background()
|
||||
}
|
||||
o.Context = context.WithValue(o.Context, serviceNameKey{}, name)
|
||||
}
|
||||
}
|
||||
|
||||
func Namespace(namespace string) source.Option {
|
||||
return func(o *source.Options) {
|
||||
if o.Context == nil {
|
||||
o.Context = context.Background()
|
||||
}
|
||||
o.Context = context.WithValue(o.Context, namespaceKey{}, namespace)
|
||||
}
|
||||
}
|
||||
|
||||
func Path(path string) source.Option {
|
||||
return func(o *source.Options) {
|
||||
if o.Context == nil {
|
||||
o.Context = context.Background()
|
||||
}
|
||||
o.Context = context.WithValue(o.Context, pathKey{}, path)
|
||||
}
|
||||
}
|
@@ -1,960 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: config/source/service/proto/service.proto
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
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 ChangeSet struct {
|
||||
Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||
Checksum string `protobuf:"bytes,2,opt,name=checksum,proto3" json:"checksum,omitempty"`
|
||||
Format string `protobuf:"bytes,3,opt,name=format,proto3" json:"format,omitempty"`
|
||||
Source string `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"`
|
||||
Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ChangeSet) Reset() { *m = ChangeSet{} }
|
||||
func (m *ChangeSet) String() string { return proto.CompactTextString(m) }
|
||||
func (*ChangeSet) ProtoMessage() {}
|
||||
func (*ChangeSet) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e67338fe1f659d14, []int{0}
|
||||
}
|
||||
|
||||
func (m *ChangeSet) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ChangeSet.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ChangeSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ChangeSet.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ChangeSet) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ChangeSet.Merge(m, src)
|
||||
}
|
||||
func (m *ChangeSet) XXX_Size() int {
|
||||
return xxx_messageInfo_ChangeSet.Size(m)
|
||||
}
|
||||
func (m *ChangeSet) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ChangeSet.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ChangeSet proto.InternalMessageInfo
|
||||
|
||||
func (m *ChangeSet) GetData() string {
|
||||
if m != nil {
|
||||
return m.Data
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ChangeSet) GetChecksum() string {
|
||||
if m != nil {
|
||||
return m.Checksum
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ChangeSet) GetFormat() string {
|
||||
if m != nil {
|
||||
return m.Format
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ChangeSet) GetSource() string {
|
||||
if m != nil {
|
||||
return m.Source
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ChangeSet) GetTimestamp() int64 {
|
||||
if m != nil {
|
||||
return m.Timestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Change struct {
|
||||
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
|
||||
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
|
||||
ChangeSet *ChangeSet `protobuf:"bytes,3,opt,name=changeSet,proto3" json:"changeSet,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Change) Reset() { *m = Change{} }
|
||||
func (m *Change) String() string { return proto.CompactTextString(m) }
|
||||
func (*Change) ProtoMessage() {}
|
||||
func (*Change) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e67338fe1f659d14, []int{1}
|
||||
}
|
||||
|
||||
func (m *Change) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Change.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Change) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Change.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Change) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Change.Merge(m, src)
|
||||
}
|
||||
func (m *Change) XXX_Size() int {
|
||||
return xxx_messageInfo_Change.Size(m)
|
||||
}
|
||||
func (m *Change) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Change.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Change proto.InternalMessageInfo
|
||||
|
||||
func (m *Change) GetNamespace() string {
|
||||
if m != nil {
|
||||
return m.Namespace
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Change) GetPath() string {
|
||||
if m != nil {
|
||||
return m.Path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Change) GetChangeSet() *ChangeSet {
|
||||
if m != nil {
|
||||
return m.ChangeSet
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateRequest struct {
|
||||
Change *Change `protobuf:"bytes,1,opt,name=change,proto3" json:"change,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_e67338fe1f659d14, []int{2}
|
||||
}
|
||||
|
||||
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) GetChange() *Change {
|
||||
if m != nil {
|
||||
return m.Change
|
||||
}
|
||||
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_e67338fe1f659d14, []int{3}
|
||||
}
|
||||
|
||||
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 UpdateRequest struct {
|
||||
Change *Change `protobuf:"bytes,1,opt,name=change,proto3" json:"change,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UpdateRequest) Reset() { *m = UpdateRequest{} }
|
||||
func (m *UpdateRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*UpdateRequest) ProtoMessage() {}
|
||||
func (*UpdateRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e67338fe1f659d14, []int{4}
|
||||
}
|
||||
|
||||
func (m *UpdateRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UpdateRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UpdateRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *UpdateRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UpdateRequest.Merge(m, src)
|
||||
}
|
||||
func (m *UpdateRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_UpdateRequest.Size(m)
|
||||
}
|
||||
func (m *UpdateRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UpdateRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UpdateRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *UpdateRequest) GetChange() *Change {
|
||||
if m != nil {
|
||||
return m.Change
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateResponse struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *UpdateResponse) Reset() { *m = UpdateResponse{} }
|
||||
func (m *UpdateResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*UpdateResponse) ProtoMessage() {}
|
||||
func (*UpdateResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e67338fe1f659d14, []int{5}
|
||||
}
|
||||
|
||||
func (m *UpdateResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_UpdateResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *UpdateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_UpdateResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *UpdateResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_UpdateResponse.Merge(m, src)
|
||||
}
|
||||
func (m *UpdateResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_UpdateResponse.Size(m)
|
||||
}
|
||||
func (m *UpdateResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_UpdateResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_UpdateResponse proto.InternalMessageInfo
|
||||
|
||||
type DeleteRequest struct {
|
||||
Change *Change `protobuf:"bytes,1,opt,name=change,proto3" json:"change,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_e67338fe1f659d14, []int{6}
|
||||
}
|
||||
|
||||
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) GetChange() *Change {
|
||||
if m != nil {
|
||||
return m.Change
|
||||
}
|
||||
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_e67338fe1f659d14, []int{7}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
type ListRequest struct {
|
||||
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListRequest) Reset() { *m = ListRequest{} }
|
||||
func (m *ListRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListRequest) ProtoMessage() {}
|
||||
func (*ListRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e67338fe1f659d14, []int{8}
|
||||
}
|
||||
|
||||
func (m *ListRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ListRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListRequest.Merge(m, src)
|
||||
}
|
||||
func (m *ListRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_ListRequest.Size(m)
|
||||
}
|
||||
func (m *ListRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ListRequest) GetNamespace() string {
|
||||
if m != nil {
|
||||
return m.Namespace
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ListResponse struct {
|
||||
Values []*Change `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ListResponse) Reset() { *m = ListResponse{} }
|
||||
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListResponse) ProtoMessage() {}
|
||||
func (*ListResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e67338fe1f659d14, []int{9}
|
||||
}
|
||||
|
||||
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ListResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ListResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ListResponse.Merge(m, src)
|
||||
}
|
||||
func (m *ListResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_ListResponse.Size(m)
|
||||
}
|
||||
func (m *ListResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ListResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ListResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *ListResponse) GetValues() []*Change {
|
||||
if m != nil {
|
||||
return m.Values
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ReadRequest struct {
|
||||
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
|
||||
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ReadRequest) Reset() { *m = ReadRequest{} }
|
||||
func (m *ReadRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReadRequest) ProtoMessage() {}
|
||||
func (*ReadRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e67338fe1f659d14, []int{10}
|
||||
}
|
||||
|
||||
func (m *ReadRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ReadRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ReadRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ReadRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ReadRequest.Merge(m, src)
|
||||
}
|
||||
func (m *ReadRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_ReadRequest.Size(m)
|
||||
}
|
||||
func (m *ReadRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ReadRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ReadRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ReadRequest) GetNamespace() string {
|
||||
if m != nil {
|
||||
return m.Namespace
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ReadRequest) GetPath() string {
|
||||
if m != nil {
|
||||
return m.Path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ReadResponse struct {
|
||||
Change *Change `protobuf:"bytes,1,opt,name=change,proto3" json:"change,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ReadResponse) Reset() { *m = ReadResponse{} }
|
||||
func (m *ReadResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReadResponse) ProtoMessage() {}
|
||||
func (*ReadResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e67338fe1f659d14, []int{11}
|
||||
}
|
||||
|
||||
func (m *ReadResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ReadResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ReadResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *ReadResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ReadResponse.Merge(m, src)
|
||||
}
|
||||
func (m *ReadResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_ReadResponse.Size(m)
|
||||
}
|
||||
func (m *ReadResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ReadResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ReadResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *ReadResponse) GetChange() *Change {
|
||||
if m != nil {
|
||||
return m.Change
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type WatchRequest struct {
|
||||
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
|
||||
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *WatchRequest) Reset() { *m = WatchRequest{} }
|
||||
func (m *WatchRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*WatchRequest) ProtoMessage() {}
|
||||
func (*WatchRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e67338fe1f659d14, []int{12}
|
||||
}
|
||||
|
||||
func (m *WatchRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_WatchRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *WatchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_WatchRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *WatchRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_WatchRequest.Merge(m, src)
|
||||
}
|
||||
func (m *WatchRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_WatchRequest.Size(m)
|
||||
}
|
||||
func (m *WatchRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_WatchRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_WatchRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *WatchRequest) GetNamespace() string {
|
||||
if m != nil {
|
||||
return m.Namespace
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *WatchRequest) GetPath() string {
|
||||
if m != nil {
|
||||
return m.Path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type WatchResponse struct {
|
||||
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
|
||||
ChangeSet *ChangeSet `protobuf:"bytes,2,opt,name=changeSet,proto3" json:"changeSet,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *WatchResponse) Reset() { *m = WatchResponse{} }
|
||||
func (m *WatchResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*WatchResponse) ProtoMessage() {}
|
||||
func (*WatchResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_e67338fe1f659d14, []int{13}
|
||||
}
|
||||
|
||||
func (m *WatchResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_WatchResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *WatchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_WatchResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *WatchResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_WatchResponse.Merge(m, src)
|
||||
}
|
||||
func (m *WatchResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_WatchResponse.Size(m)
|
||||
}
|
||||
func (m *WatchResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_WatchResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_WatchResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *WatchResponse) GetNamespace() string {
|
||||
if m != nil {
|
||||
return m.Namespace
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *WatchResponse) GetChangeSet() *ChangeSet {
|
||||
if m != nil {
|
||||
return m.ChangeSet
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ChangeSet)(nil), "ChangeSet")
|
||||
proto.RegisterType((*Change)(nil), "Change")
|
||||
proto.RegisterType((*CreateRequest)(nil), "CreateRequest")
|
||||
proto.RegisterType((*CreateResponse)(nil), "CreateResponse")
|
||||
proto.RegisterType((*UpdateRequest)(nil), "UpdateRequest")
|
||||
proto.RegisterType((*UpdateResponse)(nil), "UpdateResponse")
|
||||
proto.RegisterType((*DeleteRequest)(nil), "DeleteRequest")
|
||||
proto.RegisterType((*DeleteResponse)(nil), "DeleteResponse")
|
||||
proto.RegisterType((*ListRequest)(nil), "ListRequest")
|
||||
proto.RegisterType((*ListResponse)(nil), "ListResponse")
|
||||
proto.RegisterType((*ReadRequest)(nil), "ReadRequest")
|
||||
proto.RegisterType((*ReadResponse)(nil), "ReadResponse")
|
||||
proto.RegisterType((*WatchRequest)(nil), "WatchRequest")
|
||||
proto.RegisterType((*WatchResponse)(nil), "WatchResponse")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("config/source/service/proto/service.proto", fileDescriptor_e67338fe1f659d14)
|
||||
}
|
||||
|
||||
var fileDescriptor_e67338fe1f659d14 = []byte{
|
||||
// 440 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6b, 0xdb, 0x40,
|
||||
0x10, 0xb5, 0x6c, 0x47, 0xad, 0xc7, 0x96, 0x5c, 0xe6, 0x50, 0x84, 0x28, 0xd4, 0x2c, 0x14, 0xdc,
|
||||
0x06, 0xd6, 0xc1, 0xfd, 0x01, 0x2d, 0xb8, 0xc7, 0x9e, 0x54, 0x4a, 0xce, 0xdb, 0xf5, 0x24, 0x36,
|
||||
0x8d, 0x2c, 0x55, 0xbb, 0xca, 0x7f, 0xc8, 0xbf, 0x2e, 0xfb, 0xa1, 0x48, 0x32, 0x45, 0xd4, 0xb9,
|
||||
0x69, 0xde, 0xce, 0xbc, 0x37, 0xbb, 0xef, 0xd9, 0xf0, 0x51, 0x16, 0xa7, 0xbb, 0xe3, 0xfd, 0x46,
|
||||
0x15, 0x75, 0x25, 0x69, 0xa3, 0xa8, 0x7a, 0x3c, 0x4a, 0xda, 0x94, 0x55, 0xa1, 0x8b, 0xa6, 0xe2,
|
||||
0xb6, 0x62, 0x4f, 0x01, 0xcc, 0x76, 0x07, 0x71, 0xba, 0xa7, 0x1f, 0xa4, 0x11, 0x61, 0xba, 0x17,
|
||||
0x5a, 0x24, 0xc1, 0x2a, 0x58, 0xcf, 0x32, 0xfb, 0x8d, 0x29, 0xbc, 0x96, 0x07, 0x92, 0xbf, 0x55,
|
||||
0x9d, 0x27, 0x63, 0x8b, 0x3f, 0xd7, 0xf8, 0x16, 0xc2, 0xbb, 0xa2, 0xca, 0x85, 0x4e, 0x26, 0xf6,
|
||||
0xc4, 0x57, 0x06, 0x77, 0xda, 0xc9, 0xd4, 0xe1, 0xae, 0xc2, 0x77, 0x30, 0xd3, 0xc7, 0x9c, 0x94,
|
||||
0x16, 0x79, 0x99, 0x5c, 0xad, 0x82, 0xf5, 0x24, 0x6b, 0x01, 0xb6, 0x87, 0xd0, 0xad, 0x62, 0xfa,
|
||||
0x4e, 0x22, 0x27, 0x55, 0x0a, 0x49, 0x7e, 0x99, 0x16, 0x30, 0x5b, 0x96, 0x42, 0x1f, 0xfc, 0x36,
|
||||
0xf6, 0x1b, 0xd7, 0x30, 0x93, 0xcd, 0x35, 0xec, 0x32, 0xf3, 0x2d, 0xf0, 0xe7, 0x8b, 0x65, 0xed,
|
||||
0x21, 0xbb, 0x81, 0x68, 0x57, 0x91, 0xd0, 0x94, 0xd1, 0x9f, 0x9a, 0x94, 0xc6, 0xf7, 0x10, 0xba,
|
||||
0x53, 0xab, 0x34, 0xdf, 0xbe, 0xf2, 0x73, 0x99, 0x87, 0xd9, 0x1b, 0x88, 0x9b, 0x09, 0x55, 0x16,
|
||||
0x27, 0x45, 0x86, 0xe3, 0x67, 0xb9, 0xbf, 0x90, 0xa3, 0x99, 0x68, 0x39, 0xbe, 0xd1, 0x03, 0x5d,
|
||||
0xc6, 0xd1, 0x4c, 0x78, 0x8e, 0x6b, 0x98, 0x7f, 0x3f, 0x2a, 0xdd, 0x30, 0x0c, 0x3e, 0x1b, 0xdb,
|
||||
0xc0, 0xc2, 0x35, 0xbb, 0x61, 0xa3, 0xf7, 0x28, 0x1e, 0x6a, 0x52, 0x49, 0xb0, 0x9a, 0xf4, 0xf4,
|
||||
0x1c, 0xcc, 0xbe, 0xc0, 0x3c, 0x23, 0xb1, 0xff, 0x2f, 0xf6, 0x7f, 0x99, 0x62, 0x14, 0x1d, 0x41,
|
||||
0xab, 0x38, 0x7c, 0xc3, 0xaf, 0xb0, 0xb8, 0x15, 0x5a, 0x1e, 0x5e, 0x2e, 0x79, 0x0b, 0x91, 0x67,
|
||||
0xf0, 0x9a, 0xc3, 0x14, 0xbd, 0xd8, 0x8c, 0x07, 0x62, 0xb3, 0x7d, 0x1a, 0x43, 0xb8, 0xb3, 0x3f,
|
||||
0x2b, 0xbc, 0x86, 0xd0, 0xe5, 0x01, 0x63, 0xde, 0x8b, 0x52, 0xba, 0xe4, 0x67, 0x41, 0x19, 0x99,
|
||||
0x66, 0x67, 0x3c, 0xc6, 0xbc, 0x97, 0x99, 0x74, 0xc9, 0xcf, 0x12, 0x61, 0x9b, 0x9d, 0xc3, 0x18,
|
||||
0xf3, 0x5e, 0x38, 0xd2, 0x25, 0x3f, 0xb3, 0x7e, 0x84, 0x1f, 0x60, 0x6a, 0xfc, 0xc4, 0x05, 0xef,
|
||||
0x64, 0x20, 0x8d, 0x78, 0xd7, 0x64, 0xd7, 0x66, 0x4c, 0xc0, 0x05, 0xef, 0x98, 0x99, 0x46, 0xbc,
|
||||
0xeb, 0x0c, 0x1b, 0xe1, 0x27, 0xb8, 0xb2, 0x0f, 0x87, 0x11, 0xef, 0x5a, 0x90, 0xc6, 0xbc, 0xf7,
|
||||
0x9e, 0x6c, 0x74, 0x13, 0xfc, 0x0a, 0xed, 0x7f, 0xc7, 0xe7, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff,
|
||||
0xb7, 0x06, 0x45, 0x6a, 0x68, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// ConfigClient is the client API for Config service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type ConfigClient interface {
|
||||
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
|
||||
Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error)
|
||||
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
|
||||
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
|
||||
Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error)
|
||||
Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (Config_WatchClient, error)
|
||||
}
|
||||
|
||||
type configClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewConfigClient(cc *grpc.ClientConn) ConfigClient {
|
||||
return &configClient{cc}
|
||||
}
|
||||
|
||||
func (c *configClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) {
|
||||
out := new(CreateResponse)
|
||||
err := c.cc.Invoke(ctx, "/Config/Create", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configClient) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error) {
|
||||
out := new(UpdateResponse)
|
||||
err := c.cc.Invoke(ctx, "/Config/Update", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) {
|
||||
out := new(DeleteResponse)
|
||||
err := c.cc.Invoke(ctx, "/Config/Delete", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) {
|
||||
out := new(ListResponse)
|
||||
err := c.cc.Invoke(ctx, "/Config/List", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) {
|
||||
out := new(ReadResponse)
|
||||
err := c.cc.Invoke(ctx, "/Config/Read", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configClient) Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (Config_WatchClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &_Config_serviceDesc.Streams[0], "/Config/Watch", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &configWatchClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type Config_WatchClient interface {
|
||||
Recv() (*WatchResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type configWatchClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *configWatchClient) Recv() (*WatchResponse, error) {
|
||||
m := new(WatchResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// ConfigServer is the server API for Config service.
|
||||
type ConfigServer interface {
|
||||
Create(context.Context, *CreateRequest) (*CreateResponse, error)
|
||||
Update(context.Context, *UpdateRequest) (*UpdateResponse, error)
|
||||
Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
|
||||
List(context.Context, *ListRequest) (*ListResponse, error)
|
||||
Read(context.Context, *ReadRequest) (*ReadResponse, error)
|
||||
Watch(*WatchRequest, Config_WatchServer) error
|
||||
}
|
||||
|
||||
// UnimplementedConfigServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedConfigServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedConfigServer) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (*UnimplementedConfigServer) Update(ctx context.Context, req *UpdateRequest) (*UpdateResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
|
||||
}
|
||||
func (*UnimplementedConfigServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
|
||||
}
|
||||
func (*UnimplementedConfigServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
|
||||
}
|
||||
func (*UnimplementedConfigServer) Read(ctx context.Context, req *ReadRequest) (*ReadResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Read not implemented")
|
||||
}
|
||||
func (*UnimplementedConfigServer) Watch(req *WatchRequest, srv Config_WatchServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method Watch not implemented")
|
||||
}
|
||||
|
||||
func RegisterConfigServer(s *grpc.Server, srv ConfigServer) {
|
||||
s.RegisterService(&_Config_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Config_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConfigServer).Create(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Config/Create",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConfigServer).Create(ctx, req.(*CreateRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Config_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConfigServer).Update(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Config/Update",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConfigServer).Update(ctx, req.(*UpdateRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Config_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConfigServer).Delete(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Config/Delete",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConfigServer).Delete(ctx, req.(*DeleteRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Config_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConfigServer).List(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Config/List",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConfigServer).List(ctx, req.(*ListRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Config_Read_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ReadRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ConfigServer).Read(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Config/Read",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ConfigServer).Read(ctx, req.(*ReadRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Config_Watch_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(WatchRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(ConfigServer).Watch(m, &configWatchServer{stream})
|
||||
}
|
||||
|
||||
type Config_WatchServer interface {
|
||||
Send(*WatchResponse) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type configWatchServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *configWatchServer) Send(m *WatchResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
var _Config_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "Config",
|
||||
HandlerType: (*ConfigServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Create",
|
||||
Handler: _Config_Create_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Update",
|
||||
Handler: _Config_Update_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Delete",
|
||||
Handler: _Config_Delete_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "List",
|
||||
Handler: _Config_List_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Read",
|
||||
Handler: _Config_Read_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "Watch",
|
||||
Handler: _Config_Watch_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "config/source/service/proto/service.proto",
|
||||
}
|
@@ -1,253 +0,0 @@
|
||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||
// source: config/source/service/proto/service.proto
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
math "math"
|
||||
)
|
||||
|
||||
import (
|
||||
context "context"
|
||||
api "github.com/micro/go-micro/v2/api"
|
||||
client "github.com/micro/go-micro/v2/client"
|
||||
server "github.com/micro/go-micro/v2/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 _ api.Endpoint
|
||||
var _ context.Context
|
||||
var _ client.Option
|
||||
var _ server.Option
|
||||
|
||||
// Api Endpoints for Config service
|
||||
|
||||
func NewConfigEndpoints() []*api.Endpoint {
|
||||
return []*api.Endpoint{}
|
||||
}
|
||||
|
||||
// Client API for Config service
|
||||
|
||||
type ConfigService interface {
|
||||
Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
|
||||
Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
|
||||
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
|
||||
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
|
||||
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
|
||||
Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Config_WatchService, error)
|
||||
}
|
||||
|
||||
type configService struct {
|
||||
c client.Client
|
||||
name string
|
||||
}
|
||||
|
||||
func NewConfigService(name string, c client.Client) ConfigService {
|
||||
return &configService{
|
||||
c: c,
|
||||
name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *configService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Config.Create", in)
|
||||
out := new(CreateResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Config.Update", in)
|
||||
out := new(UpdateResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Config.Delete", in)
|
||||
out := new(DeleteResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Config.List", in)
|
||||
out := new(ListResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Config.Read", in)
|
||||
out := new(ReadResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *configService) Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Config_WatchService, error) {
|
||||
req := c.c.NewRequest(c.name, "Config.Watch", &WatchRequest{})
|
||||
stream, err := c.c.Stream(ctx, req, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := stream.Send(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &configServiceWatch{stream}, nil
|
||||
}
|
||||
|
||||
type Config_WatchService interface {
|
||||
Context() context.Context
|
||||
SendMsg(interface{}) error
|
||||
RecvMsg(interface{}) error
|
||||
Close() error
|
||||
Recv() (*WatchResponse, error)
|
||||
}
|
||||
|
||||
type configServiceWatch struct {
|
||||
stream client.Stream
|
||||
}
|
||||
|
||||
func (x *configServiceWatch) Close() error {
|
||||
return x.stream.Close()
|
||||
}
|
||||
|
||||
func (x *configServiceWatch) Context() context.Context {
|
||||
return x.stream.Context()
|
||||
}
|
||||
|
||||
func (x *configServiceWatch) SendMsg(m interface{}) error {
|
||||
return x.stream.Send(m)
|
||||
}
|
||||
|
||||
func (x *configServiceWatch) RecvMsg(m interface{}) error {
|
||||
return x.stream.Recv(m)
|
||||
}
|
||||
|
||||
func (x *configServiceWatch) Recv() (*WatchResponse, error) {
|
||||
m := new(WatchResponse)
|
||||
err := x.stream.Recv(m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for Config service
|
||||
|
||||
type ConfigHandler interface {
|
||||
Create(context.Context, *CreateRequest, *CreateResponse) error
|
||||
Update(context.Context, *UpdateRequest, *UpdateResponse) error
|
||||
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
|
||||
List(context.Context, *ListRequest, *ListResponse) error
|
||||
Read(context.Context, *ReadRequest, *ReadResponse) error
|
||||
Watch(context.Context, *WatchRequest, Config_WatchStream) error
|
||||
}
|
||||
|
||||
func RegisterConfigHandler(s server.Server, hdlr ConfigHandler, opts ...server.HandlerOption) error {
|
||||
type config interface {
|
||||
Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
|
||||
Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
|
||||
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
|
||||
List(ctx context.Context, in *ListRequest, out *ListResponse) error
|
||||
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
|
||||
Watch(ctx context.Context, stream server.Stream) error
|
||||
}
|
||||
type Config struct {
|
||||
config
|
||||
}
|
||||
h := &configHandler{hdlr}
|
||||
return s.Handle(s.NewHandler(&Config{h}, opts...))
|
||||
}
|
||||
|
||||
type configHandler struct {
|
||||
ConfigHandler
|
||||
}
|
||||
|
||||
func (h *configHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
|
||||
return h.ConfigHandler.Create(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *configHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
|
||||
return h.ConfigHandler.Update(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *configHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
|
||||
return h.ConfigHandler.Delete(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *configHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
||||
return h.ConfigHandler.List(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *configHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
|
||||
return h.ConfigHandler.Read(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *configHandler) Watch(ctx context.Context, stream server.Stream) error {
|
||||
m := new(WatchRequest)
|
||||
if err := stream.Recv(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return h.ConfigHandler.Watch(ctx, m, &configWatchStream{stream})
|
||||
}
|
||||
|
||||
type Config_WatchStream interface {
|
||||
Context() context.Context
|
||||
SendMsg(interface{}) error
|
||||
RecvMsg(interface{}) error
|
||||
Close() error
|
||||
Send(*WatchResponse) error
|
||||
}
|
||||
|
||||
type configWatchStream struct {
|
||||
stream server.Stream
|
||||
}
|
||||
|
||||
func (x *configWatchStream) Close() error {
|
||||
return x.stream.Close()
|
||||
}
|
||||
|
||||
func (x *configWatchStream) Context() context.Context {
|
||||
return x.stream.Context()
|
||||
}
|
||||
|
||||
func (x *configWatchStream) SendMsg(m interface{}) error {
|
||||
return x.stream.Send(m)
|
||||
}
|
||||
|
||||
func (x *configWatchStream) RecvMsg(m interface{}) error {
|
||||
return x.stream.Recv(m)
|
||||
}
|
||||
|
||||
func (x *configWatchStream) Send(m *WatchResponse) error {
|
||||
return x.stream.Send(m)
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
service Config {
|
||||
rpc Create (CreateRequest) returns (CreateResponse) {}
|
||||
rpc Update (UpdateRequest) returns (UpdateResponse) {}
|
||||
rpc Delete (DeleteRequest) returns (DeleteResponse) {}
|
||||
rpc List (ListRequest) returns (ListResponse) {}
|
||||
rpc Read (ReadRequest) returns (ReadResponse) {}
|
||||
rpc Watch (WatchRequest) returns (stream WatchResponse) {}
|
||||
}
|
||||
|
||||
message ChangeSet {
|
||||
string data = 1;
|
||||
string checksum = 2;
|
||||
string format = 3;
|
||||
string source = 4;
|
||||
int64 timestamp = 5;
|
||||
}
|
||||
|
||||
message Change {
|
||||
string namespace = 1;
|
||||
string path = 2;
|
||||
ChangeSet changeSet = 3;
|
||||
}
|
||||
|
||||
message CreateRequest {
|
||||
Change change = 1;
|
||||
}
|
||||
|
||||
message CreateResponse {}
|
||||
|
||||
message UpdateRequest {
|
||||
Change change = 1;
|
||||
}
|
||||
|
||||
message UpdateResponse {}
|
||||
|
||||
message DeleteRequest {
|
||||
Change change = 1;
|
||||
}
|
||||
|
||||
message DeleteResponse {}
|
||||
|
||||
message ListRequest {
|
||||
string namespace = 1;
|
||||
}
|
||||
|
||||
message ListResponse {
|
||||
repeated Change values = 1;
|
||||
}
|
||||
|
||||
message ReadRequest {
|
||||
string namespace = 1;
|
||||
string path = 2;
|
||||
}
|
||||
|
||||
message ReadResponse {
|
||||
Change change = 1;
|
||||
}
|
||||
|
||||
message WatchRequest {
|
||||
string namespace = 1;
|
||||
string path = 2;
|
||||
}
|
||||
|
||||
message WatchResponse {
|
||||
string namespace = 1;
|
||||
ChangeSet changeSet = 2;
|
||||
}
|
@@ -1,106 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/micro/go-micro/v2/client"
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
proto "github.com/micro/go-micro/v2/config/source/service/proto"
|
||||
"github.com/micro/go-micro/v2/errors"
|
||||
"github.com/micro/go-micro/v2/logger"
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultName = "go.micro.config"
|
||||
DefaultNamespace = "micro"
|
||||
DefaultPath = ""
|
||||
)
|
||||
|
||||
type service struct {
|
||||
serviceName string
|
||||
namespace string
|
||||
path string
|
||||
opts source.Options
|
||||
client proto.ConfigService
|
||||
}
|
||||
|
||||
func (m *service) Read() (set *source.ChangeSet, err error) {
|
||||
client := proto.NewConfigService(m.serviceName, m.opts.Client)
|
||||
req, err := client.Read(context.Background(), &proto.ReadRequest{
|
||||
Namespace: m.namespace,
|
||||
Path: m.path,
|
||||
})
|
||||
if verr, ok := err.(*errors.Error); ok && verr.Code == http.StatusNotFound {
|
||||
return nil, nil
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return toChangeSet(req.Change.ChangeSet), nil
|
||||
}
|
||||
|
||||
func (m *service) Watch() (w source.Watcher, err error) {
|
||||
client := proto.NewConfigService(m.serviceName, m.opts.Client)
|
||||
stream, err := client.Watch(context.Background(), &proto.WatchRequest{
|
||||
Namespace: m.namespace,
|
||||
Path: m.path,
|
||||
})
|
||||
if err != nil {
|
||||
if logger.V(logger.ErrorLevel, logger.DefaultLogger) {
|
||||
logger.Error("watch err: ", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
return newWatcher(stream)
|
||||
}
|
||||
|
||||
// Write is unsupported
|
||||
func (m *service) Write(cs *source.ChangeSet) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *service) String() string {
|
||||
return "service"
|
||||
}
|
||||
|
||||
func NewSource(opts ...source.Option) source.Source {
|
||||
var options source.Options
|
||||
for _, o := range opts {
|
||||
o(&options)
|
||||
}
|
||||
|
||||
addr := DefaultName
|
||||
namespace := DefaultNamespace
|
||||
path := DefaultPath
|
||||
|
||||
if options.Context != nil {
|
||||
a, ok := options.Context.Value(serviceNameKey{}).(string)
|
||||
if ok {
|
||||
addr = a
|
||||
}
|
||||
|
||||
k, ok := options.Context.Value(namespaceKey{}).(string)
|
||||
if ok {
|
||||
namespace = k
|
||||
}
|
||||
|
||||
p, ok := options.Context.Value(pathKey{}).(string)
|
||||
if ok {
|
||||
path = p
|
||||
}
|
||||
}
|
||||
|
||||
if options.Client == nil {
|
||||
options.Client = client.DefaultClient
|
||||
}
|
||||
|
||||
s := &service{
|
||||
serviceName: addr,
|
||||
opts: options,
|
||||
namespace: namespace,
|
||||
path: path,
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
proto "github.com/micro/go-micro/v2/config/source/service/proto"
|
||||
)
|
||||
|
||||
func toChangeSet(c *proto.ChangeSet) *source.ChangeSet {
|
||||
return &source.ChangeSet{
|
||||
Data: []byte(c.Data),
|
||||
Checksum: c.Checksum,
|
||||
Format: c.Format,
|
||||
Timestamp: time.Unix(c.Timestamp, 0),
|
||||
Source: c.Source,
|
||||
}
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"github.com/micro/go-micro/v2/config/source"
|
||||
proto "github.com/micro/go-micro/v2/config/source/service/proto"
|
||||
)
|
||||
|
||||
type watcher struct {
|
||||
stream proto.Config_WatchService
|
||||
}
|
||||
|
||||
func newWatcher(stream proto.Config_WatchService) (source.Watcher, error) {
|
||||
return &watcher{stream: stream}, nil
|
||||
}
|
||||
|
||||
func (w *watcher) Next() (*source.ChangeSet, error) {
|
||||
var rsp proto.WatchResponse
|
||||
err := w.stream.RecvMsg(&rsp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return toChangeSet(rsp.ChangeSet), nil
|
||||
}
|
||||
|
||||
func (w *watcher) Stop() error {
|
||||
return w.stream.Close()
|
||||
}
|
Reference in New Issue
Block a user