handlers

package
v0.0.0-...-5adb3e2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCID    = errors.New("invalid CID")
	ErrCIDNotChild   = errors.New("CID is not a child from root")
	ErrCIDDuplicated = errors.New("duplicated CID found")
)

Functions

func CalculateDagStats

func CalculateDagStats(
	ctx context.Context,
	coreapi coreiface.CoreAPI,
	k cid.Cid,
	recursive bool,
	stats *DagStats,
) error

func WithDagStat

func WithDagStat(ctx context.Context, v *DagStats) context.Context

Types

type CidCount

type CidCount struct {
	Cid   string `json:"c"`
	Count int    `json:"v"`
}

type DagStats

type DagStats struct {
	TotalCount            *atomic.Int64
	DeduplicatedSize      *atomic.Int64
	DeduplicatedNumBlocks *atomic.Int64
	TotalSize             *atomic.Int64
	TotalNumBlocks        *atomic.Int64
}

func NewDagStats

func NewDagStats() *DagStats

func (*DagStats) Add

func (d *DagStats) Add(o *DagStats)

func (*DagStats) Sub

func (d *DagStats) Sub(o *DagStats)

type ExtendedHandlers

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

func New

func New(
	nd *core.IpfsNode,
	api coreiface.CoreAPI,
	apiHandlers gohttp.Handler,
) *ExtendedHandlers

func (*ExtendedHandlers) DagImport

func (h *ExtendedHandlers) DagImport() gohttp.HandlerFunc

func (*ExtendedHandlers) NameBroadcast

func (h *ExtendedHandlers) NameBroadcast() gohttp.HandlerFunc

func (*ExtendedHandlers) PinAdd

func (h *ExtendedHandlers) PinAdd() gohttp.HandlerFunc

func (*ExtendedHandlers) PinChildrenUpdate

func (h *ExtendedHandlers) PinChildrenUpdate() gohttp.HandlerFunc

PinChildrenUpdate updates a root node's children's reference count in pinner index. The API requires the root node is already pinned recursively. All updating CIDs must be current child of the root node. For decrementing CID, its current count must be positive, otherwise, the all updates abort.

func (*ExtendedHandlers) PinList

func (h *ExtendedHandlers) PinList() gohttp.HandlerFunc

func (*ExtendedHandlers) PinRm

func (h *ExtendedHandlers) PinRm() gohttp.HandlerFunc

func (*ExtendedHandlers) PinnedCount

func (h *ExtendedHandlers) PinnedCount() gohttp.HandlerFunc

func (*ExtendedHandlers) Status

func (h *ExtendedHandlers) Status() gohttp.HandlerFunc

type NameBroadcastResult

type NameBroadcastResult struct {
	Message string `json:"message"`
}

type PinAddResult

type PinAddResult struct {
	Success               bool   `json:"success"`
	InProgress            bool   `json:"in_progress"`
	ProcessedNumBlocks    int    `json:"processed_num_blocks"`
	DeduplicatedSize      int64  `json:"duplicated_size"`
	DeduplicatedNumBlocks int64  `json:"duplicated_num_blocks"`
	TotalSize             int64  `json:"total_size"`
	TotalNumBlocks        int64  `json:"total_num_blocks"`
	Message               string `json:"message"`
}

type PinChildrenUpdate

type PinChildrenUpdate struct {
	Cid       string `json:"c"`
	Recursive bool   `json:"r"`
}

type PinChildrenUpdateRequest

type PinChildrenUpdateRequest struct {
	Root string               `json:"root"`
	Incs []*PinChildrenUpdate `json:"incs"`
	Decs []*PinChildrenUpdate `json:"decs"`
}

type PinChildrenUpdateResult

type PinChildrenUpdateResult struct {
	Success bool              `json:"success"`
	Message string            `json:"message"`
	Sizes   map[string]uint64 `json:"sizes"`
}

type PinListResult

type PinListResult struct {
	Success    bool        `json:"success"`
	InProgress bool        `json:"in_progress"`
	Batch      []*CidCount `json:"batch"`
	Message    string      `json:"message"`
}

type PinRmResult

type PinRmResult struct {
	Success               bool   `json:"success"`
	DeduplicatedSize      int64  `json:"duplicated_size"`
	DeduplicatedNumBlocks int64  `json:"duplicated_num_blocks"`
	TotalSize             int64  `json:"total_size"`
	TotalNumBlocks        int64  `json:"total_num_blocks"`
	Message               string `json:"message"`
}

type PinnedCountResult

type PinnedCountResult struct {
	Success bool   `json:"success"`
	Count   int    `json:"count"`
	Message string `json:"message"`
}

type StatusResult

type StatusResult struct {
	Status    string `json:"status"`
	PublicKey string `json:"public_key"`
}

Jump to

Keyboard shortcuts

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