MXS-1881: Refactor AVRO_TABLE

Moved initialization into the constructor and removed unused member
variables.
This commit is contained in:
Markus Mäkelä
2018-05-29 00:56:32 +03:00
parent f61c56228c
commit 69855f9214
2 changed files with 47 additions and 41 deletions

View File

@ -192,18 +192,21 @@ struct TABLE_MAP
struct AVRO_TABLE
{
AVRO_TABLE(avro_file_writer_t file, avro_value_iface_t* iface, avro_schema_t schema):
avro_file(file),
avro_writer_iface(iface),
avro_schema(schema)
{
}
~AVRO_TABLE()
{
avro_file_writer_flush(avro_file);
avro_file_writer_close(avro_file);
avro_value_iface_decref(avro_writer_iface);
avro_schema_decref(avro_schema);
MXS_FREE(json_schema);
MXS_FREE(filename);
}
char* filename; /*< Absolute filename */
char* json_schema; /*< JSON representation of the schema */
avro_file_writer_t avro_file; /*< Current Avro data file */
avro_value_iface_t* avro_writer_iface; /*< Avro C API writer interface */
avro_schema_t avro_schema; /*< Native Avro schema of the table */