mirror of https://github.com/perkeep/perkeep.git
publishing work: index path mounts
Change-Id: I9e6f273289f136fbbfa8565c24be250e28ae1a6e
This commit is contained in:
parent
05c45e6989
commit
b2edc4a5f9
|
@ -18,7 +18,7 @@ package mysqlindexer
|
|||
|
||||
import ()
|
||||
|
||||
const requiredSchemaVersion = 12
|
||||
const requiredSchemaVersion = 14
|
||||
|
||||
func SchemaVersion() int {
|
||||
return requiredSchemaVersion
|
||||
|
@ -94,6 +94,21 @@ blobref VARCHAR(128) NOT NULL,
|
|||
PRIMARY KEY (blobref),
|
||||
keyid VARCHAR(128) NOT NULL,
|
||||
INDEX (keyid)
|
||||
)`,
|
||||
|
||||
|
||||
// Bi-direction index of camliPath claims
|
||||
`CREATE TABLE path (
|
||||
claimref VARCHAR(128) NOT NULL,
|
||||
PRIMARY KEY (claimref),
|
||||
claimdate VARCHAR(40) NOT NULL,
|
||||
keyid VARCHAR(128) NOT NULL,
|
||||
baseref VARCHAR(128) NOT NULL,
|
||||
suffix VARCHAR(255) NOT NULL,
|
||||
targetref VARCHAR(128) NOT NULL,
|
||||
INDEX (keyid),
|
||||
INDEX (targetref, keyid),
|
||||
INDEX (baseref, keyid)
|
||||
)`,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,6 +225,19 @@ func (mi *Indexer) populateClaim(client *mysql.Client, blobRef *blobref.BlobRef,
|
|||
return
|
||||
}
|
||||
}
|
||||
if strings.HasPrefix(camli.Attribute, "camliPath:") {
|
||||
// TODO: deal with set-attribute vs. del-attribute
|
||||
// properly? I think we get it for free when
|
||||
// del-attribute has no Value, but we need to deal
|
||||
// with the case where they explicitly delete the
|
||||
// current value.
|
||||
suffix := camli.Attribute[len("camliPath:"):]
|
||||
if err = execSQL(client, "INSERT IGNORE INTO path (claimref, claimdate, keyid, baseref, suffix, targetref) "+
|
||||
"VALUES (?, ?, ?, ?, ?, ?)",
|
||||
blobRef.String(), camli.ClaimDate, verifiedKeyId, camli.Permanode, suffix, camli.Value); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// And update the lastmod on the permanode row.
|
||||
|
|
Loading…
Reference in New Issue