The Add Edit maximum API is used to insert or move new list or leaf-list entries to the transaction in progress and also controls whether the server should invoke callbacks for added edits or not.
Manipulation with datastore are only allowed for Set Hook or Post Set Hook callbacks. If Transaction Hook or Start/Complete Transaction callbacks call add_edit_ex() or _max the operation will be ignored. Do not return error just ignore add_edit_ex or _max calls.

The following function template definition is used for Add Edit Maximum API callback functions:


/* FUNCTION agt_val_add_edit_max */
status_t
    agt_val_add_edit_max (ses_cb_t *scb,
                          rpc_msg_t *msg,
                          agt_cfg_transaction_t *txcb,
                          const xmlChar *defpath,
                          val_value_t *edit_value,
                          const xmlChar *edit_operation,
                          const xmlChar *insert_where,
                          const xmlChar *insert_point,
                          boolean skip_cb);


API Template

  • Type:  Server Utility Function
  • File: agt_val.h
  • Template:  agt_val_add_edit_max
    • Inputs:
      • scb == session control block making the request
      • msg == incoming rpc_msg_t in progress
      • txcb == transaction control block in progress
      • defpath == XPath expression specifying the data instance to add
      • edit_value == val_value_t representing newnode in transaction only needed for create, merge, replace, insert. Ignored for delete or remove
      • edit_operation == <operation string> E.g.: "create" "delete" "insert" "merge" "move" "replace" "remove"
      • insert_where == <insert enum string>. Will be used only if operations are "move" or "insert". Ignored otherwise. E.g.: "before" "after" "first" "last"
      • insert_point == is a XPath encoded string like the defpath. Only for “before” or “after” insert_where parameter. The insert_where must be set to “before” or “after” if insert_point specified. Will be used only if the operations are "move" or "insert". Ignored otherwise. E.g: "/test3[string.1='entry2'][uint32.1='2']"
      • skip_cb ==TRUE if DO NOT invoke callbacks for an edded edit if any. FALSE if SKIP any callback for added edit including Transaction, EDIT1, EDIT2 callbacks. Only when --target=running.
    • Outputs: none
    • Returns: status_t: Status of the operation;

NOTE:

The server does not support the "insert" and "move" operation on the nodes that are being modified at the same transaction at the same time. That's if the server already has an undo record (an edit on specific node), then the "insert" or "move" add_edit_ex() or add_edit_max() API on the same specific node will return an error. The server will only insert a new nodes and move only existent nodes. It will not move a new nodes or a nodes that are being already modified.


Skip_cb parameter can be used only when the default target <running>. Otherwise; the server always invoke callback for added edits in case the default target is <candidate>.


For SIL-SA version refer to How do I use SIL-SA version of Set Hook to add a new node?