ObservableJsonTrace

Namespace: SnowBank.Data.Json · class

Recording of all the nodes of a JSON document that were accessed by a previous computation.

Remarks

This holds the values of all the fields and items that were read, which can then be compared against a new revision of the document, in order to determine if the same computation would now produce a different result.

Constructors

ObservableJsonTrace

ObservableJsonTrace()

Methods

Add

void Add(JsonPathSegment segment, ObservableJsonAccess access, JsonValue value)

Records the access to a direct child of top-level document

  • segment — Name or index of the child that was accessed
  • access — Type of access
  • value — Captured value of the child

void Add(ReadOnlySpan<JsonPathSegment> path, ObservableJsonAccess access, JsonValue value)

Records the access to a node of the document

  • path — Path to the node that was accessed
  • access — Type of access
  • value — Captured value of the node

Clear

void Clear()

Clears all records from this trace

After this call, this instance can be reused for a new capture session

GetRecords

List<(JsonPath, ObservableJsonAccess, JsonValue)> GetRecords()

Returns all the access records captured by this trace

IsMatch

bool IsMatch(JsonValue value)

Tests if all nodes captured by this trace are still equal in a new version of the JSON document

  • value — New version of the document

Returns: true if value would produce the exact same trace than the previous version, or false if there is at least one difference.

Fields

Root

Node Root

Root node of the document