You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
starmap/server_prorw.go

43 lines
761 B
Go

4 years ago
package starmap
import (
"b612.me/notify"
)
func (kv *RemoteKv) getMap(data notify.SMsg) string {
val, ok := kvMapPro[data.Value]
if !ok {
data.Key = "error"
data.Reply("key not exists")
return ""
}
encodeData, err := encodeMap(val)
if err != nil {
data.Key = "error"
data.Reply(err.Error())
return ""
}
return string(encodeData)
}
func (kv *RemoteKv) storeMap(data notify.SMsg) string {
recvData, err := decodeMap([]byte(data.Value))
if err != nil {
data.Key = "error"
data.Reply(err.Error())
return ""
}
err = StoreMap(recvData)
if err != nil {
data.Key = "error"
data.Reply(err.Error())
return ""
}
return "ok"
}
func (kv *RemoteKv) deleteMap(data notify.SMsg) string {
delete(kvMapPro, data.Value)
return "ok"
}