Categorygithub.com/proofzero/go-ipld-linkstore
modulepackage
1.0.0
Repository: https://github.com/proofzero/go-ipld-linkstore.git
Documentation: pkg.go.dev

# README

go-ipld-linkstore

Go Reference Go Go Report Card build Slack

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.

Install

At a shell within your go module:

go get github.com/proofzero/go-ipld-linkstore

Build Instructions

go build

Usage

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.

Testing

go test

# Functions

NewStorageLinkSystemWithNewStorage creates a new StorageLinkSystem with new storage.
NewStorageLinkSystemWithNoStorage creates a new storage link system with no attached storage.
NewStorageLinkSystemWithStorage creates a new StorageLinkSystem with supplied storage.

# Structs

StorageLinkSystem is a LinkSystem with format architecture storage duct taped to it so, eg, it can be written to carfiles.