mirror of
https://github.com/openziti/ziti.git
synced 2026-10-13 15:51:21 +00:00
Merge pull request openziti/fabric#482 from openziti/raft-updates
Use one port for ctrl channel to router and controllers. Allow syncin…
This commit is contained in:
@@ -20,7 +20,7 @@ jobs:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '~1.18.0'
|
||||
go-version: '~1.19.0'
|
||||
|
||||
- name: Install Ziti CI
|
||||
uses: netfoundry/ziti-ci@v1
|
||||
|
||||
@@ -9,7 +9,7 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
if: github.ref == 'refs/heads/update-dependency'
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git Checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '~1.18.0'
|
||||
go-version: '~1.19.0'
|
||||
|
||||
- name: Install Ziti CI
|
||||
uses: netfoundry/ziti-ci@v1
|
||||
|
||||
@@ -124,3 +124,20 @@ func (self *DeleteEntityCommand) Encode() ([]byte, error) {
|
||||
EntityType: self.Deleter.GetEntityTypeId(),
|
||||
})
|
||||
}
|
||||
|
||||
type SyncSnapshotCommand struct {
|
||||
SnapshotId string
|
||||
Snapshot []byte
|
||||
SnapshotSink func(cmd *SyncSnapshotCommand) error
|
||||
}
|
||||
|
||||
func (self *SyncSnapshotCommand) Apply() error {
|
||||
return self.SnapshotSink(self)
|
||||
}
|
||||
|
||||
func (self *SyncSnapshotCommand) Encode() ([]byte, error) {
|
||||
return cmd_pb.EncodeProtobuf(&cmd_pb.SyncSnapshotCommand{
|
||||
SnapshotId: self.SnapshotId,
|
||||
Snapshot: self.Snapshot,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/openziti/fabric/pb/mgmt_pb"
|
||||
"github.com/openziti/fabric/router/xgress"
|
||||
"github.com/openziti/identity"
|
||||
"github.com/openziti/storage/boltz"
|
||||
"github.com/openziti/transport/v2"
|
||||
"github.com/pkg/errors"
|
||||
"gopkg.in/yaml.v2"
|
||||
@@ -51,7 +52,7 @@ type Config struct {
|
||||
Id *identity.TokenId
|
||||
Raft *raft.Config
|
||||
Network *network.Options
|
||||
Db *db.Db
|
||||
Db boltz.Db
|
||||
Trace struct {
|
||||
Handler *channel.TraceHandler
|
||||
}
|
||||
@@ -75,7 +76,8 @@ type Config struct {
|
||||
InitialDelay time.Duration
|
||||
}
|
||||
}
|
||||
src map[interface{}]interface{}
|
||||
SyncRaftToDb bool
|
||||
src map[interface{}]interface{}
|
||||
}
|
||||
|
||||
// CtrlOptions extends channel.Options to include support for additional, non-channel specific options
|
||||
@@ -161,9 +163,6 @@ func LoadConfig(path string) (*Config, error) {
|
||||
if value, found := submap["advertiseAddress"]; found {
|
||||
controllerConfig.Raft.AdvertiseAddress = value.(string)
|
||||
}
|
||||
if value, found := submap["bindAddress"]; found {
|
||||
controllerConfig.Raft.BindAddress = value.(string)
|
||||
}
|
||||
if value, found := submap["bootstrapMembers"]; found {
|
||||
if lst, ok := value.([]interface{}); ok {
|
||||
for idx, val := range lst {
|
||||
@@ -189,6 +188,7 @@ func LoadConfig(path string) (*Config, error) {
|
||||
return nil, errors.New("invalid commandHandler value, should be map")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return nil, errors.Errorf("invalid raft configuration")
|
||||
}
|
||||
} else if value, found := cfgmap["db"]; found {
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"github.com/openziti/fabric/controller/handler_ctrl"
|
||||
"github.com/openziti/fabric/controller/network"
|
||||
"github.com/openziti/fabric/controller/raft"
|
||||
"github.com/openziti/fabric/controller/raft/mesh"
|
||||
"github.com/openziti/fabric/controller/xctrl"
|
||||
"github.com/openziti/fabric/controller/xmgmt"
|
||||
"github.com/openziti/fabric/controller/xt"
|
||||
@@ -46,6 +47,7 @@ import (
|
||||
"github.com/openziti/storage/boltz"
|
||||
"github.com/openziti/xweb/v2"
|
||||
"github.com/sirupsen/logrus"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Controller struct {
|
||||
@@ -90,6 +92,10 @@ func (c *Controller) GetCommandDispatcher() command.Dispatcher {
|
||||
return c.raftController
|
||||
}
|
||||
|
||||
func (c *Controller) IsRaftEnabled() bool {
|
||||
return c.raftController != nil
|
||||
}
|
||||
|
||||
func (c *Controller) GetDb() boltz.Db {
|
||||
return c.config.Db
|
||||
}
|
||||
@@ -107,6 +113,8 @@ func NewController(cfg *Config, versionProvider versions.VersionProvider) (*Cont
|
||||
|
||||
shutdownC := make(chan struct{})
|
||||
|
||||
log := pfxlog.Logger()
|
||||
|
||||
c := &Controller{
|
||||
config: cfg,
|
||||
shutdownC: shutdownC,
|
||||
@@ -119,8 +127,7 @@ func NewController(cfg *Config, versionProvider versions.VersionProvider) (*Cont
|
||||
if cfg.Raft != nil {
|
||||
raftController, err := raft.NewController(cfg.Id, cfg.Raft, metricRegistry)
|
||||
if err != nil {
|
||||
fmt.Printf("error starting raft %+v\n", err)
|
||||
panic(err)
|
||||
log.WithError(err).Panic("error starting raft")
|
||||
}
|
||||
|
||||
c.raftController = raftController
|
||||
@@ -135,6 +142,27 @@ func NewController(cfg *Config, versionProvider versions.VersionProvider) (*Cont
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if cfg.SyncRaftToDb {
|
||||
if c.raftController == nil {
|
||||
log.Panic("cannot sync raft to database, as raft is not configured to run")
|
||||
}
|
||||
|
||||
log.Info("waiting for raft cluster to settle before syncing raft to database")
|
||||
start := time.Now()
|
||||
for !c.raftController.IsLeader() {
|
||||
time.Sleep(time.Second)
|
||||
if time.Now().Sub(start) > time.Second*30 {
|
||||
log.Panic("cannot sync raft to database, as current node is not the leader")
|
||||
} else {
|
||||
log.Info("waiting for raft controller to become leader to allow syncing db to raft")
|
||||
}
|
||||
}
|
||||
|
||||
if err := c.network.SnapshotToRaft(); err != nil {
|
||||
log.WithError(err).Fatal("unable to sync database to raft")
|
||||
}
|
||||
}
|
||||
|
||||
c.eventDispatcher.InitializeNetworkEvents(c.network)
|
||||
|
||||
if cfg.Ctrl.Options.NewListener != nil {
|
||||
@@ -207,8 +235,22 @@ func (c *Controller) Run() error {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
ctrlAccepter := handler_ctrl.NewCtrlAccepter(c.network, c.xctrls, c.ctrlListener, c.config.Ctrl.Options.Options, c.config.Trace.Handler)
|
||||
go ctrlAccepter.Run()
|
||||
ctrlAccepter := handler_ctrl.NewCtrlAccepter(c.network, c.xctrls, c.config.Ctrl.Options.Options, c.config.Trace.Handler)
|
||||
|
||||
ctrlAcceptors := map[string]channel.UnderlayAcceptor{}
|
||||
if c.raftController != nil {
|
||||
ctrlAcceptors[mesh.ChannelTypeMesh] = c.raftController.GetMesh()
|
||||
}
|
||||
|
||||
underlayDispatcher := channel.NewUnderlayDispatcher(channel.UnderlayDispatcherConfig{
|
||||
Listener: ctrlListener,
|
||||
ConnectTimeout: c.config.Ctrl.Options.ConnectTimeout,
|
||||
TransportConfig: nil,
|
||||
Acceptors: ctrlAcceptors,
|
||||
DefaultAcceptor: ctrlAccepter,
|
||||
})
|
||||
|
||||
go underlayDispatcher.Run()
|
||||
|
||||
if err := c.config.Configure(c.xweb); err != nil {
|
||||
panic(err)
|
||||
|
||||
+11
-111
@@ -17,128 +17,28 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/openziti/storage/boltz"
|
||||
"go.etcd.io/bbolt"
|
||||
"os"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Db struct {
|
||||
db *bbolt.DB
|
||||
}
|
||||
const (
|
||||
RootBucket = "ziti"
|
||||
)
|
||||
|
||||
func Open(path string) (*Db, error) {
|
||||
// Only wait 1 second if database file can't be locked, as it most likely means another controller is running
|
||||
options := *bbolt.DefaultOptions
|
||||
options.Timeout = time.Second
|
||||
|
||||
db, err := bbolt.Open(path, 0600, &options)
|
||||
func Open(path string) (boltz.Db, error) {
|
||||
db, err := boltz.Open(path, RootBucket)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to open controller database [%s] (%s)", path, err)
|
||||
}
|
||||
|
||||
if err := db.Update(createRoots); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Db{db: db}, nil
|
||||
}
|
||||
|
||||
func (db *Db) Close() error {
|
||||
return db.db.Close()
|
||||
}
|
||||
|
||||
func (db *Db) Update(fn func(tx *bbolt.Tx) error) error {
|
||||
return db.db.Update(fn)
|
||||
}
|
||||
|
||||
func (db *Db) Batch(fn func(tx *bbolt.Tx) error) error {
|
||||
return db.db.Batch(fn)
|
||||
}
|
||||
|
||||
func (db *Db) View(fn func(tx *bbolt.Tx) error) error {
|
||||
return db.db.View(fn)
|
||||
}
|
||||
|
||||
func (db *Db) Stats() bbolt.Stats {
|
||||
return db.db.Stats()
|
||||
}
|
||||
|
||||
func (db *Db) RootBucket(tx *bbolt.Tx) (*bbolt.Bucket, error) {
|
||||
ziti := tx.Bucket([]byte("ziti"))
|
||||
if ziti == nil {
|
||||
return nil, errors.New("db missing 'ziti' root")
|
||||
}
|
||||
return ziti, nil
|
||||
}
|
||||
|
||||
func (db *Db) Snapshot(tx *bbolt.Tx) error {
|
||||
path := db.db.Path()
|
||||
path += "-" + time.Now().Format("20060102-150405")
|
||||
|
||||
_, err := os.Stat(path)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
pfxlog.Logger().Infof("bolt db backup already made: %v", path)
|
||||
return nil
|
||||
}
|
||||
|
||||
file, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0600)
|
||||
if err != nil {
|
||||
err = db.Update(func(tx *bbolt.Tx) error {
|
||||
_, err := tx.CreateBucketIfNotExists([]byte(RootBucket))
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err = file.Close(); err != nil {
|
||||
pfxlog.Logger().Errorf("failed to close backup database file %v (%v)", path, err)
|
||||
}
|
||||
}()
|
||||
})
|
||||
|
||||
_, err = tx.WriteTo(file)
|
||||
if err != nil {
|
||||
pfxlog.Logger().Infof("created bolt db backup: %v", path)
|
||||
return nil, err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func createRoots(tx *bbolt.Tx) error {
|
||||
if ziti, err := tx.CreateBucketIfNotExists([]byte("ziti")); err == nil {
|
||||
if _, err := ziti.CreateBucketIfNotExists([]byte("services")); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := ziti.CreateBucketIfNotExists([]byte("routers")); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func traceUpdateEnter(tx *bbolt.Tx, fn func(tx *bbolt.Tx) error) {
|
||||
logrus.Infof("Enter Update (tx:%d) [%s]", tx.ID(), runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())
|
||||
}
|
||||
|
||||
func traceUpdateExit(tx *bbolt.Tx, fn func(tx *bbolt.Tx) error) {
|
||||
logrus.Infof("Exit Update (tx:%d) [%s]", tx.ID(), runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())
|
||||
}
|
||||
|
||||
func traceViewEnter(tx *bbolt.Tx, fn func(tx *bbolt.Tx) error) {
|
||||
logrus.Infof("Enter View (tx:%d) [%s]", tx.ID(), runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())
|
||||
}
|
||||
|
||||
func traceViewExit(tx *bbolt.Tx, fn func(tx *bbolt.Tx) error) {
|
||||
logrus.Infof("Exit View (tx:%d) [%s]", tx.ID(), runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())
|
||||
}
|
||||
|
||||
func traceBatchEnter(tx *bbolt.Tx, fn func(tx *bbolt.Tx) error) {
|
||||
logrus.Infof("Enter Batch (tx:%d) [%s]", tx.ID(), runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())
|
||||
}
|
||||
|
||||
func traceBatchExit(tx *bbolt.Tx, fn func(tx *bbolt.Tx) error) {
|
||||
logrus.Infof("Exit Batch (tx:%d) [%s]", tx.ID(), runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())
|
||||
return db, nil
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ func newRouterStore(stores *stores) *routerStoreImpl {
|
||||
store := &routerStoreImpl{
|
||||
baseStore: baseStore{
|
||||
stores: stores,
|
||||
BaseStore: boltz.NewBaseStore(EntityTypeRouters, notFoundErrorFactory, boltz.RootBucket),
|
||||
BaseStore: boltz.NewBaseStore(EntityTypeRouters, notFoundErrorFactory, RootBucket),
|
||||
},
|
||||
}
|
||||
store.InitImpl(store)
|
||||
|
||||
@@ -86,7 +86,7 @@ func newServiceStore(stores *stores) *serviceStoreImpl {
|
||||
store := &serviceStoreImpl{
|
||||
baseStore: baseStore{
|
||||
stores: stores,
|
||||
BaseStore: boltz.NewBaseStore(EntityTypeServices, notFoundErrorFactory, boltz.RootBucket),
|
||||
BaseStore: boltz.NewBaseStore(EntityTypeServices, notFoundErrorFactory, RootBucket),
|
||||
},
|
||||
}
|
||||
store.InitImpl(store)
|
||||
|
||||
@@ -198,7 +198,7 @@ func newTerminatorStore(stores *stores) *terminatorStoreImpl {
|
||||
store := &terminatorStoreImpl{
|
||||
baseStore: baseStore{
|
||||
stores: stores,
|
||||
BaseStore: boltz.NewBaseStore(EntityTypeTerminators, notFoundErrorFactory, boltz.RootBucket),
|
||||
BaseStore: boltz.NewBaseStore(EntityTypeTerminators, notFoundErrorFactory, RootBucket),
|
||||
},
|
||||
sequence: sequence.NewSequence(),
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package handler_ctrl
|
||||
|
||||
import (
|
||||
"google.golang.org/protobuf/proto"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/channel"
|
||||
"github.com/openziti/fabric/controller/network"
|
||||
@@ -25,49 +24,42 @@ import (
|
||||
"github.com/openziti/fabric/pb/ctrl_pb"
|
||||
"github.com/openziti/transport/v2"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CtrlAccepter struct {
|
||||
network *network.Network
|
||||
xctrls []xctrl.Xctrl
|
||||
listener channel.UnderlayListener
|
||||
options *channel.Options
|
||||
traceHandler *channel.TraceHandler
|
||||
}
|
||||
|
||||
func NewCtrlAccepter(network *network.Network,
|
||||
xctrls []xctrl.Xctrl,
|
||||
listener channel.UnderlayListener,
|
||||
options *channel.Options,
|
||||
traceHandler *channel.TraceHandler) *CtrlAccepter {
|
||||
return &CtrlAccepter{
|
||||
network: network,
|
||||
xctrls: xctrls,
|
||||
listener: listener,
|
||||
options: options,
|
||||
traceHandler: traceHandler,
|
||||
}
|
||||
}
|
||||
|
||||
func (self *CtrlAccepter) Run() {
|
||||
log := pfxlog.Logger()
|
||||
log.Info("started")
|
||||
defer log.Warn("exited")
|
||||
|
||||
for {
|
||||
ch, err := channel.NewChannel("ctrl", self.listener, channel.BindHandlerF(self.Bind), self.options)
|
||||
if err != nil {
|
||||
log.WithError(err).Error("error accepting control channel connection")
|
||||
if err.Error() == "closed" {
|
||||
return
|
||||
}
|
||||
} else if r, err := self.network.GetRouter(ch.Id().Token); err == nil {
|
||||
go self.network.ConnectRouter(r)
|
||||
} else {
|
||||
log.WithError(err).Error("error getting router for control channel")
|
||||
}
|
||||
func (self *CtrlAccepter) AcceptUnderlay(underlay channel.Underlay) error {
|
||||
ch, err := channel.NewChannelWithUnderlay("ctrl", underlay, channel.BindHandlerF(self.Bind), self.options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if r, err := self.network.GetRouter(ch.Id().Token); err == nil {
|
||||
go self.network.ConnectRouter(r)
|
||||
} else {
|
||||
return errors.Wrap(err, "error get router for control channel")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CtrlAccepter) Bind(binding channel.Binding) error {
|
||||
|
||||
@@ -23,9 +23,9 @@ import (
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/channel"
|
||||
"github.com/openziti/fabric/controller/network"
|
||||
"github.com/openziti/identity"
|
||||
"github.com/openziti/foundation/v2/errorz"
|
||||
"github.com/openziti/foundation/v2/stringz"
|
||||
"github.com/openziti/identity"
|
||||
"github.com/pkg/errors"
|
||||
"time"
|
||||
)
|
||||
@@ -43,6 +43,10 @@ func NewConnectHandler(identity identity.Identity, network *network.Network) *Co
|
||||
}
|
||||
|
||||
func (self *ConnectHandler) HandleConnection(hello *channel.Hello, certificates []*x509.Certificate) error {
|
||||
if _, found := hello.Headers[channel.TypeHeader]; found {
|
||||
return nil
|
||||
}
|
||||
|
||||
id := hello.IdToken
|
||||
|
||||
log := pfxlog.Logger().WithField("routerId", id)
|
||||
|
||||
@@ -41,6 +41,7 @@ func (self *CommandManager) registerGenericCommands() {
|
||||
self.Decoders.RegisterF(int32(cmd_pb.CommandType_CreateEntityType), self.decodeCreateEntityCommand)
|
||||
self.Decoders.RegisterF(int32(cmd_pb.CommandType_UpdateEntityType), self.decodeUpdateEntityCommand)
|
||||
self.Decoders.RegisterF(int32(cmd_pb.CommandType_DeleteEntityType), self.decodeDeleteEntityCommand)
|
||||
self.Decoders.RegisterF(int32(cmd_pb.CommandType_SyncSnapshot), self.decodeSyncSnapshotCommand)
|
||||
}
|
||||
|
||||
func (self *CommandManager) decodeCreateEntityCommand(_ int32, data []byte) (command.Command, error) {
|
||||
@@ -85,6 +86,21 @@ func (self *CommandManager) decodeDeleteEntityCommand(_ int32, data []byte) (com
|
||||
return decoder(msg)
|
||||
}
|
||||
|
||||
func (self *CommandManager) decodeSyncSnapshotCommand(_ int32, data []byte) (command.Command, error) {
|
||||
msg := &cmd_pb.SyncSnapshotCommand{}
|
||||
if err := proto.Unmarshal(data, msg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cmd := &command.SyncSnapshotCommand{
|
||||
SnapshotId: msg.SnapshotId,
|
||||
Snapshot: msg.Snapshot,
|
||||
SnapshotSink: self.network.restoreSnapshot,
|
||||
}
|
||||
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
// CommandMsg is a TypedMessage which is also a pointer type.
|
||||
//
|
||||
// T is message type. We want to enforce that the TypeMessage implementation is a pointer type
|
||||
|
||||
@@ -1112,6 +1112,36 @@ func (network *Network) SnapshotDatabase() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (network *Network) restoreSnapshot(cmd *command.SyncSnapshotCommand) error {
|
||||
log := pfxlog.Logger()
|
||||
currentSnapshotId, err := network.getDb().GetSnapshotId()
|
||||
if err != nil {
|
||||
log.WithError(err).Error("unable to get current snapshot id")
|
||||
}
|
||||
if currentSnapshotId != nil && *currentSnapshotId == cmd.SnapshotId {
|
||||
log.WithField("snapshotId", cmd.SnapshotId).Info("snapshot already current, skipping reload")
|
||||
return nil
|
||||
}
|
||||
|
||||
network.getDb().RestoreSnapshot(cmd.Snapshot)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (network *Network) SnapshotToRaft() error {
|
||||
snapshotId, snapshot, err := network.getDb().SnapshotToMemory()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd := &command.SyncSnapshotCommand{
|
||||
SnapshotId: snapshotId,
|
||||
Snapshot: snapshot,
|
||||
SnapshotSink: network.restoreSnapshot,
|
||||
}
|
||||
|
||||
return network.Dispatch(cmd)
|
||||
}
|
||||
|
||||
type Cache interface {
|
||||
RemoveFromCache(id string)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"github.com/openziti/fabric/controller/command"
|
||||
"github.com/openziti/fabric/controller/db"
|
||||
"github.com/openziti/foundation/v2/concurrenz"
|
||||
"github.com/openziti/storage/boltz"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.etcd.io/bbolt"
|
||||
@@ -23,7 +24,7 @@ func NewFsm(dataDir string, decoders command.Decoders) *BoltDbFsm {
|
||||
}
|
||||
|
||||
type BoltDbFsm struct {
|
||||
db *db.Db
|
||||
db boltz.Db
|
||||
dataDir string
|
||||
dbPath string
|
||||
decoders command.Decoders
|
||||
@@ -45,7 +46,7 @@ func (self *BoltDbFsm) RaftInitialized() {
|
||||
self.initialized.Set(true)
|
||||
}
|
||||
|
||||
func (self *BoltDbFsm) GetDb() *db.Db {
|
||||
func (self *BoltDbFsm) GetDb() boltz.Db {
|
||||
return self.db
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"github.com/hashicorp/raft"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/channel"
|
||||
"github.com/openziti/identity"
|
||||
"github.com/openziti/foundation/v2/concurrenz"
|
||||
"github.com/openziti/identity"
|
||||
"github.com/openziti/transport/v2"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -20,6 +20,8 @@ const (
|
||||
|
||||
RaftConnectType = 2048
|
||||
RaftDataType = 2049
|
||||
|
||||
ChannelTypeMesh = "ctrl.mesh"
|
||||
)
|
||||
|
||||
type Peer struct {
|
||||
@@ -86,8 +88,7 @@ func (self meshAddr) String() string {
|
||||
type Mesh interface {
|
||||
raft.StreamLayer
|
||||
|
||||
// Listen starts a network listener for the mesh on the given address
|
||||
Listen(listenAddr string) error
|
||||
channel.UnderlayAcceptor
|
||||
|
||||
// GetOrConnectPeer returns a peer for the given address. If a peer has already been established,
|
||||
// it will be returned, otherwise a new connection will be established
|
||||
@@ -115,7 +116,6 @@ type impl struct {
|
||||
raftId raft.ServerID
|
||||
raftAddr raft.ServerAddress
|
||||
netAddr net.Addr
|
||||
listener channel.UnderlayListener
|
||||
Peers map[string]*Peer
|
||||
lock sync.RWMutex
|
||||
closeNotify chan struct{}
|
||||
@@ -168,13 +168,14 @@ func (self *impl) GetOrConnectPeer(address string, timeout time.Duration) (*Peer
|
||||
|
||||
addr, err := transport.ParseAddress(address)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Errorf("failed to dial %v", address)
|
||||
logrus.WithError(err).WithField("address", address).Error("failed to parse address")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
headers := map[int32][]byte{
|
||||
PeerIdHeader: []byte(self.raftId),
|
||||
PeerAddrHeader: []byte(self.raftAddr),
|
||||
PeerIdHeader: []byte(self.raftId),
|
||||
PeerAddrHeader: []byte(self.raftAddr),
|
||||
channel.TypeHeader: []byte(ChannelTypeMesh),
|
||||
}
|
||||
|
||||
dialer := channel.NewClassicDialer(self.id, addr, headers)
|
||||
@@ -201,7 +202,7 @@ func (self *impl) GetOrConnectPeer(address string, timeout time.Duration) (*Peer
|
||||
return nil
|
||||
})
|
||||
|
||||
if _, err = channel.NewChannel("mesh", dialer, bindHandler, channel.DefaultOptions()); err != nil {
|
||||
if _, err = channel.NewChannel(ChannelTypeMesh, dialer, bindHandler, channel.DefaultOptions()); err != nil {
|
||||
return nil, errors.Wrapf(err, "unable to dial %v", address)
|
||||
}
|
||||
|
||||
@@ -228,68 +229,48 @@ func (self *impl) RemovePeer(peer *Peer) {
|
||||
delete(self.Peers, peer.Address)
|
||||
}
|
||||
|
||||
func (self *impl) Listen(listenAddr string) error {
|
||||
addr, err := transport.ParseAddress(listenAddr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listenerConfig := channel.ListenerConfig{
|
||||
ConnectOptions: channel.DefaultConnectOptions(),
|
||||
PoolConfigurator: nil,
|
||||
}
|
||||
self.listener = channel.NewClassicListener(self.id, addr, listenerConfig)
|
||||
if err := self.listener.Listen(); err != nil {
|
||||
return err
|
||||
}
|
||||
go self.Run()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *impl) Run() {
|
||||
func (self *impl) AcceptUnderlay(underlay channel.Underlay) error {
|
||||
log := pfxlog.Logger()
|
||||
log.Info("started")
|
||||
defer log.Warn("exited")
|
||||
|
||||
for {
|
||||
peer := &Peer{
|
||||
mesh: self,
|
||||
}
|
||||
|
||||
bindHandler := channel.BindHandlerF(func(binding channel.Binding) error {
|
||||
ch := binding.GetChannel()
|
||||
id := string(ch.Underlay().Headers()[PeerIdHeader])
|
||||
addr := string(ch.Underlay().Headers()[PeerAddrHeader])
|
||||
|
||||
if id == "" || addr == "" {
|
||||
_ = ch.Close()
|
||||
return errors.Errorf("connection didn't provide id '%v' or address '%v', closing connection", id, addr)
|
||||
}
|
||||
|
||||
if err := binding.Bind(self.bindHandler); err != nil {
|
||||
_ = ch.Close()
|
||||
return errors.Wrapf(err, "error while binding channel from id '%v' or address '%v', closing connection", id, addr)
|
||||
}
|
||||
|
||||
peer.Id = raft.ServerID(id)
|
||||
peer.Address = addr
|
||||
peer.Channel = ch
|
||||
|
||||
peer.RaftConn = newRaftPeerConn(peer, self.netAddr)
|
||||
binding.AddTypedReceiveHandler(peer)
|
||||
binding.AddTypedReceiveHandler(peer.RaftConn)
|
||||
binding.AddCloseHandler(peer)
|
||||
return nil
|
||||
})
|
||||
|
||||
_, err := channel.NewChannel("ctrl", self.listener, bindHandler, channel.DefaultOptions())
|
||||
if err != nil {
|
||||
log.Errorf("error accepting (%s)", err)
|
||||
if err.Error() == "closed" {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
self.AddPeer(peer)
|
||||
logrus.Infof("connected peer %v at %v", peer.Id, peer.Address)
|
||||
}
|
||||
peer := &Peer{
|
||||
mesh: self,
|
||||
}
|
||||
|
||||
bindHandler := channel.BindHandlerF(func(binding channel.Binding) error {
|
||||
ch := binding.GetChannel()
|
||||
id := string(ch.Underlay().Headers()[PeerIdHeader])
|
||||
addr := string(ch.Underlay().Headers()[PeerAddrHeader])
|
||||
|
||||
if id == "" || addr == "" {
|
||||
_ = ch.Close()
|
||||
return errors.Errorf("connection didn't provide id '%v' or address '%v', closing connection", id, addr)
|
||||
}
|
||||
|
||||
if err := binding.Bind(self.bindHandler); err != nil {
|
||||
_ = ch.Close()
|
||||
return errors.Wrapf(err, "error while binding channel from id '%v' or address '%v', closing connection", id, addr)
|
||||
}
|
||||
|
||||
peer.Id = raft.ServerID(id)
|
||||
peer.Address = addr
|
||||
peer.Channel = ch
|
||||
|
||||
peer.RaftConn = newRaftPeerConn(peer, self.netAddr)
|
||||
binding.AddTypedReceiveHandler(peer)
|
||||
binding.AddTypedReceiveHandler(peer.RaftConn)
|
||||
binding.AddCloseHandler(peer)
|
||||
return nil
|
||||
})
|
||||
|
||||
_, err := channel.NewChannelWithUnderlay(ChannelTypeMesh, underlay, bindHandler, channel.DefaultOptions())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
self.AddPeer(peer)
|
||||
logrus.Infof("connected peer %v at %v", peer.Id, peer.Address)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
+5
-10
@@ -8,12 +8,12 @@ import (
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
"github.com/openziti/channel"
|
||||
"github.com/openziti/fabric/controller/command"
|
||||
"github.com/openziti/fabric/controller/db"
|
||||
"github.com/openziti/fabric/controller/raft/mesh"
|
||||
"github.com/openziti/identity"
|
||||
"github.com/openziti/metrics"
|
||||
"github.com/openziti/foundation/v2/concurrenz"
|
||||
"github.com/openziti/foundation/v2/errorz"
|
||||
"github.com/openziti/identity"
|
||||
"github.com/openziti/metrics"
|
||||
"github.com/openziti/storage/boltz"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"io/fs"
|
||||
@@ -29,7 +29,6 @@ type Config struct {
|
||||
DataDir string
|
||||
MinClusterSize uint32
|
||||
AdvertiseAddress string
|
||||
BindAddress string
|
||||
BootstrapMembers []string
|
||||
CommandHandlerOptions struct {
|
||||
MaxQueueSize uint16
|
||||
@@ -75,7 +74,7 @@ func (self *Controller) GetMesh() mesh.Mesh {
|
||||
}
|
||||
|
||||
// GetDb returns the DB instance
|
||||
func (self *Controller) GetDb() *db.Db {
|
||||
func (self *Controller) GetDb() boltz.Db {
|
||||
return self.Fsm.GetDb()
|
||||
}
|
||||
|
||||
@@ -224,10 +223,6 @@ func (self *Controller) Init() error {
|
||||
}
|
||||
|
||||
self.Mesh = mesh.New(self.Id, conf.LocalID, localAddr, channel.BindHandlerF(bindHandler))
|
||||
if err = self.Mesh.Listen(raftConfig.BindAddress); err != nil {
|
||||
logrus.WithField("bindAddr", raftConfig.BindAddress).WithError(err).Error("failed to start mesh listener")
|
||||
return err
|
||||
}
|
||||
|
||||
transport := raft.NewNetworkTransportWithLogger(self.Mesh, 3, 10*time.Second, hclLogger)
|
||||
|
||||
@@ -293,7 +288,7 @@ func (self *Controller) Join(req *JoinRequest) error {
|
||||
}
|
||||
|
||||
suffrage := raft.Voter
|
||||
if req.IsVoter {
|
||||
if !req.IsVoter {
|
||||
suffrage = raft.Nonvoter
|
||||
}
|
||||
|
||||
|
||||
+192
-115
@@ -27,6 +27,7 @@ const (
|
||||
CommandType_CreateEntityType CommandType = 1
|
||||
CommandType_UpdateEntityType CommandType = 2
|
||||
CommandType_DeleteEntityType CommandType = 3
|
||||
CommandType_SyncSnapshot CommandType = 4
|
||||
)
|
||||
|
||||
// Enum value maps for CommandType.
|
||||
@@ -36,12 +37,14 @@ var (
|
||||
1: "CreateEntityType",
|
||||
2: "UpdateEntityType",
|
||||
3: "DeleteEntityType",
|
||||
4: "SyncSnapshot",
|
||||
}
|
||||
CommandType_value = map[string]int32{
|
||||
"Zero": 0,
|
||||
"CreateEntityType": 1,
|
||||
"UpdateEntityType": 2,
|
||||
"DeleteEntityType": 3,
|
||||
"SyncSnapshot": 4,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -261,6 +264,61 @@ func (x *DeleteEntityCommand) GetEntityType() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type SyncSnapshotCommand struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
SnapshotId string `protobuf:"bytes,1,opt,name=snapshotId,proto3" json:"snapshotId,omitempty"`
|
||||
Snapshot []byte `protobuf:"bytes,2,opt,name=snapshot,proto3" json:"snapshot,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SyncSnapshotCommand) Reset() {
|
||||
*x = SyncSnapshotCommand{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cmd_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SyncSnapshotCommand) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SyncSnapshotCommand) ProtoMessage() {}
|
||||
|
||||
func (x *SyncSnapshotCommand) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cmd_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SyncSnapshotCommand.ProtoReflect.Descriptor instead.
|
||||
func (*SyncSnapshotCommand) Descriptor() ([]byte, []int) {
|
||||
return file_cmd_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *SyncSnapshotCommand) GetSnapshotId() string {
|
||||
if x != nil {
|
||||
return x.SnapshotId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SyncSnapshotCommand) GetSnapshot() []byte {
|
||||
if x != nil {
|
||||
return x.Snapshot
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type TagValue struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -277,7 +335,7 @@ type TagValue struct {
|
||||
func (x *TagValue) Reset() {
|
||||
*x = TagValue{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cmd_proto_msgTypes[3]
|
||||
mi := &file_cmd_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -290,7 +348,7 @@ func (x *TagValue) String() string {
|
||||
func (*TagValue) ProtoMessage() {}
|
||||
|
||||
func (x *TagValue) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cmd_proto_msgTypes[3]
|
||||
mi := &file_cmd_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -303,7 +361,7 @@ func (x *TagValue) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use TagValue.ProtoReflect.Descriptor instead.
|
||||
func (*TagValue) Descriptor() ([]byte, []int) {
|
||||
return file_cmd_proto_rawDescGZIP(), []int{3}
|
||||
return file_cmd_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (m *TagValue) GetValue() isTagValue_Value {
|
||||
@@ -383,7 +441,7 @@ type Service struct {
|
||||
func (x *Service) Reset() {
|
||||
*x = Service{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cmd_proto_msgTypes[4]
|
||||
mi := &file_cmd_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -396,7 +454,7 @@ func (x *Service) String() string {
|
||||
func (*Service) ProtoMessage() {}
|
||||
|
||||
func (x *Service) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cmd_proto_msgTypes[4]
|
||||
mi := &file_cmd_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -409,7 +467,7 @@ func (x *Service) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Service.ProtoReflect.Descriptor instead.
|
||||
func (*Service) Descriptor() ([]byte, []int) {
|
||||
return file_cmd_proto_rawDescGZIP(), []int{4}
|
||||
return file_cmd_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *Service) GetId() string {
|
||||
@@ -456,7 +514,7 @@ type Router struct {
|
||||
func (x *Router) Reset() {
|
||||
*x = Router{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cmd_proto_msgTypes[5]
|
||||
mi := &file_cmd_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -469,7 +527,7 @@ func (x *Router) String() string {
|
||||
func (*Router) ProtoMessage() {}
|
||||
|
||||
func (x *Router) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cmd_proto_msgTypes[5]
|
||||
mi := &file_cmd_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -482,7 +540,7 @@ func (x *Router) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Router.ProtoReflect.Descriptor instead.
|
||||
func (*Router) Descriptor() ([]byte, []int) {
|
||||
return file_cmd_proto_rawDescGZIP(), []int{5}
|
||||
return file_cmd_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *Router) GetId() string {
|
||||
@@ -549,7 +607,7 @@ type Terminator struct {
|
||||
func (x *Terminator) Reset() {
|
||||
*x = Terminator{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_cmd_proto_msgTypes[6]
|
||||
mi := &file_cmd_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -562,7 +620,7 @@ func (x *Terminator) String() string {
|
||||
func (*Terminator) ProtoMessage() {}
|
||||
|
||||
func (x *Terminator) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cmd_proto_msgTypes[6]
|
||||
mi := &file_cmd_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -575,7 +633,7 @@ func (x *Terminator) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Terminator.ProtoReflect.Descriptor instead.
|
||||
func (*Terminator) Descriptor() ([]byte, []int) {
|
||||
return file_cmd_proto_rawDescGZIP(), []int{6}
|
||||
return file_cmd_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *Terminator) GetId() string {
|
||||
@@ -687,91 +745,97 @@ var file_cmd_proto_rawDesc = []byte{
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a,
|
||||
0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0a, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x22, 0x91, 0x01, 0x0a,
|
||||
0x08, 0x54, 0x61, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1e, 0x0a, 0x09, 0x62, 0x6f, 0x6f,
|
||||
0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09,
|
||||
0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x22, 0x0a, 0x0b, 0x73, 0x74, 0x72,
|
||||
0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00,
|
||||
0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a, 0x0a,
|
||||
0x07, 0x66, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x48, 0x00,
|
||||
0x52, 0x07, 0x66, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x08, 0x6e, 0x69, 0x6c,
|
||||
0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x08, 0x6e,
|
||||
0x69, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x22, 0xe1, 0x01, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x12, 0x2e, 0x0a, 0x12, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x74,
|
||||
0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x74, 0x65,
|
||||
0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,
|
||||
0x12, 0x32, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e,
|
||||
0x2e, 0x7a, 0x69, 0x74, 0x69, 0x2e, 0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04,
|
||||
0x74, 0x61, 0x67, 0x73, 0x1a, 0x4e, 0x0a, 0x09, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72,
|
||||
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||
0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x15, 0x2e, 0x7a, 0x69, 0x74, 0x69, 0x2e, 0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62,
|
||||
0x2e, 0x54, 0x61, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x3a, 0x02, 0x38, 0x01, 0x22, 0x87, 0x02, 0x0a, 0x06, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x12,
|
||||
0x52, 0x0a, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x22, 0x51, 0x0a, 0x13,
|
||||
0x53, 0x79, 0x6e, 0x63, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x43, 0x6f, 0x6d, 0x6d,
|
||||
0x61, 0x6e, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x49,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f,
|
||||
0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x22,
|
||||
0x91, 0x01, 0x0a, 0x08, 0x54, 0x61, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1e, 0x0a, 0x09,
|
||||
0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48,
|
||||
0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x22, 0x0a, 0x0b,
|
||||
0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x12, 0x1a, 0x0a, 0x07, 0x66, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x01, 0x48, 0x00, 0x52, 0x07, 0x66, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x08,
|
||||
0x6e, 0x69, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00,
|
||||
0x52, 0x08, 0x6e, 0x69, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x22, 0xe1, 0x01, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69,
|
||||
0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72,
|
||||
0x70, 0x72, 0x69, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x6f, 0x54,
|
||||
0x72, 0x61, 0x76, 0x65, 0x72, 0x73, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b,
|
||||
0x6e, 0x6f, 0x54, 0x72, 0x61, 0x76, 0x65, 0x72, 0x73, 0x61, 0x6c, 0x12, 0x31, 0x0a, 0x04, 0x74,
|
||||
0x61, 0x67, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x7a, 0x69, 0x74, 0x69,
|
||||
0x2e, 0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x54,
|
||||
0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x1a, 0x4e,
|
||||
0x0a, 0x09, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x7a,
|
||||
0x69, 0x74, 0x69, 0x2e, 0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x61, 0x67, 0x56, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xa5,
|
||||
0x04, 0x0a, 0x0a, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a,
|
||||
0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72,
|
||||
0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72,
|
||||
0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x69, 0x6e, 0x64, 0x69,
|
||||
0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e,
|
||||
0x67, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x69,
|
||||
0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x69,
|
||||
0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x07, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x52, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x65, 0x63,
|
||||
0x72, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28,
|
||||
0x0d, 0x52, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x63, 0x65,
|
||||
0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x70, 0x72, 0x65,
|
||||
0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x44,
|
||||
0x61, 0x74, 0x61, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x7a, 0x69, 0x74, 0x69,
|
||||
0x2e, 0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74,
|
||||
0x6f, 0x72, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||
0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x35, 0x0a, 0x04, 0x74, 0x61,
|
||||
0x67, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x7a, 0x69, 0x74, 0x69, 0x2e,
|
||||
0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f,
|
||||
0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x12, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f,
|
||||
0x72, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x12, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x72, 0x61, 0x74,
|
||||
0x65, 0x67, 0x79, 0x12, 0x32, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x1e, 0x2e, 0x7a, 0x69, 0x74, 0x69, 0x2e, 0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72,
|
||||
0x79, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x1a, 0x4e, 0x0a, 0x09, 0x54, 0x61, 0x67, 0x73, 0x45,
|
||||
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x7a, 0x69, 0x74, 0x69, 0x2e, 0x63, 0x6d, 0x64,
|
||||
0x2e, 0x70, 0x62, 0x2e, 0x54, 0x61, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x87, 0x02, 0x0a, 0x06, 0x52, 0x6f, 0x75, 0x74,
|
||||
0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
||||
0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72,
|
||||
0x70, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x66, 0x69, 0x6e,
|
||||
0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x73, 0x74,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b,
|
||||
0x6e, 0x6f, 0x54, 0x72, 0x61, 0x76, 0x65, 0x72, 0x73, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x0b, 0x6e, 0x6f, 0x54, 0x72, 0x61, 0x76, 0x65, 0x72, 0x73, 0x61, 0x6c, 0x12, 0x31,
|
||||
0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x7a,
|
||||
0x69, 0x74, 0x69, 0x2e, 0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65,
|
||||
0x72, 0x2e, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x74, 0x61, 0x67,
|
||||
0x73, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x68, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x65, 0x65,
|
||||
0x72, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
|
||||
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4e, 0x0a, 0x09, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x7a, 0x69, 0x74, 0x69, 0x2e, 0x63, 0x6d, 0x64, 0x2e,
|
||||
0x70, 0x62, 0x2e, 0x54, 0x61, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x59, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
|
||||
0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x65, 0x72, 0x6f, 0x10, 0x00, 0x12,
|
||||
0x14, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54,
|
||||
0x79, 0x70, 0x65, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45,
|
||||
0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x44,
|
||||
0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x10,
|
||||
0x03, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
|
||||
0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2f,
|
||||
0x70, 0x62, 0x2f, 0x63, 0x6d, 0x64, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
0x73, 0x1a, 0x4e, 0x0a, 0x09, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
|
||||
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79,
|
||||
0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x15, 0x2e, 0x7a, 0x69, 0x74, 0x69, 0x2e, 0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x61,
|
||||
0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
|
||||
0x01, 0x22, 0xa5, 0x04, 0x0a, 0x0a, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
||||
0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x69,
|
||||
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x69, 0x6e,
|
||||
0x64, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1e,
|
||||
0x0a, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x26,
|
||||
0x0a, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
|
||||
0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x08,
|
||||
0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72,
|
||||
0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a,
|
||||
0x70, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x08, 0x70, 0x65,
|
||||
0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x7a,
|
||||
0x69, 0x74, 0x69, 0x2e, 0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69,
|
||||
0x6e, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x35, 0x0a,
|
||||
0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x7a, 0x69,
|
||||
0x74, 0x69, 0x2e, 0x63, 0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x2e, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04,
|
||||
0x74, 0x61, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x18, 0x0c,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x1a, 0x3b, 0x0a, 0x0d,
|
||||
0x50, 0x65, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05,
|
||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4e, 0x0a, 0x09, 0x54, 0x61, 0x67,
|
||||
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x7a, 0x69, 0x74, 0x69, 0x2e, 0x63,
|
||||
0x6d, 0x64, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x61, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05,
|
||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x6b, 0x0a, 0x0b, 0x43, 0x6f, 0x6d,
|
||||
0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x65, 0x72, 0x6f,
|
||||
0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x69,
|
||||
0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x10, 0x02, 0x12, 0x14,
|
||||
0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79,
|
||||
0x70, 0x65, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x6e, 0x61, 0x70,
|
||||
0x73, 0x68, 0x6f, 0x74, 0x10, 0x04, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x66, 0x61,
|
||||
0x62, 0x72, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x2f, 0x63, 0x6d, 0x64, 0x5f, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -787,29 +851,30 @@ func file_cmd_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_cmd_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_cmd_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_cmd_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
||||
var file_cmd_proto_goTypes = []interface{}{
|
||||
(CommandType)(0), // 0: ziti.cmd.pb.CommandType
|
||||
(*CreateEntityCommand)(nil), // 1: ziti.cmd.pb.CreateEntityCommand
|
||||
(*UpdateEntityCommand)(nil), // 2: ziti.cmd.pb.UpdateEntityCommand
|
||||
(*DeleteEntityCommand)(nil), // 3: ziti.cmd.pb.DeleteEntityCommand
|
||||
(*TagValue)(nil), // 4: ziti.cmd.pb.TagValue
|
||||
(*Service)(nil), // 5: ziti.cmd.pb.Service
|
||||
(*Router)(nil), // 6: ziti.cmd.pb.Router
|
||||
(*Terminator)(nil), // 7: ziti.cmd.pb.Terminator
|
||||
nil, // 8: ziti.cmd.pb.Service.TagsEntry
|
||||
nil, // 9: ziti.cmd.pb.Router.TagsEntry
|
||||
nil, // 10: ziti.cmd.pb.Terminator.PeerDataEntry
|
||||
nil, // 11: ziti.cmd.pb.Terminator.TagsEntry
|
||||
(*SyncSnapshotCommand)(nil), // 4: ziti.cmd.pb.SyncSnapshotCommand
|
||||
(*TagValue)(nil), // 5: ziti.cmd.pb.TagValue
|
||||
(*Service)(nil), // 6: ziti.cmd.pb.Service
|
||||
(*Router)(nil), // 7: ziti.cmd.pb.Router
|
||||
(*Terminator)(nil), // 8: ziti.cmd.pb.Terminator
|
||||
nil, // 9: ziti.cmd.pb.Service.TagsEntry
|
||||
nil, // 10: ziti.cmd.pb.Router.TagsEntry
|
||||
nil, // 11: ziti.cmd.pb.Terminator.PeerDataEntry
|
||||
nil, // 12: ziti.cmd.pb.Terminator.TagsEntry
|
||||
}
|
||||
var file_cmd_proto_depIdxs = []int32{
|
||||
8, // 0: ziti.cmd.pb.Service.tags:type_name -> ziti.cmd.pb.Service.TagsEntry
|
||||
9, // 1: ziti.cmd.pb.Router.tags:type_name -> ziti.cmd.pb.Router.TagsEntry
|
||||
10, // 2: ziti.cmd.pb.Terminator.peerData:type_name -> ziti.cmd.pb.Terminator.PeerDataEntry
|
||||
11, // 3: ziti.cmd.pb.Terminator.tags:type_name -> ziti.cmd.pb.Terminator.TagsEntry
|
||||
4, // 4: ziti.cmd.pb.Service.TagsEntry.value:type_name -> ziti.cmd.pb.TagValue
|
||||
4, // 5: ziti.cmd.pb.Router.TagsEntry.value:type_name -> ziti.cmd.pb.TagValue
|
||||
4, // 6: ziti.cmd.pb.Terminator.TagsEntry.value:type_name -> ziti.cmd.pb.TagValue
|
||||
9, // 0: ziti.cmd.pb.Service.tags:type_name -> ziti.cmd.pb.Service.TagsEntry
|
||||
10, // 1: ziti.cmd.pb.Router.tags:type_name -> ziti.cmd.pb.Router.TagsEntry
|
||||
11, // 2: ziti.cmd.pb.Terminator.peerData:type_name -> ziti.cmd.pb.Terminator.PeerDataEntry
|
||||
12, // 3: ziti.cmd.pb.Terminator.tags:type_name -> ziti.cmd.pb.Terminator.TagsEntry
|
||||
5, // 4: ziti.cmd.pb.Service.TagsEntry.value:type_name -> ziti.cmd.pb.TagValue
|
||||
5, // 5: ziti.cmd.pb.Router.TagsEntry.value:type_name -> ziti.cmd.pb.TagValue
|
||||
5, // 6: ziti.cmd.pb.Terminator.TagsEntry.value:type_name -> ziti.cmd.pb.TagValue
|
||||
7, // [7:7] is the sub-list for method output_type
|
||||
7, // [7:7] is the sub-list for method input_type
|
||||
7, // [7:7] is the sub-list for extension type_name
|
||||
@@ -860,7 +925,7 @@ func file_cmd_proto_init() {
|
||||
}
|
||||
}
|
||||
file_cmd_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TagValue); i {
|
||||
switch v := v.(*SyncSnapshotCommand); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -872,7 +937,7 @@ func file_cmd_proto_init() {
|
||||
}
|
||||
}
|
||||
file_cmd_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Service); i {
|
||||
switch v := v.(*TagValue); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -884,7 +949,7 @@ func file_cmd_proto_init() {
|
||||
}
|
||||
}
|
||||
file_cmd_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Router); i {
|
||||
switch v := v.(*Service); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -896,6 +961,18 @@ func file_cmd_proto_init() {
|
||||
}
|
||||
}
|
||||
file_cmd_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Router); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_cmd_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Terminator); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -908,7 +985,7 @@ func file_cmd_proto_init() {
|
||||
}
|
||||
}
|
||||
}
|
||||
file_cmd_proto_msgTypes[3].OneofWrappers = []interface{}{
|
||||
file_cmd_proto_msgTypes[4].OneofWrappers = []interface{}{
|
||||
(*TagValue_BoolValue)(nil),
|
||||
(*TagValue_StringValue)(nil),
|
||||
(*TagValue_FpValue)(nil),
|
||||
@@ -920,7 +997,7 @@ func file_cmd_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_cmd_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 11,
|
||||
NumMessages: 12,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
+7
-1
@@ -8,6 +8,7 @@ enum CommandType {
|
||||
CreateEntityType = 1;
|
||||
UpdateEntityType = 2;
|
||||
DeleteEntityType = 3;
|
||||
SyncSnapshot = 4;
|
||||
}
|
||||
|
||||
message CreateEntityCommand {
|
||||
@@ -28,6 +29,11 @@ message DeleteEntityCommand {
|
||||
string entityType = 2;
|
||||
}
|
||||
|
||||
message SyncSnapshotCommand {
|
||||
string snapshotId = 1;
|
||||
bytes snapshot = 2;
|
||||
}
|
||||
|
||||
message TagValue {
|
||||
oneof value {
|
||||
bool boolValue = 1;
|
||||
@@ -66,4 +72,4 @@ message Terminator {
|
||||
map<uint32, bytes> peerData = 10;
|
||||
map<string, TagValue> tags = 11;
|
||||
string hostId = 12;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ func (x *DeleteEntityCommand) GetCommandType() int32 {
|
||||
return int32(CommandType_DeleteEntityType)
|
||||
}
|
||||
|
||||
func (x *SyncSnapshotCommand) GetCommandType() int32 {
|
||||
return int32(CommandType_SyncSnapshot)
|
||||
}
|
||||
|
||||
func EncodeTags(tags map[string]interface{}) (map[string]*TagValue, error) {
|
||||
if len(tags) == 0 {
|
||||
return nil, nil
|
||||
|
||||
Reference in New Issue
Block a user