Control Plane이 Edge-owned capability와 domain agent 상태를 관찰하고 Edge 명령 이벤트를 중계할 수 있도록 native wire 계약을 확장한다.
47 lines
1.7 KiB
Go
47 lines
1.7 KiB
Go
package wire
|
|
|
|
import (
|
|
"google.golang.org/protobuf/proto"
|
|
|
|
proto_socket "git.toki-labs.com/toki/proto-socket/go"
|
|
iop "iop/proto/gen/iop"
|
|
)
|
|
|
|
// EdgeParserMap returns the proto-socket parser set for the Control Plane-Edge
|
|
// native TCP wire contract.
|
|
func EdgeParserMap() proto_socket.ParserMap {
|
|
return proto_socket.ParserMap{
|
|
proto_socket.TypeNameOf(&iop.EdgeHelloRequest{}): func(b []byte) (proto.Message, error) {
|
|
req := &iop.EdgeHelloRequest{}
|
|
return req, proto.Unmarshal(b, req)
|
|
},
|
|
proto_socket.TypeNameOf(&iop.EdgeHelloResponse{}): func(b []byte) (proto.Message, error) {
|
|
res := &iop.EdgeHelloResponse{}
|
|
return res, proto.Unmarshal(b, res)
|
|
},
|
|
proto_socket.TypeNameOf(&iop.EdgeStatusRequest{}): func(b []byte) (proto.Message, error) {
|
|
req := &iop.EdgeStatusRequest{}
|
|
return req, proto.Unmarshal(b, req)
|
|
},
|
|
proto_socket.TypeNameOf(&iop.EdgeStatusResponse{}): func(b []byte) (proto.Message, error) {
|
|
res := &iop.EdgeStatusResponse{}
|
|
return res, proto.Unmarshal(b, res)
|
|
},
|
|
proto_socket.TypeNameOf(&iop.EdgeNodeEvent{}): func(b []byte) (proto.Message, error) {
|
|
event := &iop.EdgeNodeEvent{}
|
|
return event, proto.Unmarshal(b, event)
|
|
},
|
|
proto_socket.TypeNameOf(&iop.EdgeCommandRequest{}): func(b []byte) (proto.Message, error) {
|
|
req := &iop.EdgeCommandRequest{}
|
|
return req, proto.Unmarshal(b, req)
|
|
},
|
|
proto_socket.TypeNameOf(&iop.EdgeCommandResponse{}): func(b []byte) (proto.Message, error) {
|
|
res := &iop.EdgeCommandResponse{}
|
|
return res, proto.Unmarshal(b, res)
|
|
},
|
|
proto_socket.TypeNameOf(&iop.EdgeCommandEvent{}): func(b []byte) (proto.Message, error) {
|
|
event := &iop.EdgeCommandEvent{}
|
|
return event, proto.Unmarshal(b, event)
|
|
},
|
|
}
|
|
}
|