coreunix

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: Apache-2.0, MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SerialFile = iota + 1
	MultipartFile
	SliceFile
)

Variables

This section is empty.

Functions

func AddMetadataTo

func AddMetadataTo(n *core.IpfsNode, skey string, m *ft.Metadata) (string, error)

func GetDataForUserAndMeta added in v1.5.0

func GetDataForUserAndMeta(ctx context.Context, nd ipld.Node, ds ipld.DAGService) ([]byte, []byte, error)

GetDataForUserAndMeta returns raw dag node user data, metadata in byte array, and error. Note that this function assumes, if token metadata exists inside the DAG topped by the given 'node', the 'node' has metadata root as first child, user data root as second child.

func GetMetaData added in v1.5.0

func GetMetaData(ctx context.Context, api coreiface.CoreAPI, path ipath.Path) ([]byte, error)

Returns the full metadata DAG data bytes for the DAG of the given file path.

func MetaDataMap added in v1.5.0

func MetaDataMap(ctx context.Context, api coreiface.CoreAPI, path ipath.Path) (map[string]interface{}, error)

MetaDataMap takes a root node path and returns an unmarshalled metadata map in bytes

func MetaNodeFsData added in v1.5.0

func MetaNodeFsData(ctx context.Context, api coreiface.CoreAPI, path ipath.Path) ([]byte, error)

MetaData takes a root node path and returns the metadata in bytes

func Metadata

func Metadata(n *core.IpfsNode, skey string) (*ft.Metadata, error)

Types

type Adder

type Adder struct {
	Out              chan<- interface{}
	Progress         bool
	Pin              bool
	Trickle          bool
	RawLeaves        bool
	Silent           bool
	NoCopy           bool
	MetaForDirectory bool
	MetaDagToAdd     bool
	MetadataDag      ipld.Node

	Chunker string

	CidBuilder cid.Builder

	TokenMetadata string
	PinDuration   int64
	// contains filtered or unexported fields
}

Adder holds the switches passed to the `add` command.

func NewAdder

func NewAdder(ctx context.Context, p pin.Pinner, bs bstore.GCLocker, ds ipld.DAGService) (*Adder, error)

NewAdder Returns a new Adder used for a file add operation.

func (*Adder) AddAllAndPin

func (adder *Adder) AddAllAndPin(file files.Node) (ipld.Node, error)

AddAllAndPin adds the given request's files and pin them.

func (*Adder) GcLocker added in v1.5.0

func (adder *Adder) GcLocker() bstore.GCLocker

func (*Adder) PinRoot

func (adder *Adder) PinRoot(root ipld.Node) error

Recursively pins the root node of Adder and writes the pin state to the backing datastore.

func (*Adder) SetMfsRoot

func (adder *Adder) SetMfsRoot(r *mfs.Root)

SetMfsRoot sets `r` as the root for Adder.

type Link struct {
	Name, Hash string
	Size       uint64
}

type MetaModifier added in v1.5.0

type MetaModifier struct {
	*Adder
	Overwrite bool
}

MetaModifier contains the options to the `metadata` command.

func NewMetaModifier added in v1.5.0

func NewMetaModifier(ctx context.Context, p pin.Pinner, bs bstore.GCLocker, ds ipld.DAGService) (*MetaModifier, error)

func (*MetaModifier) AddMetaAndPin added in v1.5.0

func (modifier *MetaModifier) AddMetaAndPin(node ipld.Node) (ipld.Node, ipath.Resolved, error)

Add metadata to the given DAG root node for a BTFS file.

func (*MetaModifier) RemoveMetaAndPin added in v1.5.0

func (modifier *MetaModifier) RemoveMetaAndPin(node ipld.Node) (ipld.Node, ipath.Resolved, error)

RemoveMetaAndPin removes the metadata entries from the DAG of the given `node` root node of a BTFS file.

type ReedSolomonAdder added in v1.5.0

type ReedSolomonAdder struct {
	Adder
	FileType      int
	InfileReaders []io.Reader
	IsDir         bool
	CurrentOffset uint64
}

func NewReedSolomonAdder added in v1.5.0

func NewReedSolomonAdder(adder *Adder) (*ReedSolomonAdder, error)

NewReedSolomonAdder returns a new ReedSolomonAdder used for a file/directory add operation.

func (*ReedSolomonAdder) AddAllAndPin added in v1.5.0

func (rsadder *ReedSolomonAdder) AddAllAndPin(file files.Node) (ipld.Node, error)

AddAllAndPin adds the given request's files and pin them.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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