3.1.4.4 Application Updates a Record

When the application requests that a record be updated, it MUST provide the following information:

  • Record ID: the record ID for an existing record to be modified.

The Peer-to-Peer Graphing Protocol MUST construct a new record using that field value. In addition, the application MAY provide values to replace the existing values in any or all of the following record fields. Otherwise, the existing field values MUST be preserved.

  • Attributes

  • Record Data

  • Expiration Time

New values for the following fields MAY be provided by the application. If not provided, default values MUST be used as specified below:

  • Last Modified By ID. The default value is the Peer ID.

Any other field provided by the application MUST be ignored by the protocol.

Record construction MUST then be completed as follows:

  • The value of the Record Version of the existing record MUST be incremented by 1.

  • If the application has provided new attributes, the value of the Attribute field of the existing record MUST be replaced with the data provided.

  • If the application has provided Record Data, the value of the Record Data field of the existing record MUST be replaced with the data provided.

  • If the application has provided an Expiration Time, the value of the Expiration Time field of the existing record MUST be replaced with the data provided.

  • The value of the field Modified By of the existing record MUST be replaced with the data provided.

The record MUST then be validated according to the following steps:

  • The provided Record ID MUST match an existing record in the database.

  • The existing record MUST NOT be marked as Deleted.

  • The size of the record MUST be less than the Max Record Size. For more details, see section 3.1.1.

  • The updated Expiration Time MUST NOT be before the original Expiration Time.

  • The Record Type MUST NOT be in the reserved range (see section 2.2.1.9).

  • The Autorefresh Flag MUST NOT be set.

  • The Attributes MUST conform to the syntax specified in section2.2.3.5.

If the record validation fails for any reason, then the record MUST NOT be processed further and an error MUST be returned to the application.

If a Security Provider is specified for the Group, it MUST be called to secure the record. For more details, see section 3.1.7.28.

The record MUST then be written in the database, as specified in section 3.1.7.8.