storage

package
v0.0.0-...-7392462 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ContentTypeImagePng = "image/png"
View Source
const ContentTypePlainText = "text/plain"

Variables

This section is empty.

Functions

func InitIpfs

func InitIpfs() *ipfs.Shell

func PinToIpfs

func PinToIpfs(path string) (string, error)

func ReadFromIpfs

func ReadFromIpfs(hash string) ([]byte, error)

func WriteToIpfs

func WriteToIpfs(content []byte, isPin bool) (string, error)

Types

type Item

type Item struct {
	ItemMeta
	Content string
}

func KeepItem

func KeepItem(ctx context.Context, item Item, token string, pin fxAccount.Pin, quota string) (*Item, error)

func ReadItem

func ReadItem(ctx context.Context, cid string) (*Item, error)

ReadItem read a specified content from DAG Network

func ReadRecord

func ReadRecord(cid string) (*Item, error)

ReadRecord read a specified content from storage

func WriteItem

func WriteItem(userID string, itemType string, brief string, content string) (*Item, error)

func (*Item) Response

func (item *Item) Response() interface{}

type ItemHead

type ItemHead struct {
	C string
	B string
}

type ItemMeta

type ItemMeta struct {
	CreatorID   string
	Version     uint
	Type        string
	SnapshotID  string
	QuotaID     string
	QuotaAmount string
	Brief       string
	CID         string
}

Jump to

Keyboard shortcuts

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