diff options
-rw-r--r-- | src/session.ml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/session.ml b/src/session.ml index b59b473..ff1cce7 100644 --- a/src/session.ml +++ b/src/session.ml @@ -38,3 +38,16 @@ let rec apply_changes changeset config = match changeset with | [] -> config | c :: cs -> apply_changes cs (apply_cfg_op c config) + +let set w s path = + let path, value = RT.validate_path w.validators w.reference_tree path in + let value_behaviour = if RT.is_multi w.reference_tree path then CT.AddValue else CT.ReplaceValue in + let op = CfgSet (path, value, value_behaviour) in + let config = apply_cfg_op op s.proposed_config in + {s with proposed_config=config; changeset=(op :: s.changeset)} + +let delete w s path = + let path, value = RT.validate_path w.validators w.reference_tree path in + let op = CfgDelete (path, value) in + let config = apply_cfg_op op s.proposed_config in + {s with proposed_config=config; changeset=(op :: s.changeset)} |