tangled
alpha
login
or
join now
julien.rbrt.fr
/
vow
forked from
hailey.at/cocoon
0
fork
atom
Vow, uncensorable PDS written in Go
0
fork
atom
overview
issues
pulls
pipelines
fix: fix conflict mess
julien.rbrt.fr
2 days ago
bb9543f3
9e22c55c
+10
-17
2 changed files
expand all
collapse all
unified
split
server
handle_import_repo.go
repo.go
+5
-6
server/handle_import_repo.go
···
9
9
"strings"
10
10
11
11
"github.com/bluesky-social/indigo/atproto/syntax"
12
12
-
"github.com/bluesky-social/indigo/repo"
13
12
blocks "github.com/ipfs/go-block-format"
14
13
"github.com/ipfs/go-cid"
15
14
"github.com/ipld/go-car"
···
64
63
return
65
64
}
66
65
67
67
-
r, err := openRepo(context.TODO(), bs, cs.Header.Roots[0], urepo.Repo.Did)
66
66
+
atRepo, err := openRepo(context.TODO(), bs, cs.Header.Roots[0], urepo.Repo.Did)
68
67
if err != nil {
69
68
logger.Error("could not open repo", "error", err)
70
69
helpers.ServerError(w, nil)
···
75
74
76
75
clock := syntax.NewTIDClock(0)
77
76
78
78
-
if err := r.MST.Walk(func(key []byte, cid cid.Cid) error {
77
77
+
if err := atRepo.MST.Walk(func(key []byte, recordCid cid.Cid) error {
79
78
pts := strings.Split(string(key), "/")
80
79
nsid := pts[0]
81
80
rkey := pts[1]
82
82
-
cidStr := c.String()
83
83
-
blkData, err := bs.Get(context.TODO(), c)
81
81
+
cidStr := recordCid.String()
82
82
+
blkData, err := bs.Get(context.TODO(), recordCid)
84
83
if err != nil {
85
84
logger.Error("record bytes don't exist in blockstore", "error", err)
86
85
return err
···
109
108
110
109
tx.Commit()
111
110
112
112
-
root, rev, err := commitRepo(context.TODO(), bs, r, urepo.Repo.SigningKey)
111
111
+
root, rev, err := commitRepo(context.TODO(), bs, atRepo, urepo.SigningKey)
113
112
if err != nil {
114
113
logger.Error("error committing", "error", err)
115
114
helpers.ServerError(w, nil)
+5
-11
server/repo.go
···
19
19
"github.com/bluesky-social/indigo/carstore"
20
20
"github.com/bluesky-social/indigo/events"
21
21
lexutil "github.com/bluesky-social/indigo/lex/util"
22
22
-
"github.com/bluesky-social/indigo/repo"
23
22
blocks "github.com/ipfs/go-block-format"
24
23
"github.com/ipfs/go-cid"
24
24
+
blockstore "github.com/ipfs/go-ipfs-blockstore"
25
25
cbor "github.com/ipfs/go-ipld-cbor"
26
26
"github.com/ipld/go-car"
27
27
+
"github.com/multiformats/go-multihash"
27
28
"gorm.io/gorm/clause"
28
29
"pkg.rbrt.fr/vow/internal/db"
29
30
"pkg.rbrt.fr/vow/metrics"
···
143
144
Rev string `json:"rev"`
144
145
}
145
146
146
146
-
func openRepo(ctx context.Context, bs blockstore.Blockstore, rootCid cid.Cid, did string) (*atp.Repo, error) {
147
147
+
func openRepo(ctx context.Context, bs blockstore.Blockstore, rootCid cid.Cid, did string) (*atp.Repo, error) { //nolint:staticcheck
147
148
commitBlock, err := bs.Get(ctx, rootCid)
148
149
if err != nil {
149
150
return nil, fmt.Errorf("reading commit block: %w", err)
···
168
169
}, nil
169
170
}
170
171
171
171
-
func commitRepo(ctx context.Context, bs blockstore.Blockstore, r *atp.Repo, signingKey []byte) (cid.Cid, string, error) {
172
172
+
func commitRepo(ctx context.Context, bs blockstore.Blockstore, r *atp.Repo, signingKey []byte) (cid.Cid, string, error) { //nolint:staticcheck
172
173
if _, err := r.MST.WriteDiffBlocks(ctx, bs); err != nil {
173
174
return cid.Undef, "", fmt.Errorf("writing MST blocks: %w", err)
174
175
}
···
208
209
return commitCid, commit.Rev, nil
209
210
}
210
211
211
211
-
func putRecordBlock(ctx context.Context, bs blockstore.Blockstore, rec *MarshalableMap) (cid.Cid, error) {
212
212
+
func putRecordBlock(ctx context.Context, bs blockstore.Blockstore, rec *MarshalableMap) (cid.Cid, error) { //nolint:staticcheck
212
213
buf := new(bytes.Buffer)
213
214
if err := rec.MarshalCBOR(buf); err != nil {
214
215
return cid.Undef, err
···
240
241
241
242
dbs := rm.s.getBlockstore(urepo.Did)
242
243
bs := recording_blockstore.New(dbs)
243
243
-
<<<<<<< HEAD
244
244
-
=======
245
245
-
r, err := repo.OpenRepo(ctx, bs, rootcid)
246
246
-
if err != nil {
247
247
-
return nil, fmt.Errorf("error opening repo: %w", err)
248
248
-
}
249
249
-
>>>>>>> 4a24227 (refactor: fix lint + configure tangled ci)
250
244
251
245
var results []ApplyWriteResult
252
246
var ops []*atp.Operation