ipfs

package module
v0.0.0-...-307c02f Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 7 Imported by: 0

README

ipfs-driver

This is a Ipfs driver for Glacier to integrate Ipfs's feature! It implements Glacier's Standard Storage interface.

Example

  • Run a local IPFS node
ipfs init
ipfs daemon
  • Test Driver
go test -v
  • List files
ipfs files ls /glc001
hello.txt
  • Stat file
ipfs files stat /glc001/hello.txt
QmZ8wL7UgEocrxJmom8ABbamwU9G3XEi2PaUTZ1HHWTfS9
Size: 11
CumulativeSize: 121
ChildBlocks: 2
Type: file
  • Cat file
ipfs cat QmZ8wL7UgEocrxJmom8ABbamwU9G3XEi2PaUTZ1HHWTfS9
hello ipfs!
  • Create a Filcoin storage deal
lotus client deal QmZ8wL7UgEocrxJmom8ABbamwU9G3XEi2PaUTZ1HHWTfS9 t01000 <price> <duration>

Ref

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDriver

type IDriver interface {
	Put(ctx context.Context, key string, data []byte) (txHash string, err error)
	Get(ctx context.Context, key string) (data []byte, txHash string, err error)
	Type() string
	DaID(dataHash string, txHash string) string
}

func GetIpfsDriver

func GetIpfsDriver(endpoint, bucket string) IDriver

type IpfsDriver

type IpfsDriver struct {
	Bucket string
	// contains filtered or unexported fields
}

func NewIpfsDriver

func NewIpfsDriver(endpoint, bucket string) *IpfsDriver

func (*IpfsDriver) DaID

func (ipfs *IpfsDriver) DaID(dataHash, txHash string) string

func (*IpfsDriver) Get

func (ipfs *IpfsDriver) Get(ctx context.Context, key string) (data []byte, txHash string, err error)

func (*IpfsDriver) Put

func (ipfs *IpfsDriver) Put(ctx context.Context, key string, data []byte) (txHash string, err error)

func (*IpfsDriver) Type

func (ipfs *IpfsDriver) Type() string

Jump to

Keyboard shortcuts

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