client

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0, MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIncorrectCapability = errors.New("did not receive expected capability")
View Source
var ErrNoReceipt = errors.New("no error for invocation")

Functions

This section is empty.

Types

type BlobAcceptResult

type BlobAcceptResult struct {
	LocationCommitment assert.LocationCaveats
	PDPAccept          *pdp.AcceptCaveats
}

Blob sends a blob/accept invocation to the storage node and returns the location commitment and piece/accept invocation

type Client

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

Client simulates actions taken by the upload service in response to client invocations.

func NewClient

func NewClient(cfg Config) (*Client, error)

func (*Client) BlobAccept

func (s *Client) BlobAccept(ctx context.Context, space did.DID, digest multihash.Multihash, size uint64, putInv datamodel.Link) (*BlobAcceptResult, error)

func (*Client) BlobAllocate

func (s *Client) BlobAllocate(ctx context.Context, space did.DID, digest multihash.Multihash, size uint64, cause datamodel.Link) (*blob.Address, error)

BlobAllocate sends a blob/allocate invocation to the storage node and returns the upload address if required (i.e. it may be nil if the storage node already has the blob).

func (*Client) PDPInfo

func (s *Client) PDPInfo(ctx context.Context, blob multihash.Multihash) (pdp.InfoOk, error)

type Config

type Config struct {
	ID principal.Signer
	// StorageNodeID is the DID of the storage node.
	StorageNodeID ucan.Principal
	// StorageNodeURL is the URL of the storage node UCAN endpoint.
	StorageNodeURL url.URL
	// StorageProof is a delegation allowing the upload service to invoke
	// blob/allocate and blob/accept on the storage node.
	StorageProof delegation.Proof
}

type NodeStatus added in v0.0.15

type NodeStatus struct {
	Healthy           bool       `json:"healthy"`
	IsProving         bool       `json:"is_proving"`
	InChallengeWindow bool       `json:"in_challenge_window"`
	HasProven         bool       `json:"has_proven"`
	InFaultState      bool       `json:"in_fault_state"`
	UpgradeSafe       bool       `json:"upgrade_safe"`
	NextChallenge     *time.Time `json:"next_challenge,omitempty"`
}

NodeStatus represents the current state of a piri node

func GetNodeStatus added in v0.0.15

func GetNodeStatus(ctx context.Context) (*NodeStatus, error)

GetNodeStatus connects to a running piri node and checks its status

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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