Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyReflectionTarget = errors.New("grpcdecode: empty reflection target")
ErrEmptyReflectionTarget is returned by FromReflection when an empty target string is supplied.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder interface {
// Decode inspects reqBody/resBody (raw, length-prefixed gRPC message
// envelopes) and populates ev.GRPC's request/response schemas and
// Decoded flag when the method can be resolved against the decoder's
// loaded descriptors. It never copies field values into ev; the
// envelope payloads are parsed only to be discarded. A nil error is
// returned even when nothing could be resolved (e.g. no descriptors
// loaded, or the service/method isn't present in them) -- ev is simply
// left unchanged in that case.
Decode(reqBody, resBody []byte, ev *model.Event) error
}
Decoder decodes gRPC request/response messages using either descriptors or reflection. This implementation loads a FileDescriptorSet and derives JSON-like schemas for request/response messages. It does not expose raw values: Decode only ever populates structural schema information on ev.
func FromDescriptorsFile ¶
FromDescriptorsFile reads a serialized descriptorpb.FileDescriptorSet from path (as produced by `protoc --descriptor_set_out`), parses it, and returns a Decoder that resolves gRPC service/method schemas against the messages and services it contains. It returns an error if the file cannot be read or fails to parse as a FileDescriptorSet.
func FromReflection ¶
FromReflection is optional; for now it returns a decoder that marks decoded=false if no descriptors are available. Hooking real reflection can be added later.