coreunix

package
v0.0.0-...-9fdd194 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 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

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

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

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

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(ctx context.Context, file files.Node) (ipld.Node, error)

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

func (*Adder) GcLocker

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

func (*Adder) PinRoot

func (adder *Adder) PinRoot(ctx context.Context, 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

type MetaModifier struct {
	*Adder
	Overwrite bool
	// contains filtered or unexported fields
}

MetaModifier contains the options to the `metadata` command.

func NewMetaModifier

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

func (*MetaModifier) AddMetaAndPin

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

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

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

func NewReedSolomonAdder

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

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

func (*ReedSolomonAdder) AddAllAndPin

func (rsadder *ReedSolomonAdder) AddAllAndPin(ctx context.Context, 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