forked from x/icebergs
opt mdb
This commit is contained in:
parent
860f79496a
commit
cf184b384e
@ -36,7 +36,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
ALPINE: {Name: "alpine cli cmd", Hand: func(m *ice.Message, arg ...string) { IsAlpine(m, arg...) }},
|
ALPINE: {Name: "alpine cli cmd", Hand: func(m *ice.Message, arg ...string) { IsAlpine(m, arg...) }},
|
||||||
}, mdb.ZoneAction(mdb.SHORT, CLI, mdb.FIELD, "time,id,osid,cmd"), mdb.ClearHashOnExitAction())},
|
}, mdb.ZoneAction(mdb.SHORT, CLI, mdb.FIELD, "time,id,osid,cmd"), mdb.ClearOnExitHashAction())},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,20 +70,14 @@ func _hash_select(m *ice.Message, prefix, chain, field, value string) {
|
|||||||
}
|
}
|
||||||
func _hash_select_field(m *ice.Message, prefix, chain string, key string, field string) (value string) {
|
func _hash_select_field(m *ice.Message, prefix, chain string, key string, field string) (value string) {
|
||||||
defer RLock(m, prefix, chain)()
|
defer RLock(m, prefix, chain)()
|
||||||
Richs(m, prefix, chain, key, func(key string, val Map) {
|
Richs(m, prefix, chain, key, func(key string, val Map) { value = kit.Select(kit.Format(val[field]), key, field == HASH) })
|
||||||
if field == HASH {
|
|
||||||
value = key
|
|
||||||
} else {
|
|
||||||
value = kit.Format(val[field])
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func _hash_prunes(m *ice.Message, prefix, chain string, arg ...string) {
|
func _hash_prunes(m *ice.Message, prefix, chain string, arg ...string) {
|
||||||
fields := _hash_fields(m)
|
fields := _hash_fields(m)
|
||||||
defer RLock(m, prefix, chain)()
|
defer RLock(m, prefix, chain)()
|
||||||
Richs(m, prefix, chain, FOREACH, func(key string, value Map) {
|
Richs(m, prefix, chain, FOREACH, func(key string, value Map) {
|
||||||
switch value = kit.GetMeta(value); cb := m.OptionCB(PRUNES).(type) {
|
switch value = kit.GetMeta(value); cb := m.OptionCB("").(type) {
|
||||||
case func(string, Map) bool:
|
case func(string, Map) bool:
|
||||||
kit.If(cb(key, value), func() { m.Push(key, value, fields) })
|
kit.If(cb(key, value), func() { m.Push(key, value, fields) })
|
||||||
default:
|
default:
|
||||||
@ -150,7 +144,7 @@ func StatusHashAction(arg ...Any) ice.Actions {
|
|||||||
}},
|
}},
|
||||||
}, HashAction(arg...))
|
}, HashAction(arg...))
|
||||||
}
|
}
|
||||||
func ClearHashOnExitAction() ice.Actions {
|
func ClearOnExitHashAction() ice.Actions {
|
||||||
return ice.MergeActions(ice.Actions{ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { Conf(m, m.PrefixKey(), HASH, "") }}})
|
return ice.MergeActions(ice.Actions{ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { Conf(m, m.PrefixKey(), HASH, "") }}})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,12 +193,7 @@ func HashSelect(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
}
|
}
|
||||||
func HashPrunes(m *ice.Message, cb func(Map) bool) *ice.Message {
|
func HashPrunes(m *ice.Message, cb func(Map) bool) *ice.Message {
|
||||||
expire := kit.Select(m.Time("-"+kit.Select(DAYS, Config(m, EXPIRE))), m.Option("before"))
|
expire := kit.Select(m.Time("-"+kit.Select(DAYS, Config(m, EXPIRE))), m.Option("before"))
|
||||||
m.OptionCB(PRUNES, func(key string, value Map) bool {
|
m.OptionCB(PRUNES, func(key string, value Map) bool { return kit.Format(value[TIME]) < expire && (cb == nil || cb(value)) })
|
||||||
if kit.Format(value[TIME]) > expire {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return cb == nil || cb(value)
|
|
||||||
})
|
|
||||||
return m.Cmdy(PRUNES, m.PrefixKey(), "", HASH, ice.OptionFields(HashField(m))).StatusTimeCount()
|
return m.Cmdy(PRUNES, m.PrefixKey(), "", HASH, ice.OptionFields(HashField(m))).StatusTimeCount()
|
||||||
}
|
}
|
||||||
func HashExport(m *ice.Message, arg ...Any) *ice.Message {
|
func HashExport(m *ice.Message, arg ...Any) *ice.Message {
|
||||||
@ -245,13 +234,7 @@ func HashSelectDetails(m *ice.Message, key string, cb func(Map) bool) Map {
|
|||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
func HashSelectField(m *ice.Message, key string, field string) (value string) {
|
func HashSelectField(m *ice.Message, key string, field string) (value string) {
|
||||||
HashSelectDetail(m, key, func(key string, val Map) {
|
HashSelectDetail(m, key, func(key string, val Map) { value = kit.Select(kit.Format(kit.Value(val, field)), key, field == HASH) })
|
||||||
if field == HASH {
|
|
||||||
value = key
|
|
||||||
} else {
|
|
||||||
value = kit.Format(kit.Value(val, field))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func HashSelectTarget(m *ice.Message, key string, create Any) (target Any) {
|
func HashSelectTarget(m *ice.Message, key string, create Any) (target Any) {
|
||||||
@ -270,10 +253,10 @@ func HashSelectTarget(m *ice.Message, key string, create Any) (target Any) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch create := create.(type) {
|
switch create := create.(type) {
|
||||||
case func(Map) Any:
|
|
||||||
target = create(value)
|
|
||||||
case func(Maps) Any:
|
case func(Maps) Any:
|
||||||
target = create(ToMaps(value))
|
target = create(ToMaps(value))
|
||||||
|
case func(Map) Any:
|
||||||
|
target = create(value)
|
||||||
case func() Any:
|
case func() Any:
|
||||||
target = create()
|
target = create()
|
||||||
default:
|
default:
|
||||||
@ -318,8 +301,5 @@ func Rich(m *ice.Message, prefix string, chain Any, data Any) string {
|
|||||||
cache = kit.Data()
|
cache = kit.Data()
|
||||||
m.Confv(prefix, chain, cache)
|
m.Confv(prefix, chain, cache)
|
||||||
}
|
}
|
||||||
if m.Option(SHORT) != "" {
|
|
||||||
kit.Value(cache, kit.Keym(SHORT), m.Option(SHORT))
|
|
||||||
}
|
|
||||||
return miss.Rich(path.Join(prefix, kit.Keys(chain)), cache, data)
|
return miss.Rich(path.Join(prefix, kit.Keys(chain)), cache, data)
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,9 @@ func Confv(m configMessage, arg ...Any) Any {
|
|||||||
}
|
}
|
||||||
return m.Confv(arg...)
|
return m.Confv(arg...)
|
||||||
}
|
}
|
||||||
|
func Conf(m configMessage, arg ...Any) string {
|
||||||
|
return kit.Format(Confv(m, arg...))
|
||||||
|
}
|
||||||
func Confm(m configMessage, key string, sub Any, cbs ...Any) Map {
|
func Confm(m configMessage, key string, sub Any, cbs ...Any) Map {
|
||||||
val := m.Confv(key, sub)
|
val := m.Confv(key, sub)
|
||||||
if len(cbs) > 0 {
|
if len(cbs) > 0 {
|
||||||
@ -60,9 +63,6 @@ func Confm(m configMessage, key string, sub Any, cbs ...Any) Map {
|
|||||||
value, _ := val.(Map)
|
value, _ := val.(Map)
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
func Conf(m configMessage, arg ...Any) string {
|
|
||||||
return kit.Format(Confv(m, arg...))
|
|
||||||
}
|
|
||||||
|
|
||||||
var cache = sync.Map{}
|
var cache = sync.Map{}
|
||||||
|
|
||||||
|
110
base/mdb/mdb.go
110
base/mdb/mdb.go
@ -136,86 +136,66 @@ var Index = &ice.Context{Name: MDB, Help: "数据模块", Commands: ice.Commands
|
|||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
INPUTS: {Name: "inputs key sub type field value", Hand: func(m *ice.Message, arg ...string) {
|
INPUTS: {Name: "inputs key sub type field value", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[2] {
|
kit.Switch(arg[2],
|
||||||
case HASH:
|
HASH, func() { _hash_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) },
|
||||||
_hash_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4))
|
ZONE, func() { _zone_inputs(m, arg[0], arg[1], arg[3], kit.Select(NAME, arg, 4), kit.Select("", arg, 5)) },
|
||||||
case ZONE:
|
LIST, func() { _list_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) },
|
||||||
_zone_inputs(m, arg[0], arg[1], arg[3], kit.Select(NAME, arg, 4), kit.Select("", arg, 5))
|
)
|
||||||
case LIST:
|
|
||||||
_list_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4))
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
INSERT: {Name: "insert key sub type arg...", Hand: func(m *ice.Message, arg ...string) {
|
INSERT: {Name: "insert key sub type arg...", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[2] {
|
kit.Switch(arg[2],
|
||||||
case HASH:
|
HASH, func() { _hash_insert(m, arg[0], arg[1], arg[3:]...) },
|
||||||
_hash_insert(m, arg[0], arg[1], arg[3:]...)
|
ZONE, func() { _zone_insert(m, arg[0], arg[1], arg[3], arg[4:]...) },
|
||||||
case ZONE:
|
LIST, func() { _list_insert(m, arg[0], arg[1], arg[3:]...) },
|
||||||
_zone_insert(m, arg[0], arg[1], arg[3], arg[4:]...)
|
)
|
||||||
case LIST:
|
|
||||||
_list_insert(m, arg[0], arg[1], arg[3:]...)
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
DELETE: {Name: "delete key sub type field value", Hand: func(m *ice.Message, arg ...string) {
|
DELETE: {Name: "delete key sub type field value", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[2] {
|
kit.Switch(arg[2],
|
||||||
case HASH:
|
HASH, func() { _hash_delete(m, arg[0], arg[1], arg[3], arg[4]) },
|
||||||
_hash_delete(m, arg[0], arg[1], arg[3], arg[4])
|
// ZONE, func() { _list_delete(m, arg[0], _domain_chain(m, kit.Keys(arg[1], kit.KeyHash(arg[3]))), arg[4], arg[5]) },
|
||||||
case ZONE:
|
// LIST, func() { _list_delete(m, arg[0], arg[1], arg[3], arg[4]) },
|
||||||
// _list_delete(m, arg[0], _domain_chain(m, kit.Keys(arg[1], kit.KeyHash(arg[3]))), arg[4], arg[5])
|
)
|
||||||
case LIST:
|
|
||||||
// _list_delete(m, arg[0], arg[1], arg[3], arg[4])
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
MODIFY: {Name: "modify key sub type field value arg...", Hand: func(m *ice.Message, arg ...string) {
|
MODIFY: {Name: "modify key sub type field value arg...", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[2] {
|
kit.Switch(arg[2],
|
||||||
case HASH:
|
HASH, func() { _hash_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...) },
|
||||||
_hash_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...)
|
ZONE, func() { _zone_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...) },
|
||||||
case ZONE:
|
LIST, func() { _list_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...) },
|
||||||
_zone_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...)
|
)
|
||||||
case LIST:
|
|
||||||
_list_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...)
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
SELECT: {Name: "select key sub type field value", Hand: func(m *ice.Message, arg ...string) {
|
SELECT: {Name: "select key sub type field value", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[2] {
|
kit.Switch(arg[2],
|
||||||
case HASH:
|
HASH, func() { _hash_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select(FOREACH, arg, 4)) },
|
||||||
_hash_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select(FOREACH, arg, 4))
|
ZONE, func() { _zone_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select("", arg, 4)) },
|
||||||
case ZONE:
|
LIST, func() { _list_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select("", arg, 4)) },
|
||||||
_zone_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select("", arg, 4))
|
)
|
||||||
case LIST:
|
|
||||||
_list_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select("", arg, 4))
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
PRUNES: {Name: "prunes key sub type [field value]...", Hand: func(m *ice.Message, arg ...string) {
|
PRUNES: {Name: "prunes key sub type [field value]...", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[2] {
|
kit.Switch(arg[2],
|
||||||
case HASH:
|
HASH, func() {
|
||||||
_hash_prunes(m, arg[0], arg[1], arg[3:]...)
|
_hash_prunes(m, arg[0], arg[1], arg[3:]...)
|
||||||
m.Tables(func(value Maps) { _hash_delete(m, arg[0], arg[1], HASH, value[HASH]) })
|
m.Tables(func(value Maps) { _hash_delete(m, arg[0], arg[1], HASH, value[HASH]) })
|
||||||
case ZONE:
|
},
|
||||||
// _list_prunes(m, arg[0], _domain_chain(m, kit.Keys(arg[1], kit.KeyHash(arg[3]))), arg[4:]...)
|
// ZONE, func() { _list_prunes(m, arg[0], _domain_chain(m, kit.Keys(arg[1], kit.KeyHash(arg[3]))), arg[4:]...) },
|
||||||
case LIST:
|
// LIST, func() { _list_prunes(m, arg[0], arg[1], arg[3:]...) },
|
||||||
// _list_prunes(m, arg[0], arg[1], arg[3:]...)
|
)
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
EXPORT: {Name: "export key sub type file", Hand: func(m *ice.Message, arg ...string) {
|
EXPORT: {Name: "export key sub type file", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.OptionDefault(CACHE_LIMIT, "-1")
|
m.OptionDefault(CACHE_LIMIT, "-1")
|
||||||
switch file := _mdb_export_file(m, arg...); arg[2] {
|
file := _mdb_export_file(m, arg...)
|
||||||
case HASH:
|
kit.Switch(arg[2],
|
||||||
_hash_export(m, arg[0], arg[1], file)
|
HASH, func() { _hash_export(m, arg[0], arg[1], file) },
|
||||||
case ZONE:
|
ZONE, func() { _zone_export(m, arg[0], arg[1], file) },
|
||||||
_zone_export(m, arg[0], arg[1], file)
|
LIST, func() { _list_export(m, arg[0], arg[1], file) },
|
||||||
case LIST:
|
)
|
||||||
_list_export(m, arg[0], arg[1], file)
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
IMPORT: {Name: "import key sub type file", Hand: func(m *ice.Message, arg ...string) {
|
IMPORT: {Name: "import key sub type file", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch file := _mdb_export_file(m, arg...); arg[2] {
|
file := _mdb_export_file(m, arg...)
|
||||||
case HASH:
|
kit.Switch(arg[2],
|
||||||
_hash_import(m, arg[0], arg[1], file)
|
HASH, func() { _hash_import(m, arg[0], arg[1], file) },
|
||||||
case ZONE:
|
ZONE, func() { _zone_import(m, arg[0], arg[1], file) },
|
||||||
_zone_import(m, arg[0], arg[1], file)
|
LIST, func() { _list_import(m, arg[0], arg[1], file) },
|
||||||
case LIST:
|
)
|
||||||
_list_import(m, arg[0], arg[1], file)
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -23,6 +23,5 @@ func RenderAction(arg ...ice.Any) ice.Actions {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { Conf(m, m.PrefixKey(), HASH, "") }},
|
}, ClearOnExitHashAction())
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
@ -151,12 +151,8 @@ func ZoneAction(arg ...ice.Any) ice.Actions {
|
|||||||
func PageZoneAction(arg ...ice.Any) ice.Actions {
|
func PageZoneAction(arg ...ice.Any) ice.Actions {
|
||||||
return ice.MergeActions(ice.Actions{
|
return ice.MergeActions(ice.Actions{
|
||||||
SELECT: {Name: "select zone id auto insert page", Hand: func(m *ice.Message, arg ...string) { PageZoneSelect(m, arg...) }},
|
SELECT: {Name: "select zone id auto insert page", Hand: func(m *ice.Message, arg ...string) { PageZoneSelect(m, arg...) }},
|
||||||
PREV: {Hand: func(m *ice.Message, arg ...string) {
|
PREV: {Hand: func(m *ice.Message, arg ...string) { PrevPageLimit(m, arg[0], arg[1:]...) }},
|
||||||
PrevPageLimit(m, arg[0], arg[1:]...)
|
NEXT: {Hand: func(m *ice.Message, arg ...string) { NextPage(m, arg[0], arg[1:]...) }},
|
||||||
}},
|
|
||||||
NEXT: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
NextPage(m, arg[0], arg[1:]...)
|
|
||||||
}},
|
|
||||||
}, ZoneAction(arg...))
|
}, ZoneAction(arg...))
|
||||||
}
|
}
|
||||||
func ZoneKey(m *ice.Message) string {
|
func ZoneKey(m *ice.Message) string {
|
||||||
@ -172,9 +168,7 @@ func ZoneField(m *ice.Message) string { return kit.Select(ZONE_FIELD, Config(m,
|
|||||||
func ZoneInputs(m *ice.Message, arg ...Any) {
|
func ZoneInputs(m *ice.Message, arg ...Any) {
|
||||||
m.Cmdy(INPUTS, m.PrefixKey(), "", ZONE, m.Option(ZoneKey(m)), arg)
|
m.Cmdy(INPUTS, m.PrefixKey(), "", ZONE, m.Option(ZoneKey(m)), arg)
|
||||||
}
|
}
|
||||||
func ZoneCreate(m *ice.Message, arg ...Any) {
|
func ZoneCreate(m *ice.Message, arg ...Any) { m.Cmdy(INSERT, m.PrefixKey(), "", HASH, arg) }
|
||||||
m.Cmdy(INSERT, m.PrefixKey(), "", HASH, arg)
|
|
||||||
}
|
|
||||||
func ZoneRemove(m *ice.Message, arg ...Any) {
|
func ZoneRemove(m *ice.Message, arg ...Any) {
|
||||||
if args := kit.Simple(arg...); len(args) == 0 {
|
if args := kit.Simple(arg...); len(args) == 0 {
|
||||||
arg = append(arg, m.OptionSimple(ZoneKey(m)))
|
arg = append(arg, m.OptionSimple(ZoneKey(m)))
|
||||||
|
@ -71,6 +71,6 @@ func init() {
|
|||||||
DIAL: {Name: "dial type name port=9010 host=", Help: "连接", Hand: func(m *ice.Message, arg ...string) {
|
DIAL: {Name: "dial type name port=9010 host=", Help: "连接", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_client_dial(m, arg...)
|
_client_dial(m, arg...)
|
||||||
}},
|
}},
|
||||||
}, mdb.StatusHashAction(mdb.FIELD, "time,hash,status,type,name,host,port,error,nread,nwrite"), mdb.ClearHashOnExitAction())},
|
}, mdb.StatusHashAction(mdb.FIELD, "time,hash,status,type,name,host,port,error,nread,nwrite"), mdb.ClearOnExitHashAction())},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ func init() {
|
|||||||
GATEWAY: {Hand: func(m *ice.Message, arg ...string) {
|
GATEWAY: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Push(aaa.IP, kit.Keys(kit.Slice(strings.Split(m.Cmd("").Append(aaa.IP), ice.PT), 0, 3), "1"))
|
m.Push(aaa.IP, kit.Keys(kit.Slice(strings.Split(m.Cmd("").Append(aaa.IP), ice.PT), 0, 3), "1"))
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, mdb.TEXT), mdb.ClearHashOnExitAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction(mdb.SHORT, mdb.TEXT), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
_host_list(m, kit.Select("", arg, 0))
|
_host_list(m, kit.Select("", arg, 0))
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -66,6 +66,6 @@ func init() {
|
|||||||
LISTEN: {Name: "listen type name port=9030 host=", Hand: func(m *ice.Message, arg ...string) {
|
LISTEN: {Name: "listen type name port=9030 host=", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_server_listen(m, arg...)
|
_server_listen(m, arg...)
|
||||||
}},
|
}},
|
||||||
}, mdb.StatusHashAction(mdb.FIELD, "time,hash,status,type,name,host,port,error,nconn"), mdb.ClearHashOnExitAction())},
|
}, mdb.StatusHashAction(mdb.FIELD, "time,hash,status,type,name,host,port,error,nconn"), mdb.ClearOnExitHashAction())},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,6 @@ func init() {
|
|||||||
tcp.SEND: {Hand: func(m *ice.Message, arg ...string) {
|
tcp.SEND: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
_broad_send(m, "", "", "255.255.255.255", "9020", arg...)
|
_broad_send(m, "", "", "255.255.255.255", "9020", arg...)
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, "host,port", mdb.FIELD, "time,hash,type,name,host,port", mdb.ACTION, OPEN), mdb.ClearHashOnExitAction())},
|
}, mdb.HashAction(mdb.SHORT, "host,port", mdb.FIELD, "time,hash,type,name,host,port", mdb.ACTION, OPEN), mdb.ClearOnExitHashAction())},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ func init() {
|
|||||||
kit.If(len(arg) > 0, func() { ice.Info.Domain, ice.Info.Localhost = arg[0], false })
|
kit.If(len(arg) > 0, func() { ice.Info.Domain, ice.Info.Localhost = arg[0], false })
|
||||||
m.Echo(ice.Info.Domain)
|
m.Echo(ice.Info.Domain)
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,status,name,proto,host,port", tcp.LOCALHOST, ice.TRUE), mdb.ClearHashOnExitAction(), ServeAction())},
|
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,status,name,proto,host,port", tcp.LOCALHOST, ice.TRUE), mdb.ClearOnExitHashAction(), ServeAction())},
|
||||||
PP(ice.INTSHELL): {Name: "/intshell/", Help: "命令行", Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
PP(ice.INTSHELL): {Name: "/intshell/", Help: "命令行", Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||||
RenderIndex(m, arg...)
|
RenderIndex(m, arg...)
|
||||||
}},
|
}},
|
||||||
|
@ -223,7 +223,7 @@ func init() {
|
|||||||
ice.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
|
ice.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
|
||||||
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text", ctx.ACTION, OPEN,
|
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text", ctx.ACTION, OPEN,
|
||||||
REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000),
|
REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000),
|
||||||
), mdb.ClearHashOnExitAction(), SpaceAction(), aaa.WhiteAction()), Hand: func(m *ice.Message, arg ...string) {
|
), mdb.ClearOnExitHashAction(), SpaceAction(), aaa.WhiteAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) < 2 {
|
if len(arg) < 2 {
|
||||||
mdb.HashSelect(m, arg...).Sort("type,name,text")
|
mdb.HashSelect(m, arg...).Sort("type,name,text")
|
||||||
m.Tables(func(values ice.Maps) {
|
m.Tables(func(values ice.Maps) {
|
||||||
|
@ -296,7 +296,7 @@ func init() {
|
|||||||
MERGE: {Hand: func(m *ice.Message, arg ...string) {
|
MERGE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(kit.MergeURL2(m.CmdAppend("", arg[0], CLIENT_URL), arg[1], arg[2:]))
|
m.Echo(kit.MergeURL2(m.CmdAppend("", arg[0], CLIENT_URL), arg[1], arg[2:]))
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,client.name,client.url", LOGHEADERS, ice.FALSE), mdb.ClearHashOnExitAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,client.name,client.url", LOGHEADERS, ice.FALSE), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) < 2 || arg[0] == "" || (len(arg) > 3 && arg[3] == "") {
|
if len(arg) < 2 || arg[0] == "" || (len(arg) > 3 && arg[3] == "") {
|
||||||
mdb.HashSelect(m, kit.Slice(arg, 0, 1)...).Sort(CLIENT_NAME)
|
mdb.HashSelect(m, kit.Slice(arg, 0, 1)...).Sort(CLIENT_NAME)
|
||||||
} else {
|
} else {
|
||||||
|
@ -50,7 +50,7 @@ func init() {
|
|||||||
m.Cmd(mdb.DELETE, m.PrefixKey(), kit.KeyHash(m.Option(RIVER)), mdb.HASH, m.OptionSimple(STORM))
|
m.Cmd(mdb.DELETE, m.PrefixKey(), kit.KeyHash(m.Option(RIVER)), mdb.HASH, m.OptionSimple(STORM))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, mdb.ClearHashOnExitAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch len(arg) {
|
switch len(arg) {
|
||||||
case 0:
|
case 0:
|
||||||
m.Cmdy(mdb.SELECT, m.PrefixKey(), "", mdb.HASH, ice.OptionFields("time,river"))
|
m.Cmdy(mdb.SELECT, m.PrefixKey(), "", mdb.HASH, ice.OptionFields("time,river"))
|
||||||
|
@ -251,7 +251,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
ctx.ProcessField(m, "", arg, arg...)
|
ctx.ProcessField(m, "", arg, arg...)
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,commit,origin"), mdb.ClearHashOnExitAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,commit,origin"), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 || arg[0] == "" {
|
if len(arg) == 0 || arg[0] == "" {
|
||||||
mdb.HashSelect(m, arg...).Action(mdb.CREATE)
|
mdb.HashSelect(m, arg...).Action(mdb.CREATE)
|
||||||
} else if dir := _git_dir(_repos_path(arg[0])); len(arg) == 1 || arg[1] == "" {
|
} else if dir := _git_dir(_repos_path(arg[0])); len(arg) == 1 || arg[1] == "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user