trinity.buffer.reader package#

Submodules#

Module contents#

class trinity.buffer.reader.FileReader(config: StorageConfig)[source]#

Bases: BaseFileReader

Provide a unified interface for Experience and Task file readers.

__init__(config: StorageConfig)[source]#
read(batch_size: int | None = None) List[source]#

Read from buffer.

read_with_indices(indices: List[int]) List[source]#

Read tasks with indices.

async read_with_indices_async(indices: List[int]) List[source]#

Read tasks with indices asynchronously.

state_dict()[source]#

Return the state of the reader as a dict. :returns: A dict containing the reader state. At minimum, it should contain

the current_index field.

load_state_dict(state_dict)[source]#
class trinity.buffer.reader.QueueReader(config: StorageConfig)[source]#

Bases: BufferReader

Reader of the Queue buffer.

__init__(config: StorageConfig)[source]#
read(batch_size: int | None = None) List[source]#

Read from buffer.

async read_async(batch_size: int | None = None) List[source]#

Read from buffer asynchronously.

state_dict() Dict[source]#

Return the state of the reader as a dict. :returns: A dict containing the reader state. At minimum, it should contain

the current_index field.

load_state_dict(state_dict)[source]#
class trinity.buffer.reader.SQLReader(config: StorageConfig)[source]#

Bases: BufferReader

Reader of the SQL buffer.

__init__(config: StorageConfig) None[source]#
read(batch_size: int | None = None) List[source]#

Read from buffer.

async read_async(batch_size: int | None = None) List[source]#

Read from buffer asynchronously.

state_dict() Dict[source]#

Return the state of the reader as a dict. :returns: A dict containing the reader state. At minimum, it should contain

the current_index field.

load_state_dict(state_dict)[source]#