gc

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

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

Go to latest
Published: Jan 19, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

此源码被清华学神尹成大魔王专业翻译分析并修改 尹成QQ77025077 尹成微信18510341407 尹成所在QQ群721929980 尹成邮箱 yinc13@mails.tsinghua.edu.cn 尹成毕业于清华大学,微软区块链领域全球最有价值专家 https://mvp.microsoft.com/zh-cn/PublicProfile/4033620 包GC为Go IPF提供垃圾收集。

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotDeleteSomeBlocks = errors.New("garbage collection incomplete: could not delete some blocks")

删除标记为的块时返回errCanNotDeleteSomBlocks 删除失败,这是GC输出通道的最后一个结果。

View Source
var ErrCannotFetchAllLinks = errors.New("garbage collection aborted: could not retrieve some links")

errcanotfetchallinks作为gc输出的最后一个结果返回 创建标记集时出错,原因是 查找后代时出现问题。

Functions

func ColoredSet

func ColoredSet(ctx context.Context, pn pin.Pinner, ng ipld.NodeGetter, bestEffortRoots []cid.Cid, output chan<- Result) (*cid.Set, error)

coloredset计算图表中由 在给定的销中的销。

func Descendants

func Descendants(ctx context.Context, getLinks dag.GetLinks, set *cid.Set, roots []cid.Cid) error

子代递归查找给定根的所有子代,并 使用提供的dag.getlinks函数将它们添加到给定的cid.set中 走在树上。

func GC

func GC(ctx context.Context, bs bstore.GCBlockstore, dstor dstore.Datastore, pn pin.Pinner, bestEffortRoots []cid.Cid) <-chan Result

GC对块存储区中的块执行标记和清理垃圾收集 首先,它创建一个“已标记”集,并向其中添加以下内容: -所有递归固定的块,加上它们的所有子代(递归) -BestEffortRoots及其所有子代(递归) -所有直接固定块 -Pinner内部使用的所有块

然后,该例程迭代块存储区中的每个块,并 删除标记集中找不到的任何块。

Types

type CannotDeleteBlockError

type CannotDeleteBlockError struct {
	Key cid.Cid
	Err error
}

CanNotDeleteBlockError提供有关以下内容的详细信息: 无法删除块,因此可能出现在gc输出中 通道。

func (*CannotDeleteBlockError) Error

func (e *CannotDeleteBlockError) Error() string

错误实现此类型的错误接口 有用的信息。

type CannotFetchLinksError

type CannotFetchLinksError struct {
	Key cid.Cid
	Err error
}

cannotfetchlinkserror提供有关哪些链接的详细信息 无法获取,因此可能出现在GC输出通道中。

func (*CannotFetchLinksError) Error

func (e *CannotFetchLinksError) Error() string

错误实现此类型的错误接口 消息。

type Result

type Result struct {
	KeyRemoved cid.Cid
	Error      error
}

结果表示垃圾收集的增量输出 跑。它包含一个错误,或者一个被删除对象的cid。

Jump to

Keyboard shortcuts

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