Integrate history prefixes into load handoffs
This commit is contained in:
@@ -13,6 +13,16 @@ type Metadata struct {
|
||||
historyModel *historyModel
|
||||
}
|
||||
|
||||
func (m Metadata) currentHistoryModel() *historyModel {
|
||||
if m.historyModel != nil {
|
||||
return m.historyModel
|
||||
}
|
||||
if m.historyBuilder != nil {
|
||||
return m.historyBuilder.model
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Lookup returns information for an effective path. Unknown and invalid paths
|
||||
// return false.
|
||||
func (m Metadata) Lookup(path Path) (FieldInfo, bool) {
|
||||
@@ -152,6 +162,21 @@ func finalizeMetadataPaths(m *Metadata, final *document.Node, applications []his
|
||||
func finalizeMetadataPathsWithResolution(m *Metadata, final *document.Node, applications []historyApplication, snapshots []resolutionSnapshot, earlier ...*document.Node) {
|
||||
finalizeEffectiveMetadataPaths(m, final)
|
||||
builder := m.historyBuilder
|
||||
if builder != nil && builder.prefixReady {
|
||||
if len(snapshots) != 0 && builder.model.resolutionPayload == nil {
|
||||
if len(earlier) != 0 {
|
||||
builder.setScratch(earlier[len(earlier)-1])
|
||||
}
|
||||
builder.observeResolutionEvidence(snapshots)
|
||||
}
|
||||
if builder.model.final != final {
|
||||
builder.model.final = final
|
||||
builder.registerDocumentRoot(final)
|
||||
}
|
||||
m.historyModel = builder.freeze()
|
||||
m.historyBuilder = nil
|
||||
return
|
||||
}
|
||||
if builder == nil {
|
||||
builder = newHistoryBuilder()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user