示例#1
0
//setEntry stores stamp/value.
func setEntry(tx *bolt.Tx, stamp int64, filekey string) {
	sb := db.MustTob(stamp)
	fb := db.MustTob(filekey)
	err := db.Put(tx, "keylibST", sb, fb)
	if err != nil {
		panic(err)
	}
	err = db.Put(tx, "keylibTS", fb, sb)
	if err != nil {
		panic(err)
	}
}
示例#2
0
//appendHead add a infos generated from the record.
func appendHead(tx *bolt.Tx, rec *record.Head) {
	if find(rec) {
		return
	}
	k := rec.ToKey()
	err := db.Put(tx, "recent", k, rec)
	if err != nil {
		log.Print(err)
	}
}
示例#3
0
//Put puts this one to db.
func (d *DB) Put(tx *bolt.Tx) error {
	return db.Put(tx, "record", d.Head.ToKey(), d)
}
示例#4
0
//subscribe add the thread to thread db.
func (c *Cache) subscribe(tx *bolt.Tx) {
	err := db.Put(tx, "thread", []byte(c.Datfile), []byte(""))
	if err != nil {
		log.Print(err)
	}
}