in reply to Re^2: Augmenting and reducing data structures
in thread Augmenting and reducing data structures
My question originates from a large software project that has a complex configuration structure.
Something similar to:
# cfg1 $config = { "common" => { debug => 1, logfile => "/var/log/project.log", path => "/opt/projects/bin", }, "project_1" => { name => "Project 1", tasks => [ { name => "Prepare", program => "p1prep", arguments => [ "--init", '--default' ], logfile => "/var/log/p1prep.log", }, { name => "Work", program => "p1", arguments => [ "--collect" ], logfile => "/var/log/p1.log", env => { DISPLAY => undef, }, }, { name => "Wrapup", program => "signal", arguments => [ "p1", "finished" ], }, ] }, "project_2" => { "and" => [ "so", "on", "..." ], }, };
A particular customer could supply her own config, e.g.
# cfg2 $config = { "common" => { debug => 0, logfile => "/var/log/project.log", path => "/opt/projects/bin", }, "project_1" => { name => "Project 1", tasks => [ { name => "Prepare", program => "p1prep", arguments => [ "--init", '--default' ], logfile => "/var/log/p1prep.log", }, { name => "Work", program => "p1", arguments => [ "--collect", "--brief" ], logfile => "/var/log/p1.log", env => { DISPLAY => undef, }, }, { name => "Wrapup", program => "signal", arguments => [ "p1", "finished" ], }, ] }, "project_2" => { "and" => [ "so", "on", "..." ], }, };
But instead of supplying a full config, it suffices to supply a smaller set of modifications:
# cfgaug $config = { "common" => { debug => 0 }, "project_1" => { tasks => [ { name => "Prepare" }, { name => "Work", arguments => [ "--collect", "--brief" ], }, { name => "Wrapup" }, ] }, };
Applying #cfgaug to #cfg1 will result in #cfg2.
Since several of these augmentations are possible, the need arises to produce a single 'delta' that augments the base configuration #cfg1 to the actual state.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Augmenting and reducing data structures
by LanX (Saint) on Apr 23, 2021 at 16:17 UTC | |
by sciurius (Beadle) on Apr 24, 2021 at 13:25 UTC | |
by LanX (Saint) on Apr 24, 2021 at 15:16 UTC | |
by sciurius (Beadle) on Apr 26, 2021 at 19:22 UTC |