async def _write(self, table_name, key, columns): pdu = self._make_pdu() pdu.write.table_name = table_name key_fields = utils.make_fields(key) pdu.write.key.extend(key_fields) columns_fields = utils.make_fields(columns) pdu.write.columns.extend(columns_fields) rpdu = await self._write_pdu(pdu) return utils.format_rpdu(rpdu)
async def _read_range(self, table_name, start_key, end_key, limit): pdu = self._make_pdu() pdu.read_range.table_name = table_name start_key_fields = utils.make_fields(start_key) pdu.read_range.start_key.extend(start_key_fields) end_key_fields = utils.make_fields(end_key) pdu.read_range.end_key.extend(end_key_fields) pdu.read_range.limit = limit rpdu = await self._write_pdu(pdu) return utils.format_rpdu(rpdu)
async def _seek(self, table_name, key): pdu = self._make_pdu() pdu.seek.table_name = table_name key_fields = utils.make_fields(key) pdu.seek.key.extend(key_fields) rpdu = await self._write_pdu(pdu) return utils.format_rpdu(rpdu)
async def _read_range_n_ts(self, table_name, start_key, n): pdu = self._make_pdu() pdu.read_range_n_ts.table_name = table_name start_key_fields = utils.make_fields(start_key) pdu.read_range_n_ts.start_key.extend(start_key_fields) pdu.read_range_n_ts.n = n rpdu = await self._write_pdu(pdu) return utils.format_rpdu(rpdu)
async def _update(self, table_name, key, update_operations): pdu = self._make_pdu() pdu.update.table_name = table_name key_fields = utils.make_fields(key) pdu.update.key.extend(key_fields) uol = utils.make_update_operation_list(update_operations) pdu.update.update_operation.extend(uol) rpdu = await self._write_pdu(pdu) return utils.format_rpdu(rpdu)