A small module that makes IPLD LinkSystems (newer, "prime node" architecture) easy to use with carfiles and other, older modules that use the legacy "format node" architecture.
At a shell within your go module:
go get github.com/proofzero/go-ipld-linkstore
go build
Pseudo-golang for quickly and easily writing a v1 carfile full of prime nodes:
sls := NewStorageLinkSystemWithNewStorage(cidlink.DefaultLinkSystem())
cid := sls.MustStore(myLinkContext, myLinkPrototype, myPrimeNode)
car := carv1.NewSelectiveCar(context.Background(),
sls.ReadStore, // <- special sauce block format access to prime nodes.
[]carv1.Dag{{
// CID of the root node of the DAG to traverse.
Root: cid.(cidlink.Link).Cid,
// Traversal convenience selector that gives us "everything".
Selector: everything(),
}})
file, _ := os.Create("myV1Carfile.v1.car")
car.Write(file)
An attempt has been made to over-comment the code. See especially example_test.go
.
go test
We would appreciate your help to make this a useful utility. For code contributions, please send a pull request. First outlining your proposed change in an issue or discussion thread to get feedback from other developers is a good idea for anything but small changes. Other ways to contribute include:
- making a feature request
- reporting a bug
- writing a test
- adding some documentation
- providing feedback on the project direction
- reporting your experience using it
For most things we will use GitHub issues and discussions, but feel free to join the project Matrix room to chat or ask questions.