Skip to content
  • Thomas Haller's avatar
    settings: support setting a connection as volatile via Update2() · 35dc6421
    Thomas Haller authored
    Extend the Update2 flags to allow marking a connection as volatile.
    Making a connection as volatile means that the connection stays alive
    as long as an active connection references it.
    
    It is correct that Update2() returns before the connection is actually
    deleted. It might take an arbitrary long time until the volatile
    mechanism cleans up the connection.
    
    Also add two more IN_MEMORY flags: "detached" and "only".
    
    The existing NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY would not detach nor
    delete the possible file on disk. That is, the mode only changes what NM
    thinks is the current content of the connection profile. It would not delete
    the file on disk nor would it detach the profile in-memory from the file.
    As such, later persisting the connection again to disk would overwrite
    the file, and deleting the profile, would delete the file.
    
    Now add two new IN_MEMORY modes.
    
    NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_DETACH is like making the connection
    in-memory only, but forgetting that there might be any profile on disk.
    That means, a later Delete() would not delete the file. Similarly, a
    later Update2() that persists the connection again, would not overwrite
    the existing file on disk, instead it would choose a new file name.
    
    On the other hand, NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_ONLY would delete
    a potential file from disk right away.
    
    It's clear that "volatile" only makes sense with either "in-memory-detached"
    or "in-memory-only". That is, the file on disk should be deleted right away
    (before the in-memory part is garbage collected) or the file on disk should
    be forgotten.
    35dc6421