Configurations (tasks)

The configurations are read from the permanent storage and kept in memory until a new profile is loaded or RsyncOSX quits. Each record (one task) are read from permanent storage as a NSDictionary item, copied to a Configuration and loaded into an Array<Configuration>.

  • the struct Configuration.swift holds data about one task
  • the class Configurations.swift holds all computed data and methods operating on tasks
    • the object is also responsible for initiate reading data from permanent store when the object is created
    • the object is also responsible for initiate a write operation after any change in configurations

Every time configurations are read from permanent store, the rsync arguments are computed and the result is stored in memory only by the struct ArgumentsOneConfiguration.swift. There are four types of arguments which are computed during startup, arguments for --dry-run and real run and both arguments for presentation on screen. Each configuration is allocated a uniq computed nonsense key hiddenID = Int.

The class Configurations.swift creates an Array<NSMutableDictionary> which holds all data about Configuration.swift and computed values of rsync arguments. Computed values are not saved to permanent storage. They are computed either when RsyncOSX starts or when a new profile is loaded. Any changes (change, delete, new operations) causes a read from permanent store.

Changes to configurations

Changes to configurations (change, delete, new, parameters to rsync) is a three step operation:

  • any change, delete, new or parameters to rsync operations on configurations are updated in memory (to the Array<Configuration>)
  • any change, delete or add operation causes a write operation from memory to permanent store of all configurations
  • the object Configurations.swift is created, a read operation is initiated and new values are computed There is no need for partly updates and it secures a 100% correct and updated configuration in memory at all time.
Written on March 10, 2018