'Updates entries in the users_who_share_rooms table. The first
user should be a local user.
Args:
room_id (str)
share_private (bool): Is the room private
user_id_tuples([(str, str)]): iterable of 2-tuple of user IDs.'

def update_users_who_share_room(self, room_id, share_private, user_id_sets):

    def _update_users_who_share_room_txn(txn):
        sql = '\n                                                                UPDATE    users_who_share_rooms\n                                                                SET    room_id    =    ?,    share_private    =    ?\n                                                                WHERE    user_id    =    ?    AND    other_user_id    =    ?\n                                                '
        txn.executemany(sql, ((room_id, share_private, uid, oid) for (uid, oid) in user_id_sets))
        for (user_id, other_user_id) in user_id_sets:
            txn.call_after(self.get_users_who_share_room_from_dir.invalidate, (user_id,))
            txn.call_after(self.get_if_users_share_a_room.invalidate, (user_id, other_user_id))
    return self.runInteraction('update_users_who_share_room', _update_users_who_share_room_txn)
