+1
recording_blockstore/recording_blockstore.go
+1
recording_blockstore/recording_blockstore.go
+10
-8
server/handle_sync_get_blocks.go
+10
-8
server/handle_sync_get_blocks.go
···
11
"github.com/labstack/echo/v4"
12
)
13
14
func (s *Server) handleGetBlocks(e echo.Context) error {
15
ctx := e.Request().Context()
16
-
did := e.QueryParam("did")
17
-
if did == "" {
18
-
return helpers.InputError(e, nil)
19
-
}
20
21
-
cidstrs, ok := e.QueryParams()["cids"]
22
-
if !ok {
23
return helpers.InputError(e, nil)
24
}
25
var cids []cid.Cid
26
27
-
for _, cs := range cidstrs {
28
c, err := cid.Cast([]byte(cs))
29
if err != nil {
30
return err
···
33
cids = append(cids, c)
34
}
35
36
-
urepo, err := s.getRepoActorByDid(did)
37
if err != nil {
38
return helpers.ServerError(e, nil)
39
}
···
11
"github.com/labstack/echo/v4"
12
)
13
14
+
type ComAtprotoSyncGetBlocksRequest struct {
15
+
Did string `query:"did"`
16
+
Cids []string `query:"cids"`
17
+
}
18
+
19
func (s *Server) handleGetBlocks(e echo.Context) error {
20
ctx := e.Request().Context()
21
22
+
var req ComAtprotoSyncGetBlocksRequest
23
+
if err := e.Bind(&req); err != nil {
24
return helpers.InputError(e, nil)
25
}
26
+
27
var cids []cid.Cid
28
29
+
for _, cs := range req.Cids {
30
c, err := cid.Cast([]byte(cs))
31
if err != nil {
32
return err
···
35
cids = append(cids, c)
36
}
37
38
+
urepo, err := s.getRepoActorByDid(req.Did)
39
if err != nil {
40
return helpers.ServerError(e, nil)
41
}
+1
-1
server/repo.go
+1
-1
server/repo.go
-18
sqlite_blockstore/sqlite_blockstore.go
-18
sqlite_blockstore/sqlite_blockstore.go
···
135
func (bs *SqliteBlockstore) HashOnRead(enabled bool) {
136
panic("not implemented")
137
}
138
-
139
-
func (bs *SqliteBlockstore) Execute(ctx context.Context) error {
140
-
if !bs.readonly {
141
-
return fmt.Errorf("blockstore was not readonly")
142
-
}
143
-
144
-
bs.readonly = false
145
-
for _, b := range bs.inserts {
146
-
bs.Put(ctx, b)
147
-
}
148
-
bs.readonly = true
149
-
150
-
return nil
151
-
}
152
-
153
-
func (bs *SqliteBlockstore) GetLog() map[cid.Cid]blocks.Block {
154
-
return bs.inserts
155
-
}