fileservice

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const CName = "common.commonfile.fileservice"
View Source
const (
	ChunkSize = 1 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileHandler added in v0.9.9

type FileHandler struct {
	// contains filtered or unexported fields
}

FileHandler contains all the core file operations logic It can be used directly with any BlockStore implementation

func NewFileHandler added in v0.9.9

func NewFileHandler(bs fileblockstore.BlockStore) *FileHandler

NewFileHandler creates a new FileHandler with the given BlockStore

func (*FileHandler) AddFile added in v0.9.9

func (fh *FileHandler) AddFile(ctx context.Context, r io.Reader) (ipld.Node, error)

AddFile adds file to ipfs storage

func (*FileHandler) DAGService added in v0.9.9

func (fh *FileHandler) DAGService() ipld.DAGService

DAGService returns the underlying DAG service

func (*FileHandler) GetFile added in v0.9.9

func (fh *FileHandler) GetFile(ctx context.Context, c cid.Cid) (ufsio.ReadSeekCloser, error)

GetFile gets file from ipfs storage

func (*FileHandler) HasCid added in v0.9.9

func (fh *FileHandler) HasCid(ctx context.Context, c cid.Cid) (exists bool, err error)

HasCid checks if CID exists

type FileService

type FileService interface {
	// GetFile gets file from ipfs storage
	GetFile(ctx context.Context, c cid.Cid) (ufsio.ReadSeekCloser, error)
	// AddFile adds file to ipfs storage
	AddFile(ctx context.Context, r io.Reader) (ipld.Node, error)
	// DAGService returns ipld.DAGService object
	DAGService() ipld.DAGService
	// HasCid checks is CID exists
	HasCid(ctx context.Context, c cid.Cid) (exists bool, err error)
	app.Component
}

func New

func New() FileService

Jump to

Keyboard shortcuts

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