Localize history selection to affected paths
This commit is contained in:
@@ -69,7 +69,7 @@ type historyModel struct {
|
||||
shapesByPointer map[string][]Path
|
||||
shapeOrder []Path
|
||||
observationsByPointer map[string][]int
|
||||
reportedPathIndex pathPrefixIndex
|
||||
affectedPathIndex pathPrefixIndex
|
||||
documentLookup *documentLookup
|
||||
|
||||
frozen bool
|
||||
@@ -127,14 +127,14 @@ func (builder *historyBuilder) addObservation(observation historyObservation) in
|
||||
builder.model.observations = append(builder.model.observations, observation)
|
||||
builder.addShape(observation.path)
|
||||
switch observation.role {
|
||||
case historyRoleDefinition, historyRoleContribution, historyRoleCompositeDefinition, historyRoleCheckpoint:
|
||||
case historyRoleDefinition, historyRoleContribution, historyRoleCompositeDefinition, historyRoleCheckpoint, historyRoleOperation, historyRoleControl:
|
||||
pointer := observation.path.String()
|
||||
builder.model.observationsByPointer[pointer] = append(builder.model.observationsByPointer[pointer], observationID)
|
||||
if observation.role == historyRoleContribution {
|
||||
builder.model.reportedPathIndex.insert(pointer, observationID)
|
||||
if observation.role == historyRoleContribution || observation.role == historyRoleOperation || observation.role == historyRoleControl {
|
||||
// Index the concrete affected path, not the common reported ancestor.
|
||||
// A leaf query must not enumerate every sibling fact of one operation.
|
||||
builder.model.affectedPathIndex.insert(pointer, observationID)
|
||||
}
|
||||
case historyRoleOperation, historyRoleControl:
|
||||
builder.model.reportedPathIndex.insert(observation.reportedPath.String(), observationID)
|
||||
}
|
||||
return observationID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user