Callbacks

ReadHandler (data, size)

WriteHandler (data, size)

Details

Modulemd.ReadHandler(data, size)
Parameters:
  • data (object or None) – A private pointer to the data being read.

  • size (int) – The size of the buffer.

Returns:

On success, the handler must return 1. If the handler failed, the returned value must be 0. On EOF, the handler must set the size_read to 0 and return 1.

data:

A private pointer to the data being read.

buffer:

The buffer to write the data from the source.

size_read:

The actual number of bytes read from the source.

Return type:

(int, data: object, buffer: int, size_read: int)

The prototype of a read handler.

The read handler is called when the parser needs to read more bytes from the source. The handler should write not more than size bytes to the buffer. The number of written bytes should be set to the size_read variable.

This handler is identical to a yaml_read_handler_t but is included here to avoid depending on yaml.h in modulemd headers.

New in version 2.3.

Modulemd.WriteHandler(data, size)
Parameters:
  • data (object or None) – A private pointer that includes the data source.

  • size (int) – The size of the buffer.

Returns:

On success, the handler must return 1. If the handler failed, the returned value must be 0.

data:

A private pointer that includes the data source.

buffer:

The buffer with bytes to be written.

Return type:

(int, data: object, buffer: int)

The prototype of a write handler.

The write handler is called when the emitter needs to flush the accumulated characters to the output. The handler should write size bytes of the buffer to the output.

This handler is identical to a yaml_write_handler_t but is included here to avoid depending on yaml.h in modulemd headers.

New in version 2.3.