feat(mobs;backend): negative filtering for mob-file messages (no backend involved in plugin creation)
This commit is contained in:
parent
38ad540f1a
commit
d48a580d62
6 changed files with 67 additions and 67 deletions
|
|
@ -2,7 +2,7 @@
|
|||
package messages
|
||||
|
||||
func IsReplayerType(id int) bool {
|
||||
return 0 == id || 4 == id || 5 == id || 6 == id || 7 == id || 8 == id || 9 == id || 10 == id || 11 == id || 12 == id || 13 == id || 14 == id || 15 == id || 16 == id || 18 == id || 19 == id || 20 == id || 22 == id || 37 == id || 38 == id || 39 == id || 40 == id || 41 == id || 44 == id || 45 == id || 46 == id || 47 == id || 48 == id || 49 == id || 54 == id || 55 == id || 59 == id || 60 == id || 61 == id || 67 == id || 69 == id || 70 == id || 71 == id || 72 == id || 73 == id || 74 == id || 75 == id || 76 == id || 77 == id || 79 == id || 90 == id || 93 == id || 96 == id || 100 == id || 102 == id || 103 == id || 105 == id
|
||||
return 80 != id && 81 != id && 82 != id && 1 != id && 3 != id && 17 != id && 23 != id && 24 != id && 25 != id && 26 != id && 27 != id && 28 != id && 29 != id && 30 != id && 31 != id && 32 != id && 33 != id && 34 != id && 35 != id && 36 != id && 42 != id && 43 != id && 50 != id && 51 != id && 52 != id && 53 != id && 56 != id && 62 != id && 63 != id && 64 != id && 66 != id && 78 != id && 127 != id && 107 != id && 91 != id && 92 != id && 94 != id && 95 != id && 97 != id && 98 != id && 99 != id && 101 != id && 104 != id && 110 != id && 111 != id
|
||||
}
|
||||
|
||||
func IsIOSType(id int) bool {
|
||||
|
|
|
|||
|
|
@ -156,10 +156,10 @@ const (
|
|||
|
||||
MsgZustand = 79
|
||||
|
||||
MsgSessionSearch = 127
|
||||
|
||||
MsgJSException = 78
|
||||
|
||||
MsgSessionSearch = 127
|
||||
|
||||
MsgIOSBatchMeta = 107
|
||||
|
||||
MsgIOSSessionStart = 90
|
||||
|
|
@ -3040,40 +3040,6 @@ func (msg *Zustand) TypeID() int {
|
|||
return 79
|
||||
}
|
||||
|
||||
type SessionSearch struct {
|
||||
message
|
||||
Timestamp uint64
|
||||
Partition uint64
|
||||
}
|
||||
|
||||
func (msg *SessionSearch) Encode() []byte {
|
||||
buf := make([]byte, 21)
|
||||
buf[0] = 127
|
||||
p := 1
|
||||
p = WriteUint(msg.Timestamp, buf, p)
|
||||
p = WriteUint(msg.Partition, buf, p)
|
||||
return buf[:p]
|
||||
}
|
||||
|
||||
func (msg *SessionSearch) EncodeWithIndex() []byte {
|
||||
encoded := msg.Encode()
|
||||
if IsIOSType(msg.TypeID()) {
|
||||
return encoded
|
||||
}
|
||||
data := make([]byte, len(encoded)+8)
|
||||
copy(data[8:], encoded[:])
|
||||
binary.LittleEndian.PutUint64(data[0:], msg.Meta().Index)
|
||||
return data
|
||||
}
|
||||
|
||||
func (msg *SessionSearch) Decode() Message {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (msg *SessionSearch) TypeID() int {
|
||||
return 127
|
||||
}
|
||||
|
||||
type JSException struct {
|
||||
message
|
||||
Name string
|
||||
|
|
@ -3112,6 +3078,40 @@ func (msg *JSException) TypeID() int {
|
|||
return 78
|
||||
}
|
||||
|
||||
type SessionSearch struct {
|
||||
message
|
||||
Timestamp uint64
|
||||
Partition uint64
|
||||
}
|
||||
|
||||
func (msg *SessionSearch) Encode() []byte {
|
||||
buf := make([]byte, 21)
|
||||
buf[0] = 127
|
||||
p := 1
|
||||
p = WriteUint(msg.Timestamp, buf, p)
|
||||
p = WriteUint(msg.Partition, buf, p)
|
||||
return buf[:p]
|
||||
}
|
||||
|
||||
func (msg *SessionSearch) EncodeWithIndex() []byte {
|
||||
encoded := msg.Encode()
|
||||
if IsIOSType(msg.TypeID()) {
|
||||
return encoded
|
||||
}
|
||||
data := make([]byte, len(encoded)+8)
|
||||
copy(data[8:], encoded[:])
|
||||
binary.LittleEndian.PutUint64(data[0:], msg.Meta().Index)
|
||||
return data
|
||||
}
|
||||
|
||||
func (msg *SessionSearch) Decode() Message {
|
||||
return msg
|
||||
}
|
||||
|
||||
func (msg *SessionSearch) TypeID() int {
|
||||
return 127
|
||||
}
|
||||
|
||||
type IOSBatchMeta struct {
|
||||
message
|
||||
Timestamp uint64
|
||||
|
|
|
|||
|
|
@ -1303,18 +1303,6 @@ func DecodeZustand(reader io.Reader) (Message, error) {
|
|||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeSessionSearch(reader io.Reader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &SessionSearch{}
|
||||
if msg.Timestamp, err = ReadUint(reader); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Partition, err = ReadUint(reader); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeJSException(reader io.Reader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &JSException{}
|
||||
|
|
@ -1333,6 +1321,18 @@ func DecodeJSException(reader io.Reader) (Message, error) {
|
|||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeSessionSearch(reader io.Reader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &SessionSearch{}
|
||||
if msg.Timestamp, err = ReadUint(reader); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Partition, err = ReadUint(reader); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return msg, err
|
||||
}
|
||||
|
||||
func DecodeIOSBatchMeta(reader io.Reader) (Message, error) {
|
||||
var err error = nil
|
||||
msg := &IOSBatchMeta{}
|
||||
|
|
@ -1966,12 +1966,12 @@ func ReadMessage(t uint64, reader io.Reader) (Message, error) {
|
|||
case 79:
|
||||
return DecodeZustand(reader)
|
||||
|
||||
case 127:
|
||||
return DecodeSessionSearch(reader)
|
||||
|
||||
case 78:
|
||||
return DecodeJSException(reader)
|
||||
|
||||
case 127:
|
||||
return DecodeSessionSearch(reader)
|
||||
|
||||
case 107:
|
||||
return DecodeIOSBatchMeta(reader)
|
||||
|
||||
|
|
|
|||
|
|
@ -743,14 +743,6 @@ class Zustand(Message):
|
|||
self.state = state
|
||||
|
||||
|
||||
class SessionSearch(Message):
|
||||
__id__ = 127
|
||||
|
||||
def __init__(self, timestamp, partition):
|
||||
self.timestamp = timestamp
|
||||
self.partition = partition
|
||||
|
||||
|
||||
class JSException(Message):
|
||||
__id__ = 78
|
||||
|
||||
|
|
@ -761,6 +753,14 @@ class JSException(Message):
|
|||
self.metadata = metadata
|
||||
|
||||
|
||||
class SessionSearch(Message):
|
||||
__id__ = 127
|
||||
|
||||
def __init__(self, timestamp, partition):
|
||||
self.timestamp = timestamp
|
||||
self.partition = partition
|
||||
|
||||
|
||||
class IOSBatchMeta(Message):
|
||||
__id__ = 107
|
||||
|
||||
|
|
|
|||
|
|
@ -661,12 +661,6 @@ class MessageCodec(Codec):
|
|||
state=self.read_string(reader)
|
||||
)
|
||||
|
||||
if message_id == 127:
|
||||
return SessionSearch(
|
||||
timestamp=self.read_uint(reader),
|
||||
partition=self.read_uint(reader)
|
||||
)
|
||||
|
||||
if message_id == 78:
|
||||
return JSException(
|
||||
name=self.read_string(reader),
|
||||
|
|
@ -675,6 +669,12 @@ class MessageCodec(Codec):
|
|||
metadata=self.read_string(reader)
|
||||
)
|
||||
|
||||
if message_id == 127:
|
||||
return SessionSearch(
|
||||
timestamp=self.read_uint(reader),
|
||||
partition=self.read_uint(reader)
|
||||
)
|
||||
|
||||
if message_id == 107:
|
||||
return IOSBatchMeta(
|
||||
timestamp=self.read_uint(reader),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
package messages
|
||||
|
||||
func IsReplayerType(id int) bool {
|
||||
return <%= $messages.select { |msg| msg.replayer != false }.map{ |msg| "#{msg.id} == id" }.join(' || ') %>
|
||||
return <%= $messages.select { |msg| msg.replayer == false }.map{ |msg| "#{msg.id} != id" }.join(' && ') %>
|
||||
}
|
||||
|
||||
func IsIOSType(id int) bool {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue