Merge remote-tracking branch 'origin/add_conf_version' into feat_broadcasting
# Conflicts: # go.mod # go.sum
This commit is contained in:
commit
1764ce9a30
4 files changed
+11
-3
No files matched your search
@@ -1,4 +1,5 @@
|
||||
### upcoming
|
||||
* add config version
|
||||
* add method `/module/broadcast_event` to broadcast arbitrary event to all connected modules
|
||||
|
||||
### v2.2.1
|
||||
|
||||
@@ -67,7 +67,10 @@ func (c *config) CreateUpdateConfig(config domain.CreateUpdateConfigRequest) (*d
|
||||
Config: config.Config,
|
||||
Unsafe: config.Unsafe,
|
||||
}
|
||||
if config.Id == "" {
|
||||
if config.Id == "" || config.CreateNew {
|
||||
if config.CreateNew {
|
||||
upsertConfig.Config.Version++
|
||||
}
|
||||
upsertConfig.Config.Id = state.GenerateId()
|
||||
upsertConfig.Create = true
|
||||
}
|
||||
|
||||
+2
-1
@@ -30,5 +30,6 @@ type BroadcastEventRequest struct {
|
||||
|
||||
type CreateUpdateConfigRequest struct {
|
||||
entity.Config
|
||||
Unsafe bool
|
||||
Unsafe bool
|
||||
CreateNew bool
|
||||
}
|
||||
@@ -131,9 +131,9 @@ func (moduleRegistryService) GetAggregatedModuleInfo(state state.ReadonlyState)
|
||||
Config: configs[i],
|
||||
Valid: false,
|
||||
})
|
||||
|
||||
resMap[configs[i].ModuleId] = info
|
||||
}
|
||||
|
||||
schemas := state.Schemas().GetByModuleIds(idList)
|
||||
for _, s := range schemas {
|
||||
info := resMap[s.ModuleId]
|
||||
@@ -150,6 +150,9 @@ func (moduleRegistryService) GetAggregatedModuleInfo(state state.ReadonlyState)
|
||||
|
||||
for key := range resMap {
|
||||
info := resMap[key]
|
||||
sort.Slice(info.Configs, func(i, j int) bool {
|
||||
return info.Configs[i].Version < info.Configs[j].Version
|
||||
})
|
||||
backends := state.Mesh().GetBackends(info.Name)
|
||||
conns := make([]domain.Connection, 0, len(backends))
|
||||
|
||||
|
||||
Reference in new issue
Block a user