Example #1
0
 def __getitem__(self, index):
     '''
     Gets a message in the channel by its index.
     This function loads the message from disk into memory.
     '''
     _, uuid = self._messages[index]
     message = Message.create_message_reader(self._cask.read_message(uuid))
     assert message.uuid == uuid
     return message
Example #2
0
    def read_message(self, uuid: str):
        '''
        Reads a proto message with specified uuid from Cask

        Args:
            uuid (str): uuid in string of the message
        '''
        assert uuid is not None
        if self._writable:
            # FIXME Handles reading in write model
            raise NotImplementedError(
                'Reading is to be implemented in writing mode')
        return Message.create_message_reader(self._cask.read_message(uuid))