github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/state/backups/doc.go (about)

     1  // Copyright 2022 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  /*
     5  Package backups contains all the stand-alone backup-related
     6  functionality for juju state. That functionality is encapsulated by
     7  the backups.Backups type. The package also exposes a few key helpers
     8  and components.
     9  
    10  Backups are not a part of juju state nor of normal state operations.
    11  However, they certainly are tightly coupled with state (the very
    12  subject of backups). This puts backups in an odd position, particularly
    13  with regard to the storage of backup metadata and archives.
    14  
    15  As noted above backups are about state but not a part of state. So
    16  exposing backup-related methods on State would imply the wrong thing.
    17  Thus most of the functionality here is defined at a high level without
    18  relation to state. A few low-level parts or helpers are exposed as
    19  functions to which you pass a state value. Those are kept to a minimum.
    20  
    21  Note that state (and juju as a whole) currently does not have a
    22  persistence layer abstraction to facilitate separating different
    23  persistence needs and implementations. As a consequence, state's
    24  data, whether about how an model should look or about existing
    25  resources within an model, is dumped essentially straight into
    26  State's mongo connection. The code in the state package does not
    27  make any distinction between the two (nor does the package clearly
    28  distinguish between state-related abstractions and state-related
    29  data).
    30  
    31  Backups add yet another category, merely taking advantage of State's
    32  mongo for storage. In the interest of making the distinction clear,
    33  among other reasons, backups uses its own database under state's mongo
    34  connection.
    35  */
    36  package backups