• Kirill Smelkov's avatar
    Allow internal clients to specify intended access mode - read-only or read-write · bfeb1690
    Kirill Smelkov authored
    Most of our tools need only read access for working. However e.g.
    FileStorage, when opened in read-write mode, automatically creates
    database file and index.
    
    This way if database is opened in read-write mode a simple typo in path,
    e.g. to `zodb dump path` would lead to:
    
    - new database at path will be created
    - the dump will print nothing (empty database)
    - exit status will be 0 (ok) and no error will be reported.
    
    For this reason it is better tools declare access level they need so for
    read-only access request we can catch it with an error from storage.
    
    This, however, requires quite recent ZODB to work:
    
    https://github.com/zopefoundation/ZODB/pull/153
    
    P.S.
    
    We don't want to force users to always specify read-only in URLs or
    zconf files because:
    
    - this is error prone
    - URL or zconf can be though as of file
    - when a program opens a file the program, not file, declares which type
      of access it wants.
    
    That's why access mode declaration has to be internal.
    bfeb1690
zodbcmp.py 5.14 KB