Skip to content

Commit 0c0393f

Browse files
committed
feat(pieceio): complete extraction
complete extracting PieceIO from go-fil-markets
1 parent c3b4ecf commit 0c0393f

File tree

7 files changed

+134
-709
lines changed

7 files changed

+134
-709
lines changed

go.mod

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@ go 1.15
55
require (
66
github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200910194244-f640612a1a1f
77
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a
8+
github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335
9+
github.com/filecoin-project/go-multistore v0.0.3
810
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20
911
github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc
10-
github.com/filecoin-project/lotus v1.2.0
12+
github.com/ipfs/go-block-format v0.0.2
1113
github.com/ipfs/go-cid v0.0.7
14+
github.com/ipfs/go-datastore v0.4.5
15+
github.com/ipfs/go-ipfs-blockstore v1.0.3
1216
github.com/ipfs/go-log/v2 v2.1.2-0.20200626104915-0016c0b4b3e4
17+
github.com/ipfs/go-merkledag v0.3.2
18+
github.com/ipld/go-car v0.1.1-0.20201119040415-11b6074b6d4d
19+
github.com/ipld/go-ipld-prime v0.5.1-0.20201021195245-109253e8a018
1320
github.com/stretchr/testify v1.6.1
1421
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
1522
)

go.sum

Lines changed: 117 additions & 683 deletions
Large diffs are not rendered by default.

pieceio/README.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ storing pieces for storage market deals. It is used by the
66

77
## Installation
88
```bash
9-
go get github.com/filecoin-project/go-fil-markets/pieceio
9+
go get github.com/filecoin-project/go-commp-utils/pieceio
1010
```
1111

1212
## PieceIO
@@ -23,24 +23,6 @@ func NewPieceIO(carIO CarIO, bs blockstore.Blockstore) PieceIO
2323
* `bs` is an IPFS blockstore for storing and retrieving data for deals. See
2424
[github.com/ipfs/go-ipfs-blockstore](github.com/ipfs/go-ipfs-blockstore).
2525

26-
## PieceIOWithStore
27-
`PieceIOWithStore` is `PieceIO` with a [`filestore`](../filestore). It is used by
28-
[`storagemarket`](../storagemarket) provider to store pieces, and to generate and store piece commitments
29-
and piece metadata for deals.
30-
31-
**To initialize a PieceIOWithStore:**
32-
33-
```go
34-
package pieceio
35-
36-
func NewPieceIOWithStore(carIO CarIO, store filestore.FileStore, bs blockstore.Blockstore) PieceIOWithStore
37-
```
38-
**Parameters**
39-
* `carIO` is a [CarIO](#CarIO) from this module
40-
* `store` is a [FileStore](../filestore) from this go-fil-markets repo.
41-
* `bs` is an IPFS blockstore for storing and retrieving data for deals. See
42-
[github.com/ipfs/go-ipfs-blockstore](github.com/ipfs/go-ipfs-blockstore).
43-
4426
## CarIO
4527
CarIO is a utility module that wraps [github.com/ipld/go-car](https://github.com/ipld/go-car) for use by storagemarket.
4628

pieceio/cario/cario.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/ipld/go-car"
1010
"github.com/ipld/go-ipld-prime"
1111

12-
"github.com/filecoin-project/go-fil-markets/pieceio"
12+
"github.com/filecoin-project/go-commp-utils/pieceio"
1313
)
1414

1515
type carIO struct {

pieceio/mocks/CarIO.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pieceio/pieceio.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88

99
"github.com/ipfs/go-cid"
1010
blockstore "github.com/ipfs/go-ipfs-blockstore"
11+
logging "github.com/ipfs/go-log/v2"
1112
"github.com/ipld/go-car"
1213
"github.com/ipld/go-ipld-prime"
13-
"github.com/prometheus/common/log"
1414
"golang.org/x/xerrors"
1515

1616
ffi "github.com/filecoin-project/filecoin-ffi"
@@ -19,6 +19,8 @@ import (
1919
"github.com/filecoin-project/go-state-types/abi"
2020
)
2121

22+
var log = logging.Logger("pieceio")
23+
2224
type PreparedCar interface {
2325
Size() uint64
2426
Dump(w io.Writer) error

pieceio/pieceio_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
"github.com/filecoin-project/go-padreader"
2121
"github.com/filecoin-project/go-state-types/abi"
2222

23-
"github.com/filecoin-project/go-fil-markets/pieceio"
24-
"github.com/filecoin-project/go-fil-markets/pieceio/cario"
25-
pmocks "github.com/filecoin-project/go-fil-markets/pieceio/mocks"
23+
"github.com/filecoin-project/go-commp-utils/pieceio"
24+
"github.com/filecoin-project/go-commp-utils/pieceio/cario"
25+
pmocks "github.com/filecoin-project/go-commp-utils/pieceio/mocks"
2626
)
2727

2828
func Test_ThereAndBackAgain(t *testing.T) {

0 commit comments

Comments
 (0)