alpha
Login
or
Join now
willdot.net
/
distributed-pds
forked from
willdot.net/cocoon
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
A fork of the Cocoon PDS but being made more distributed.
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
fix logging blockstore for reads
author
Hailey
date
11 months ago
(Jul 19, 2025, 10:53 AM -0700)
commit
cb89ee23
cb89ee235ab5c640d508d435f61d11be8ea6f899
parent
125b864f
125b864f150200359af56f4abe77385dc9d0227f
+12
-6
2 changed files
Expand all
Collapse all
Unified
Split
recording_blockstore
recording_blockstore.go
server
repo.go
+10
-4
recording_blockstore/recording_blockstore.go
Reviewed
···
13
13
base blockstore.Blockstore
14
14
15
15
inserts map[cid.Cid]blockformat.Block
16
16
+
reads map[cid.Cid]blockformat.Block
16
17
}
17
18
18
19
func New(base blockstore.Blockstore) *RecordingBlockstore {
···
27
28
}
28
29
29
30
func (bs *RecordingBlockstore) Get(ctx context.Context, c cid.Cid) (blockformat.Block, error) {
30
30
-
return bs.base.Get(ctx, c)
31
31
+
b, err := bs.base.Get(ctx, c)
32
32
+
if err != nil {
33
33
+
return nil, err
34
34
+
}
35
35
+
bs.reads[c] = b
36
36
+
return b, nil
31
37
}
32
38
33
39
func (bs *RecordingBlockstore) GetSize(ctx context.Context, c cid.Cid) (int, error) {
···
65
71
func (bs *RecordingBlockstore) HashOnRead(enabled bool) {
66
72
}
67
73
68
68
-
func (bs *RecordingBlockstore) GetLogMap() map[cid.Cid]blockformat.Block {
74
74
+
func (bs *RecordingBlockstore) GetWriteLog() map[cid.Cid]blockformat.Block {
69
75
return bs.inserts
70
76
}
71
77
72
72
-
func (bs *RecordingBlockstore) GetLogArray() []blockformat.Block {
78
78
+
func (bs *RecordingBlockstore) GetReadLog() []blockformat.Block {
73
79
var blocks []blockformat.Block
74
74
-
for _, b := range bs.inserts {
80
80
+
for _, b := range bs.reads {
75
81
blocks = append(blocks, b)
76
82
}
77
83
return blocks
+2
-2
server/repo.go
Reviewed
···
274
274
}
275
275
}
276
276
277
277
-
for _, op := range bs.GetLogMap() {
277
277
+
for _, op := range bs.GetWriteLog() {
278
278
if _, err := carstore.LdWrite(buf, op.Cid().Bytes(), op.RawData()); err != nil {
279
279
return nil, err
280
280
}
···
358
358
return cid.Undef, nil, err
359
359
}
360
360
361
361
-
return c, bs.GetLogArray(), nil
361
361
+
return c, bs.GetReadLog(), nil
362
362
}
363
363
364
364
func (rm *RepoMan) incrementBlobRefs(urepo models.Repo, cbor []byte) ([]cid.Cid, error) {