Skip to content

Commit adaaf4c

Browse files
shannonwellsingar
andauthored
Feat/module docs #83 (#267)
Add READMEs to all modules Co-authored-by: Ingar Shu <ingar@users.noreply.github.com>
1 parent b0daefb commit adaaf4c

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

pieceio/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# pieceio
2+
3+
The pieceio module is a collection of structs for generating piece commitments (a.k.a. CommP) and
4+
storing pieces for storage market deals. It is used by the
5+
[`storagemarket`](../storagemarket) module.
6+
7+
## Installation
8+
```bash
9+
go get github.com/filecoin-project/go-fil-markets/pieceio
10+
```
11+
12+
## PieceIO
13+
`PieceIO` is used by [`storagemarket`](../storagemarket) client for proposing deals.
14+
15+
**To initialize a PieceIO:**
16+
```go
17+
package pieceio
18+
19+
func NewPieceIO(carIO CarIO, bs blockstore.Blockstore) PieceIO
20+
```
21+
**Parameters**
22+
* `carIO` is a [CarIO](#CarIO) from this module
23+
* `bs` is an IPFS blockstore for storing and retrieving data for deals. See
24+
[github.com/ipfs/go-ipfs-blockstore](github.com/ipfs/go-ipfs-blockstore).
25+
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+
44+
## CarIO
45+
CarIO is a utility module that wraps [github.com/ipld/go-car](https://github.com/ipld/go-car) for use by storagemarket.
46+
47+
**To initialize a CarIO:**
48+
```go
49+
package cario
50+
51+
func NewCarIO() pieceio.CarIO
52+
```
53+
54+
Please the [tests](pieceio_test.go) for more information about expected behavior.

0 commit comments

Comments
 (0)