confluentinc / confluentinc/libserdes

Serialization/Deserialization of avro objects direcly instead of using GenericDatum

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
12
Forks
62
PR merge metrics
No merged PRs in 30d

Description

to use the serialize function we need to convert my avro object into GenericDatum object , and to do that we need to encode the avro object and then decode it. and in order to send we need to decode the genericDatum agian, it feels like we are doing the same thing twice.
avro lib example :

std::auto_ptr out = avro::memoryOutputStream();
avro::EncoderPtr e = avro::binaryEncoder();
e->init(*out);
c::cpx c1;
c1.re = 100.23;
c1.im = 105.77;
avro::encode(*e, c1);

std::auto_ptr in = avro::memoryInputStream(*out);
avro::DecoderPtr d = avro::binaryDecoder();
d->init(*in);

avro::GenericDatum datum(cpxSchema);
avro::decode(*d, datum);`

instead we can create some global function which look like that :
`template
ssize_t serializeAvro (Schema *schema, const T& avro, std::vector &out, std::string &errstr)`
since avro seralize function doesn't use any of the AvroImpl class members , this look better than the current option. any thoughts ?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.