[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-go] branch master updated: Store expire in microseconds in meta
From: |
gnunet |
Subject: |
[gnunet-go] branch master updated: Store expire in microseconds in meta db. |
Date: |
Thu, 25 Aug 2022 11:00:17 +0200 |
This is an automated email from the git hooks/post-receive script.
bernd-fix pushed a commit to branch master
in repository gnunet-go.
The following commit(s) were added to refs/heads/master by this push:
new 915c050 Store expire in microseconds in meta db.
915c050 is described below
commit 915c050130855f83c2f58c44682396bcf4d5275b
Author: Bernd Fix <brf@hoi-polloi.org>
AuthorDate: Thu Aug 25 10:58:28 2022 +0200
Store expire in microseconds in meta db.
---
src/gnunet/service/dht/messages.go | 1 +
src/gnunet/service/store/store_dht_meta.go | 17 +++++++----------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/gnunet/service/dht/messages.go
b/src/gnunet/service/dht/messages.go
index 6383dc6..9fedd10 100644
--- a/src/gnunet/service/dht/messages.go
+++ b/src/gnunet/service/dht/messages.go
@@ -602,6 +602,7 @@ func (m *Module) sendResult(ctx context.Context, query
blocks.Query, blk blocks.
/*
// DEBUG:
if out.BType == enums.BLOCK_TYPE_TEST {
+ logger.Printf(logger.DBG, "result message = %s",
util.Dump(out, "hex"))
logger.Printf(logger.DBG, "result message = %s",
util.Dump(out, "json"))
}
*/
diff --git a/src/gnunet/service/store/store_dht_meta.go
b/src/gnunet/service/store/store_dht_meta.go
index 3564328..64f658b 100644
--- a/src/gnunet/service/store/store_dht_meta.go
+++ b/src/gnunet/service/store/store_dht_meta.go
@@ -100,7 +100,7 @@ func (db *FileMetaDB) Store(md *FileMetadata) (err error) {
sql := "replace into
meta(qkey,btype,bhash,size,stored,expires,lastUsed,usedCount)
values(?,?,?,?,?,?,?,?)"
_, err = db.conn.Exec(sql,
md.key.Data, md.btype, md.bhash.Data, md.size,
md.stored.Epoch(),
- md.expires.Epoch(), md.lastUsed.Epoch(), md.usedCount)
+ md.expires.Val, md.lastUsed.Epoch(), md.usedCount)
return
}
@@ -123,8 +123,8 @@ func (db *FileMetaDB) Get(query blocks.Query) (mds
[]*FileMetadata, err error) {
md := NewFileMetadata()
md.key = query.Key()
md.btype = btype
- var st, exp, lu uint64
- if err = rows.Scan(&md.size, &md.bhash.Data, &st, &exp, &lu,
&md.usedCount); err != nil {
+ var st, lu uint64
+ if err = rows.Scan(&md.size, &md.bhash.Data, &st,
&md.expires.Val, &lu, &md.usedCount); err != nil {
if err == sql.ErrNoRows {
md = nil
err = nil
@@ -132,7 +132,6 @@ func (db *FileMetaDB) Get(query blocks.Query) (mds
[]*FileMetadata, err error) {
return
}
md.stored.Val = st * 1000000
- md.expires.Val = exp * 1000000
md.lastUsed.Val = lu * 1000000
mds = append(mds, md)
}
@@ -172,12 +171,11 @@ func (db *FileMetaDB) Obsolete(n int) (removable
[]*FileMetadata, err error) {
}
var md *FileMetadata
for rows.Next() {
- var st, exp, lu uint64
- if err = rows.Scan(&md.key, &md.btype, &md.size, &st, &exp,
&lu, &md.usedCount); err != nil {
+ var st, lu uint64
+ if err = rows.Scan(&md.key, &md.btype, &md.size, &st,
&md.expires.Val, &lu, &md.usedCount); err != nil {
return
}
md.stored.Val = st * 1000000
- md.expires.Val = exp * 1000000
md.lastUsed.Val = lu * 1000000
removable = append(removable, md)
}
@@ -193,13 +191,12 @@ func (db *FileMetaDB) Traverse(f func(*FileMetadata))
error {
}
md := NewFileMetadata()
for rows.Next() {
- var st, exp, lu uint64
- err = rows.Scan(&md.key.Data, &md.btype, &md.bhash.Data,
&md.size, &st, &exp, &lu, &md.usedCount)
+ var st, lu uint64
+ err = rows.Scan(&md.key.Data, &md.btype, &md.bhash.Data,
&md.size, &st, &md.expires.Val, &lu, &md.usedCount)
if err != nil {
return err
}
md.stored.Val = st * 1000000
- md.expires.Val = exp * 1000000
md.lastUsed.Val = lu * 1000000
// call process function
f(md)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet-go] branch master updated: Store expire in microseconds in meta db.,
gnunet <=