mysqlindexer: keep map of gpg public key blobref -> keyid

Change-Id: I90f40d23bdaacf30f02e1ae20f17ec7844623e51
This commit is contained in:
Brad Fitzpatrick 2011-06-22 18:58:06 -07:00
parent 7456d6d405
commit 1f8723d30b
2 changed files with 14 additions and 1 deletions

View File

@ -18,7 +18,7 @@ package mysqlindexer
import ()
const requiredSchemaVersion = 11
const requiredSchemaVersion = 12
func SchemaVersion() int {
return requiredSchemaVersion
@ -87,5 +87,13 @@ INDEX (permanode))`,
`CREATE TABLE meta (
metakey VARCHAR(255) NOT NULL PRIMARY KEY,
value VARCHAR(255) NOT NULL)`,
// Map from blobref (of ASCII armored public key) to keyid
`CREATE TABLE signerkeyid (
blobref VARCHAR(128) NOT NULL,
PRIMARY KEY (blobref),
keyid VARCHAR(128) NOT NULL,
INDEX (keyid)
)`,
}
}

View File

@ -196,6 +196,11 @@ func (mi *Indexer) populateClaim(client *mysql.Client, blobRef *blobref.BlobRef,
if vr.Verify() {
verifiedKeyId = vr.SignerKeyId
log.Printf("mysqlindex: verified claim %s from %s", blobRef, verifiedKeyId)
if err = execSQL(client, "INSERT IGNORE INTO signerkeyid (blobref, keyid) "+
"VALUES (?, ?)", vr.CamliSigner.String(), verifiedKeyId); err != nil {
return
}
} else {
log.Printf("mysqlindex: verification failure on claim %s: %v", blobRef, vr.Err)
}