fastcommp

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 9 Imported by: 0

README

fastcommp

Filecoin fast piece commitment summation tool.

usage

    fast := new(fastcommp.CommpWriter)
	fast.Write(data)
	sum, err := fast.Sum()
	if err != nil {
		panic(err)
	}
	fmt.Printf("commP: %s\n", sum.PieceCID.String())

build

make build

execute

./fastcommp <carfile.car>

optional: create car dummy data

  1. create an 8 GiB test file

dd if=/dev/urandom of=8G-payload.bin bs=1M count=8192

  1. car it up with https://github.com/ipld/go-car (install with go install github.com/ipld/go-car/cmd/car@latest)

car c --version 1 -f 8G-payload.bin.car 8G-payload.bin

benchmarks

Screenshot 2023-04-25 at 4 41 58 PM * benchmarks run on optimized AMD hardware with ~1TB available memory

Documentation

Index

Constants

View Source
const CommPBuf = abi.UnpaddedPieceSize(commPBufPad - (commPBufPad / 128))

CommPBuf is the size of the buffer used to calculate commP

Variables

This section is empty.

Functions

This section is empty.

Types

type CommpWriter

type CommpWriter struct {
	// contains filtered or unexported fields
}

CommpWriter is a writer that calculates the CommP

func (*CommpWriter) Sum

func (w *CommpWriter) Sum() (DataCIDSize, error)

func (*CommpWriter) Write

func (w *CommpWriter) Write(p []byte) (int, error)

Write writes data to the DataCidWriter

type DataCIDSize

type DataCIDSize struct {
	PayloadSize int64
	PieceSize   abi.PaddedPieceSize
	PieceCID    cid.Cid
}

DataCIDSize is the result of a DataCID calculation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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