Categorygithub.com/ipfs/go-ipfs-provider
modulepackage
1.0.1
Repository: https://github.com/ipfs/go-ipfs-provider.git
Documentation: pkg.go.dev

# README

go-ipfs-provider

Coverage Status Travis CI

Background

The provider system is responsible for announcing and reannouncing to the ipfs network that a node has content.

Install

Via go get:

$ go get github.com/ipfs/go-ipfs-provider

Requires Go 1.12

Usage

Here's how you create, start, interact with, and stop the provider system:

import (
	"context"
	"time"

	"github.com/ipfs/go-ipfs-provider"
	"github.com/ipfs/go-ipfs-provider/queue"
	"github.com/ipfs/go-ipfs-provider/simple"
)

rsys := (your routing system here)
dstore := (your datastore here)
cid := (your cid to provide here)

q := queue.NewQueue(context.Background(), "example", dstore)

reprov := simple.NewReprovider(context.Background(), time.Hour * 12, rsys, simple.NewBlockstoreProvider)
prov := simple.NewProvider(context.Background(), q, rsys)
sys := provider.NewSystem(prov, reprov)

sys.Run()

sys.Provide(cid)

sys.Close()

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

This library is dual-licensed under Apache 2.0 and MIT terms.

Copyright 2019. Protocol Labs, Inc.

# Packages

No description provided by the author
Package simple implements structures and methods to provide blocks, keep track of which blocks are provided, and to allow those blocks to be reprovided.

# Functions

NewOfflineProvider creates a ProviderSystem that does nothing.
NewSystem constructs a new provider system from a provider and reprovider.

# Interfaces

Provider announces blocks to the network.
Reprovider reannounces blocks to the network.
System defines the interface for interacting with the value provider system.