gitlab.com/SkynetLabs/skyd@v1.6.9/skymodules/accounting/README.md (about)

     1  # Accounting
     2  The accounting module provides accounting information for a Sia node. 
     3  
     4  ## Subsystems
     5  The Accounting module has the following subsystems
     6   - [Accounting Subsystem](#accounting-subsystem)
     7   - [Persistence Subsystem](#persistence-subsystem)
     8  
     9  ### Accounting Subsystem
    10  **Key Files**
    11   - [accounting.go](./accounting.go)
    12  
    13  The accounting subsystem is responsible for general actions related to the
    14  accounting module, such as initialization and returning information about the
    15  module.
    16  
    17  **Exports**
    18   - `Accounting`
    19   - `Close`
    20   - `NewCustomAccounting`
    21  
    22  **Inbound Complexities**
    23   - `callUpdateAccounting` updates the accounting information and the persistence
    24       object in memory.
    25        - The persistence subsystem's `managedUpdateAndPersistAccounting` method
    26          calls `callUpdateAccounting` to update the persistence before saving to
    27          disk.
    28  
    29  **Outbound Complexities**
    30   - `NewCustomAccounting` will use `callThreadedPersistAccounting` to launch the
    31       background loop for persisting the accounting information.
    32  
    33  ### Persistence Subsystem
    34  **Key Files**
    35   - [persist.go](./persist.go)
    36  
    37  The persistence subsystem is responsible for ensuring safe and performant ACID
    38  operations by using the `persist` package's `AppendOnlyPersist` object. The
    39  persistence is rows of JSON.
    40  
    41  **Inbound Complexities**
    42   - `callThreadedPersistAccounting` is a background loop that updates the
    43       persistence and saves it to disk.
    44        - The accounting subsystem's `NewCustomAccounting` function calls
    45          `callThreadedPersistAccounting` once the Accounting module has been
    46          initialized before returning.
    47  
    48  **Outbound Complexities**
    49   - `managedUpdateAndPersistAccounting` will use `callUpdateAccounting` to update
    50       the Accounting persistence before saving the persistence to disk.