mirror of
https://2025-dev.shylinux.com/x/20250215-cluster
synced 2025-04-25 21:24:04 +08:00
opt some
This commit is contained in:
parent
390d3f2de4
commit
4dd0ebfab5
6
go.mod
6
go.mod
@ -3,7 +3,7 @@ module 2025-dev.shylinux.com/x/20250215-cluster
|
|||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
shylinux.com/x/ice v1.5.70
|
shylinux.com/x/ice v1.5.71
|
||||||
shylinux.com/x/icebergs v1.9.71
|
shylinux.com/x/icebergs v1.9.72
|
||||||
shylinux.com/x/toolkits v1.0.18
|
shylinux.com/x/toolkits v1.0.19
|
||||||
)
|
)
|
||||||
|
6
go.sum
6
go.sum
@ -4,10 +4,16 @@ shylinux.com/x/go-qrcode v0.0.3 h1:RMo+Vidbgq3HatLBj7DDXcTbTLFUwzis5K7TqBkD38U=
|
|||||||
shylinux.com/x/go-qrcode v0.0.3/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po=
|
shylinux.com/x/go-qrcode v0.0.3/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po=
|
||||||
shylinux.com/x/ice v1.5.70 h1:fIv86pk535PnwRVhKFkIDvV0xh2SUdL34FmCnjGDBgg=
|
shylinux.com/x/ice v1.5.70 h1:fIv86pk535PnwRVhKFkIDvV0xh2SUdL34FmCnjGDBgg=
|
||||||
shylinux.com/x/ice v1.5.70/go.mod h1:gZLXlXi58yWdW0HP3c4K/IFS8my43DId6ke3vvXiq1k=
|
shylinux.com/x/ice v1.5.70/go.mod h1:gZLXlXi58yWdW0HP3c4K/IFS8my43DId6ke3vvXiq1k=
|
||||||
|
shylinux.com/x/ice v1.5.71 h1:5yrs+9uj3xNjsQuuLed/3lfF10syjbHhUT8LJAJqClo=
|
||||||
|
shylinux.com/x/ice v1.5.71/go.mod h1:2KKKi+Jridkkg+NWUrSX9S7Pe5zuwihBaVJ0nNY/FmY=
|
||||||
shylinux.com/x/icebergs v1.9.71 h1:h31b/MsEXinqDiVygbCLdiFVDLEhNpiwD4Q+U2tg/iU=
|
shylinux.com/x/icebergs v1.9.71 h1:h31b/MsEXinqDiVygbCLdiFVDLEhNpiwD4Q+U2tg/iU=
|
||||||
shylinux.com/x/icebergs v1.9.71/go.mod h1:+4bl7yJRMFtlTQRDLd+xh6b0hwXkqWaHLmx63Jeewwk=
|
shylinux.com/x/icebergs v1.9.71/go.mod h1:+4bl7yJRMFtlTQRDLd+xh6b0hwXkqWaHLmx63Jeewwk=
|
||||||
|
shylinux.com/x/icebergs v1.9.72 h1:y3oVuMZtsI6hX0HLdfgzeDZNSbyoLrVSWl81JQcV+fA=
|
||||||
|
shylinux.com/x/icebergs v1.9.72/go.mod h1:3Bdp3tjzw+hUKJF+kR8pfsrbjAf72DVZmCaE8/MPFtk=
|
||||||
shylinux.com/x/toolkits v0.7.10/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
shylinux.com/x/toolkits v0.7.10/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||||
shylinux.com/x/toolkits v1.0.18 h1:jtQZhmvU10Ajegc87tU0cYFUBSviaODo5TsCXpYb2O4=
|
shylinux.com/x/toolkits v1.0.18 h1:jtQZhmvU10Ajegc87tU0cYFUBSviaODo5TsCXpYb2O4=
|
||||||
shylinux.com/x/toolkits v1.0.18/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
shylinux.com/x/toolkits v1.0.18/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||||
|
shylinux.com/x/toolkits v1.0.19 h1:Nrx0xYRc5ph1WS66EZ1hJUCe+2FdSWQ4QP6tBlguikQ=
|
||||||
|
shylinux.com/x/toolkits v1.0.19/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||||
shylinux.com/x/websocket v0.0.4 h1:AJpwblePoOpiE6C8NrvgNYpKTotXMLrDDX2chTvx44Q=
|
shylinux.com/x/websocket v0.0.4 h1:AJpwblePoOpiE6C8NrvgNYpKTotXMLrDDX2chTvx44Q=
|
||||||
shylinux.com/x/websocket v0.0.4/go.mod h1:3UGWkjTu3ie5NAZen7J+uLPBrO7DFeKloj6Jxo13Oiw=
|
shylinux.com/x/websocket v0.0.4/go.mod h1:3UGWkjTu3ie5NAZen7J+uLPBrO7DFeKloj6Jxo13Oiw=
|
||||||
|
@ -14,14 +14,19 @@ import (
|
|||||||
"shylinux.com/x/toolkits/task"
|
"shylinux.com/x/toolkits/task"
|
||||||
)
|
)
|
||||||
|
|
||||||
type travel struct {
|
type Travel struct {
|
||||||
ice.Space
|
ice.Space
|
||||||
script string `name:"create name*=2025-cluster port*=40000 count*=3" icon:"bi bi-terminal"`
|
weight string `name:"weight" help:"统计" icon:"bi bi-pie-chart"`
|
||||||
list string `name:"list space auto" help:"集群管理"`
|
|
||||||
foreach string `name:"foreach" help:"遍历" icon:"bi bi-card-list"`
|
foreach string `name:"foreach" help:"遍历" icon:"bi bi-card-list"`
|
||||||
|
script string `name:"create name*=2025-cluster port*=40000 count*=3" icon:"bi bi-terminal"`
|
||||||
|
upgrade string `name:"upgrade space"`
|
||||||
|
list string `name:"list space auto" help:"集群管理"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s travel) Script(m *ice.Message, arg ...string) {
|
func (s Travel) Foreach(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(s, s.Concurrent, ice.Info.Make.Module, m.PrefixKey()).PushAction(s.BinaryActionList(m)...).Action(s.Foreach, s.Upgrade, s.Publish)
|
||||||
|
}
|
||||||
|
func (s Travel) Script(m *ice.Message, arg ...string) {
|
||||||
for i := 0; i < kit.Int(m.Option(mdb.COUNT)); i++ {
|
for i := 0; i < kit.Int(m.Option(mdb.COUNT)); i++ {
|
||||||
m.Option(cli.CTX_ENV, cli.CTX_NAME, m.Option(mdb.NAME)+kit.Format(i))
|
m.Option(cli.CTX_ENV, cli.CTX_NAME, m.Option(mdb.NAME)+kit.Format(i))
|
||||||
m.Option(cli.CTX_ARG, kit.JoinCmdArgs(ice.DEV, m.Option(ice.MSG_USERHOST), tcp.NODENAME, m.Option(mdb.NAME)+kit.Format(i), tcp.PORT, kit.Format(kit.Int(m.Option(tcp.PORT))+i)))
|
m.Option(cli.CTX_ARG, kit.JoinCmdArgs(ice.DEV, m.Option(ice.MSG_USERHOST), tcp.NODENAME, m.Option(mdb.NAME)+kit.Format(i), tcp.PORT, kit.Format(kit.Int(m.Option(tcp.PORT))+i)))
|
||||||
@ -29,7 +34,17 @@ func (s travel) Script(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
m.Action(s.Foreach, s.Script)
|
m.Action(s.Foreach, s.Script)
|
||||||
}
|
}
|
||||||
func (s travel) List(m *ice.Message, arg ...string) {
|
func (s Travel) Publish(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(web.SPACE, ice.OPS, web.DREAM, code.PUBLISH, m.Option(ice.MSG_USERPOD))
|
||||||
|
}
|
||||||
|
func (s Travel) Upgrade(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option(web.SPACE) != "" {
|
||||||
|
m.Cmd(web.SPACE, m.Option(web.SPACE), code.UPGRADE)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
m.Cmdy(s, s.Sequential, ice.Info.Make.Module, code.UPGRADE).Action(s.Foreach)
|
||||||
|
}
|
||||||
|
func (s Travel) List(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
stat := map[string]int{}
|
stat := map[string]int{}
|
||||||
m.SpaceListServer().Table(func(value ice.Maps) { stat[value[nfs.MODULE]]++ })
|
m.SpaceListServer().Table(func(value ice.Maps) { stat[value[nfs.MODULE]]++ })
|
||||||
@ -46,21 +61,18 @@ func (s travel) List(m *ice.Message, arg ...string) {
|
|||||||
m.Cmdy(web.SPACE, arg[0], m.PrefixKey())
|
m.Cmdy(web.SPACE, arg[0], m.PrefixKey())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (s travel) Foreach(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(s, s.Concurrent, ice.Info.Make.Module, m.PrefixKey()).PushAction(s.BinaryActionList(m)...).Action(s.Foreach, s.Upgrade)
|
func init() { ice.Cmd("web.chat.dev.cluster.travel", Travel{}) }
|
||||||
}
|
|
||||||
func (s travel) Upgrade(m *ice.Message, arg ...string) {
|
func (s Travel) Concurrent(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(s, s.Sequential, ice.Info.Make.Module, code.UPGRADE).Action(s.Foreach)
|
|
||||||
}
|
|
||||||
func (s travel) Concurrent(m *ice.Message, arg ...string) {
|
|
||||||
m.SpaceListServer().TableGo(func(value ice.Maps, lock *task.Lock) { s.pushRecord(m, value, arg...) })
|
m.SpaceListServer().TableGo(func(value ice.Maps, lock *task.Lock) { s.pushRecord(m, value, arg...) })
|
||||||
m.SortStrR(web.SPACE)
|
m.SortStrR(web.SPACE)
|
||||||
}
|
}
|
||||||
func (s travel) Sequential(m *ice.Message, arg ...string) {
|
func (s Travel) Sequential(m *ice.Message, arg ...string) {
|
||||||
m.SpaceListServer().Table(func(value ice.Maps) { s.pushRecord(m, value, arg...) })
|
m.SpaceListServer().Table(func(value ice.Maps) { s.pushRecord(m, value, arg...) })
|
||||||
m.SortStrR(web.SPACE)
|
m.SortStrR(web.SPACE)
|
||||||
}
|
}
|
||||||
func (s travel) pushRecord(m *ice.Message, value ice.Maps, arg ...string) {
|
func (s Travel) pushRecord(m *ice.Message, value ice.Maps, arg ...string) {
|
||||||
if value[nfs.MODULE] == arg[0] {
|
if value[nfs.MODULE] == arg[0] {
|
||||||
m.Cmd(web.SPACE, value[mdb.NAME], arg[1:]).Table(func(val ice.Maps, index int, head []string) {
|
m.Cmd(web.SPACE, value[mdb.NAME], arg[1:]).Table(func(val ice.Maps, index int, head []string) {
|
||||||
m.Push(web.SPACE, value[mdb.NAME]).PushRecord(val, head...)
|
m.Push(web.SPACE, value[mdb.NAME]).PushRecord(val, head...)
|
||||||
@ -73,12 +85,3 @@ func (s travel) pushRecord(m *ice.Message, value ice.Maps, arg ...string) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { ice.Cmd("web.chat.dev.cluster.travel", travel{}) }
|
|
||||||
|
|
||||||
type Travel struct {
|
|
||||||
travel
|
|
||||||
foreach string `name:"foreach" help:"遍历" icon:"bi bi-card-list"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() { ice.Cmd("web.chat.dev.cluster.travel", Travel{}) }
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user