clp_ffi_py.ir.readers module#
- class clp_ffi_py.ir.readers.ClpIrFileReader[source]#
Bases:
ClpIrStreamReader
Wrapper class of ClpIrStreamReader that calls open for convenience.
- class clp_ffi_py.ir.readers.ClpIrStreamReader[source]#
Bases:
Iterator
[LogEvent
]This class represents a stream reader used to read/deserialize log events from a CLP IR stream. It also provides method(s) to instantiate a log event generator with a customized search query.
- Parameters:
istream – Input stream that contains CLP IR byte sequence.
deserializer_buffer_size – Initial size of the deserializer buffer.
enable_compression – A flag indicating whether the istream is compressed using zstd.
allow_incomplete_stream – If set to True, an incomplete CLP IR stream is not treated as an error. Instead, encountering such a stream is seen as reaching its end without raising any exceptions.
decoder_buffer_size – Deprecated since 0.0.13. Use deserializer_buffer_size instead. This argument is provided for backward compatibility and if set, will overwrite deserializer_buffer_size’s value.
- DEFAULT_DECODER_BUFFER_SIZE: int = 65536#
- DEFAULT_DESERIALIZER_BUFFER_SIZE: int = 65536#
- __init__(istream, deserializer_buffer_size=65536, enable_compression=True, allow_incomplete_stream=False, decoder_buffer_size=None)[source]#
- Parameters:
istream (IO[bytes])
deserializer_buffer_size (int)
enable_compression (bool)
allow_incomplete_stream (bool)
decoder_buffer_size (int | None)
- read_next_log_event()[source]#
Reads and deserializes the next log event from the IR stream.
- Returns:
Next unread log event represented as an instance of LogEvent.
None if the end of IR stream is reached.
- Raises:
Exception – If
deserialize_next_log_event()
fails.- Return type:
LogEvent | None
- read_preamble()[source]#
Try to deserialize the preamble and set metadata. If metadata has been set already, it will instantly return. It is separated from __init__ so that the input stream does not need to be readable on a reader’s construction, but until the user starts to iterate logs.
- Raises:
Exception – If
deserialize_preamble()
fails.- Return type:
None