def put_raw(self, store_name, packed_key, packed_value, version): packed_version = version.to_bytes() chunk = packed_version + packed_value conn = self.get_connection() try: self.send_cmd(conn, "PUT", store_name, packed_key, [struct.pack(">i", len(chunk)), chunk]) finally: conn.close()
def delete_raw(self, store_name, packed_key, version): packed_version = version.to_bytes() conn = self.get_connection() try: self.send_cmd( conn, "DELETE", store_name, packed_key, [struct.pack(">h", len(packed_version)), packed_version] ) return conn.receive(1) == "\x01" finally: conn.close()