Skip to content

Commit

Permalink
fix: update ipni publisher dep (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanshaw authored Nov 12, 2024
1 parent a746556 commit c7c2f7d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.23.0
toolchain go1.23.2

require (
github.com/aws/aws-sdk-go v1.45.24
github.com/aws/aws-sdk-go-v2 v1.32.4
github.com/aws/aws-sdk-go-v2/service/s3 v1.65.3
github.com/golang-jwt/jwt/v4 v4.5.1
Expand All @@ -22,16 +23,15 @@ require (
github.com/storacha/go-jobqueue v0.0.0-20241103222443-bb7a7b589719
github.com/storacha/go-metadata v0.0.0-20241021141939-f94d93dcda78
github.com/storacha/go-ucanto v0.2.1-0.20241110061414-d4eb802c541b
github.com/storacha/ipni-publisher v0.0.0-20241112113514-13e9ce371678
github.com/storacha/ipni-publisher v0.0.0-20241112152400-07a540928427
github.com/stretchr/testify v1.9.0
github.com/urfave/cli/v2 v2.27.4
)

require (
github.com/aws/aws-sdk-go v1.45.24 // indirect
github.com/filecoin-project/go-address v1.1.0 // indirect
github.com/filecoin-project/go-fil-commcid v0.2.0 // indirect
github.com/ipfs/go-ds-s3 v0.11.0 // indirect
github.com/ipfs/go-peertaskqueue v0.8.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
Expand Down
17 changes: 7 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,6 @@ github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ
github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps=
github.com/ipfs/go-ds-leveldb v0.5.0 h1:s++MEBbD3ZKc9/8/njrn4flZLnCuY9I79v94gBUNumo=
github.com/ipfs/go-ds-leveldb v0.5.0/go.mod h1:d3XG9RUDzQ6V4SHi8+Xgj9j1XuEk1z82lquxrVbml/Q=
github.com/ipfs/go-ds-s3 v0.11.0 h1:Adsu/Ee0zyh44ZndwUtFGH4WKpXxlmuRhOesr58BkPM=
github.com/ipfs/go-ds-s3 v0.11.0/go.mod h1:7D06YGOYL0QKd+celKhFMTyKfX4pDCP+uPZipkKxlXw=
github.com/ipfs/go-ipfs-blockstore v1.3.1 h1:cEI9ci7V0sRNivqaOr0elDsamxXFxJMMMy7PTTDQNsQ=
github.com/ipfs/go-ipfs-blockstore v1.3.1/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE=
github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ=
Expand All @@ -307,8 +305,8 @@ github.com/ipfs/go-ipfs-exchange-interface v0.2.1 h1:jMzo2VhLKSHbVe+mHNzYgs95n0+
github.com/ipfs/go-ipfs-exchange-interface v0.2.1/go.mod h1:MUsYn6rKbG6CTtsDp+lKJPmVt3ZrCViNyH3rfPGsZ2E=
github.com/ipfs/go-ipfs-exchange-offline v0.3.0 h1:c/Dg8GDPzixGd0MC8Jh6mjOwU57uYokgWRFidfvEkuA=
github.com/ipfs/go-ipfs-exchange-offline v0.3.0/go.mod h1:MOdJ9DChbb5u37M1IcbrRB02e++Z7521fMxqCNRrz9s=
github.com/ipfs/go-ipfs-pq v0.0.2 h1:e1vOOW6MuOwG2lqxcLA+wEn93i/9laCY8sXAw76jFOY=
github.com/ipfs/go-ipfs-pq v0.0.2/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY=
github.com/ipfs/go-ipfs-pq v0.0.3 h1:YpoHVJB+jzK15mr/xsWC574tyDLkezVrDNeaalQBsTE=
github.com/ipfs/go-ipfs-pq v0.0.3/go.mod h1:btNw5hsHBpRcSSgZtiNm/SLj5gYIZ18AKtv3kERkRb4=
github.com/ipfs/go-ipfs-routing v0.3.0 h1:9W/W3N+g+y4ZDeffSgqhgo7BsBSJwPMcyssET9OWevc=
github.com/ipfs/go-ipfs-routing v0.3.0/go.mod h1:dKqtTFIql7e1zYsEuWLyuOU+E0WJWW8JjbTPLParDWo=
github.com/ipfs/go-ipfs-util v0.0.3 h1:2RFdGez6bu2ZlZdI+rWfIdbQb1KudQp3VGwPtdNCmE0=
Expand All @@ -328,8 +326,8 @@ github.com/ipfs/go-merkledag v0.11.0 h1:DgzwK5hprESOzS4O1t/wi6JDpyVQdvm9Bs59N/jq
github.com/ipfs/go-merkledag v0.11.0/go.mod h1:Q4f/1ezvBiJV0YCIXvt51W/9/kqJGH4I1LsA7+djsM4=
github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg=
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
github.com/ipfs/go-peertaskqueue v0.8.0 h1:JyNO144tfu9bx6Hpo119zvbEL9iQ760FHOiJYsUjqaU=
github.com/ipfs/go-peertaskqueue v0.8.0/go.mod h1:cz8hEnnARq4Du5TGqiWKgMr/BOSQ5XOgMOh1K5YYKKM=
github.com/ipfs/go-peertaskqueue v0.8.1 h1:YhxAs1+wxb5jk7RvS0LHdyiILpNmRIRnZVztekOF0pg=
github.com/ipfs/go-peertaskqueue v0.8.1/go.mod h1:Oxxd3eaK279FxeydSPPVGHzbwVeHjatZ2GA8XD+KbPU=
github.com/ipfs/go-test v0.0.4 h1:DKT66T6GBB6PsDFLoO56QZPrOmzJkqU1FZH5C9ySkew=
github.com/ipfs/go-test v0.0.4/go.mod h1:qhIM1EluEfElKKM6fnWxGn822/z9knUGM1+I/OAQNKI=
github.com/ipfs/go-verifcid v0.0.3 h1:gmRKccqhWDocCRkC+a59g5QW7uJw5bpX9HWBevXa0zs=
Expand All @@ -353,6 +351,7 @@ github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0
github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
Expand Down Expand Up @@ -572,10 +571,8 @@ github.com/storacha/go-piece v0.0.0-20241110131739-7631aadb97ea h1:/CaHFss3pJrWk
github.com/storacha/go-piece v0.0.0-20241110131739-7631aadb97ea/go.mod h1:lV3s4aCpSZn9srVjfDTsIAqx3MbO8Y/7JH2M/esSZcM=
github.com/storacha/go-ucanto v0.2.1-0.20241110061414-d4eb802c541b h1:VrHLcBUCVArxh996EV2mfQVqgj8j4K21TbDRM4PFG/4=
github.com/storacha/go-ucanto v0.2.1-0.20241110061414-d4eb802c541b/go.mod h1:7ba9jAgqmwlF/JfyFUQcGV07uiYNlmJNu8qH4hHtrJk=
github.com/storacha/ipni-publisher v0.0.0-20241031171227-f59f9fc3b0b8 h1:X+xD2xdNq2kQQdkcoTUTUMcG1zVGAYn5VXsQtb6vClU=
github.com/storacha/ipni-publisher v0.0.0-20241031171227-f59f9fc3b0b8/go.mod h1:oeRwCqtWAhWodWYYVklunZbetcp/CuEn4Q+KL0zOIR0=
github.com/storacha/ipni-publisher v0.0.0-20241112113514-13e9ce371678 h1:4MDJLcETSnNd5Y8k5Ddh0QGpxKBsoTvZaW8WguYel1M=
github.com/storacha/ipni-publisher v0.0.0-20241112113514-13e9ce371678/go.mod h1:oeRwCqtWAhWodWYYVklunZbetcp/CuEn4Q+KL0zOIR0=
github.com/storacha/ipni-publisher v0.0.0-20241112152400-07a540928427 h1:RoP1oLKNH4OXA37h4XgZIPSgFyyRuP3vM4DLbzjc2hk=
github.com/storacha/ipni-publisher v0.0.0-20241112152400-07a540928427/go.mod h1:RSXcupgcsMXuFCrk+fqJHTfJKUNygt7bPFe5yJ+V9tE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/ipldstore/ipldstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (i *ipldStore[K, V]) Put(ctx context.Context, key K, value V) error {
if err != nil {
return err
}
return i.ds.Put(ctx, key.String(), bytes.NewReader(data))
return i.ds.Put(ctx, key.String(), uint64(len(data)), bytes.NewReader(data))
}

func IPLDStore[K fmt.Stringer, V any](ds store.Store, typ schema.Type, opts ...bindnode.Option) KVStore[K, V] {
Expand Down
7 changes: 6 additions & 1 deletion pkg/store/delegationstore/store.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package delegationstore

import (
"bytes"
"context"
"fmt"
"io"
Expand All @@ -15,7 +16,11 @@ type delegationStore struct {
}

func (d *delegationStore) Put(ctx context.Context, dlg delegation.Delegation) error {
err := d.data.Put(ctx, dlg.Link().String(), dlg.Archive())
b, err := io.ReadAll(dlg.Archive())
if err != nil {
return fmt.Errorf("archiving delegation: %w", err)
}
err = d.data.Put(ctx, dlg.Link().String(), uint64(len(b)), bytes.NewReader(b))
if err != nil {
return fmt.Errorf("writing to datastore: %w", err)
}
Expand Down
8 changes: 7 additions & 1 deletion pkg/store/receiptstore/receiptstore.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package receiptstore

import (
"bytes"
"context"
"fmt"
"io"
Expand All @@ -27,7 +28,12 @@ type receiptStore struct {
func (rs *receiptStore) Put(ctx context.Context, rcpt receipt.AnyReceipt) error {
r := car.Encode([]datamodel.Link{rcpt.Root().Link()}, rcpt.Blocks())

err := rs.store.Put(ctx, rcpt.Root().Link().String(), r)
b, err := io.ReadAll(r)
if err != nil {
return fmt.Errorf("archiving delegation: %w", err)
}

err = rs.store.Put(ctx, rcpt.Root().Link().String(), uint64(len(b)), bytes.NewReader(b))
if err != nil {
return fmt.Errorf("writing to store: %w", err)
}
Expand Down

0 comments on commit c7c2f7d

Please sign in to comment.