You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary
Currently, the raccoon, client supports in built serialization for either PROTO(ProtoMessage Object), or JSON. This means for already serialised data like in case for users of Stencil, they have to explicitly parse the message into a DynamicMessage for it to be of serializer Proto. We need to add support for a Serializer.RAW which forwards the message as it is without explicitly parsing the message they have serialised.
Proposed solution
Introduce Serialiser.RAW which gives the input as it is after checking for type safety
// SerializerFunc defines a conversion for raccoon message to byte sequence.typeSerializerFuncfunc(interface{}) ([]byte, error)
var (
// json raccoon message serializerJSON=json.Marshal// proto raccoon message serializerPROTO=func(minterface{}) ([]byte, error) {
msg, ok:=m.(proto.Message)
if!ok {
returnnil, errors.New("unable to marshal non proto")
}
returnproto.Marshal(msg)
}
// New serialiser type proposed.RAW=func(minterface{}) ([]byte, error) {
typedM, ok:=m.([]byte)
if!ok {
returnnil, errors.New("failed to convert to byte array")
}
returntypedM, nil
}
)
Additional context
Currently for stencil users,
stencilUrl:=fmt.Sprintf(stencilSchemaTemplate, namespace, schemaName)
client, err:=stencil.NewClient([]string{stencilUrl}, stencil.Options{})
iferr!=nil {
returnnil, err
}
serialisedData, err:=client.Serialize(packageName, data) // is of type []byteprotoMessage, err:=client.Parse(packageName, serialisedData) // additional step for converting the data to a protoMessage.iferr!=nil {
returnnil, err
}
returnprotoMessage, err
instead of directly returning the serialisedData.
The text was updated successfully, but these errors were encountered:
punit-kulal
changed the title
Support for serialised data during ingestion
Support for serialised data in raccoon client
Oct 4, 2024
Summary
Currently, the raccoon, client supports in built serialization for either PROTO(ProtoMessage Object), or JSON. This means for already serialised data like in case for users of Stencil, they have to explicitly parse the message into a DynamicMessage for it to be of serializer Proto. We need to add support for a Serializer.RAW which forwards the message as it is without explicitly parsing the message they have serialised.
Proposed solution
Introduce Serialiser.RAW which gives the input as it is after checking for type safety
Additional context
Currently for stencil users,
instead of directly returning the serialisedData.
The text was updated successfully, but these errors were encountered: