corerepo

package
v0.0.0-...-c0cc0bc Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const NoLimit uint64 = math.MaxUint64

NoLimit represents the value for unlimited storage

Variables

View Source
var ErrMaxStorageExceeded = errors.New("maximum storage limit exceeded. Try to unpin some files")

Functions

func BestEffortRoots

func BestEffortRoots(filesRoot *mfs.Root) ([]cid.Cid, error)

func CollectResult

func CollectResult(ctx context.Context, gcOut <-chan gc.Result, cb func(cid.Cid)) error

CollectResult collects the output of a garbage collection run and calls the given callback for each object removed. It also collects all errors into a MultiError which is returned after the gc is completed.

func ConditionalGC

func ConditionalGC(ctx context.Context, node *core.IpfsNode, offset uint64) error

func GarbageCollect

func GarbageCollect(n *core.IpfsNode, ctx context.Context) error

func GarbageCollectAsync

func GarbageCollectAsync(n *core.IpfsNode, ctx context.Context) <-chan gc.Result

func PeriodicGC

func PeriodicGC(ctx context.Context, node *core.IpfsNode) error

func RepoGc

func RepoGc(req *cmds.Request, re cmds.ResponseEmitter, n *core.IpfsNode, streamErrors bool) error

Types

type GC

type GC struct {
	Node       *core.IpfsNode
	Repo       repo.Repo
	StorageMax uint64
	StorageGC  uint64
	SlackGB    uint64
	Storage    uint64
}

func NewGC

func NewGC(n *core.IpfsNode) (*GC, error)

type GcResult

type GcResult struct {
	Key   cid.Cid
	Error string `json:",omitempty"`
}

type MultiError

type MultiError struct {
	Errors  []error
	Summary error
}

MultiError contains the results of multiple errors.

func NewMultiError

func NewMultiError(errs ...error) *MultiError

NewMultiError creates a new MultiError object from a given slice of errors.

func (*MultiError) Error

func (e *MultiError) Error() string

type SizeStat

type SizeStat struct {
	RepoSize   uint64 // size in bytes
	StorageMax uint64 // size in bytes
}

SizeStat wraps information about the repository size and its limit.

func RepoSize

func RepoSize(ctx context.Context, n *core.IpfsNode) (SizeStat, error)

RepoSize returns a *Stat object with the RepoSize and StorageMax fields set.

type Stat

type Stat struct {
	SizeStat
	NumObjects uint64
	RepoPath   string
	Version    string
}

Stat wraps information about the objects stored on disk.

func RepoStat

func RepoStat(ctx context.Context, n *core.IpfsNode) (Stat, error)

RepoStat returns a *Stat object with all the fields set.

Jump to

Keyboard shortcuts

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