linkstore

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2021 License: MIT Imports: 8 Imported by: 2

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

Documentation

Overview

Package linkstore adds IPLD format architecture storage support to a prime architecture link system so that it can be used more easily, eg, with carfiles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StorageLinkSystem

type StorageLinkSystem struct {
	linking.LinkSystem
	ReadStore  carv1.ReadStore
	WriteStore carv1.Store
}

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

func NewStorageLinkSystemWithNewStorage

func NewStorageLinkSystemWithNewStorage(ls linking.LinkSystem) *StorageLinkSystem

NewStorageLinkSystemWithNewStorage creates a new StorageLinkSystem with new storage.

func NewStorageLinkSystemWithNoStorage

func NewStorageLinkSystemWithNoStorage(ls linking.LinkSystem) *StorageLinkSystem

NewStorageLinkSystemWithNoStorage creates a new storage link system with no attached storage.

func NewStorageLinkSystemWithStorage

func NewStorageLinkSystemWithStorage(ls linking.LinkSystem, store storage.Memory) *StorageLinkSystem

NewStorageLinkSystemWithStorage creates a new StorageLinkSystem with supplied storage.

func (*StorageLinkSystem) ConfigureStorage

func (slinks *StorageLinkSystem) ConfigureStorage(store storage.Memory) *StorageLinkSystem

ConfigureStorage configures link system storage for prime architecture nodes and sets up the duct tape storage for format architecture nodes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL