handler

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeNode added in v0.4.1

func DecodeNode(encoded []byte) (ipld.Node, error)

func EncodeNode added in v0.4.1

func EncodeNode(node ipld.Node) ([]byte, error)

func FetchBlock added in v0.4.1

func FetchBlock(ctx context.Context, dagCtx AnconSyncContext, c ipld.Link) error

func NewPeer added in v0.4.1

func NewPeer(ctx context.Context, addr string) host.Host

func PrintProgress added in v0.4.1

func PrintProgress(ctx context.Context, pgChan <-chan gsync.ResponseProgress)

VerifyHasErrors verifies that at least one error was sent over a channel

func PushBlock added in v0.4.1

func PushBlock(ctx context.Context, dagCtx *AnconSyncContext, c ipld.Link) error

func ReadCAR added in v0.4.1

func ReadCAR() ([]cid.Cid, blocks.Block, datamodel.Node, error)

WriteCAR

func VerifyHasErrors added in v0.4.1

func VerifyHasErrors(ctx context.Context, errChan <-chan error) error

VerifyHasErrors verifies that at least one error was sent over a channel

Types

type AnconSyncContext added in v0.4.1

type AnconSyncContext struct {
	Store      anconsync.Storage
	Exchange   graphsync.GraphExchange
	IPFSPeer   *peer.AddrInfo
	PrivateKey *ecdsa.PrivateKey
}

func NewAnconSyncContext added in v0.4.1

func NewAnconSyncContext(s anconsync.Storage, exchange graphsync.GraphExchange, ipfspeer *peer.AddrInfo, privateKey *ecdsa.PrivateKey) *AnconSyncContext

func (*AnconSyncContext) AddDid added in v0.4.1

func (dagctx *AnconSyncContext) AddDid(didType AvailableDid, domainName string, pubbytes []byte) (ipld.Link, error)

func (*AnconSyncContext) BuildDidKey added in v0.4.1

func (dagctx *AnconSyncContext) BuildDidKey() (*did.Doc, error)

BuildDidKey ....

func (*AnconSyncContext) BuildDidWeb added in v0.4.1

func (dagctx *AnconSyncContext) BuildDidWeb(vanityName string, pubkey []byte) (*did.Doc, error)

BuildDidWeb ....

func (*AnconSyncContext) CreateDidKey added in v0.4.1

func (dagctx *AnconSyncContext) CreateDidKey(c *gin.Context)

func (*AnconSyncContext) CreateDidWeb added in v0.4.1

func (dagctx *AnconSyncContext) CreateDidWeb(c *gin.Context)

func (*AnconSyncContext) DagCborRead added in v0.4.1

func (dagctx *AnconSyncContext) DagCborRead(c *gin.Context)

@BasePath /v0 DagCborRead godoc @Summary Reads CBOR from a dag-cbor block @Schemes @Description Returns CBOR @Tags dag-cbor @Accept json @Produce json @Success 200 @Router /v0/dagcbor/{cid}/{path} [get]

func (*AnconSyncContext) DagCborWrite added in v0.4.1

func (dagctx *AnconSyncContext) DagCborWrite(c *gin.Context)

DagCborWrite godoc @Summary Stores CBOR as dag-json @Schemes @Description Writes a dag-cbor block which syncs with IPFS. Returns a CID. @Tags dag-cbor @Accept json @Produce json @Success 201 {string} cid @Router /v0/dagcbor [post]

func (*AnconSyncContext) DagJsonRead added in v0.4.1

func (dagctx *AnconSyncContext) DagJsonRead(c *gin.Context)

@BasePath /v0 DagJsonRead godoc @Summary Reads JSON from a dag-json block @Schemes @Description Returns JSON @Tags dag-json @Accept json @Produce json @Success 200 @Router /v0/dagjson/{cid}/{path} [get]

func (*AnconSyncContext) DagJsonWrite added in v0.4.1

func (dagctx *AnconSyncContext) DagJsonWrite(c *gin.Context)

@BasePath /v0 DagJsonWrite godoc @Summary Stores JSON as dag-json @Schemes @Description Writes a dag-json block which syncs with IPFS. Returns a CID. @Tags dag-json @Accept json @Produce json @Success 201 {string} cid @Router /v0/dagjson [post]

func (*AnconSyncContext) FileRead added in v0.4.1

func (dagctx *AnconSyncContext) FileRead(c *gin.Context)

@BasePath /v0 FileRead godoc @Summary Reads JSON from a dag-json block @Schemes @Description Returns JSON @Tags file @Accept json @Produce json @Success 200 @Router /v0/file/{cid}/{path} [get]

func (*AnconSyncContext) FileWrite added in v0.4.1

func (dagctx *AnconSyncContext) FileWrite(c *gin.Context)

@BasePath /v0 FileWrite godoc @Summary Stores files @Schemes @Description Writes a raw block which syncs with IPFS. Returns a CID. @Tags file @Accept json @Produce json @Success 201 {string} cid @Router /v0/file [post]

func (*AnconSyncContext) ParseDIDWeb added in v0.4.1

func (dagctx *AnconSyncContext) ParseDIDWeb(id string, useHTTP bool) (string, string, error)

func (*AnconSyncContext) ReadDid added in v0.4.1

func (dagctx *AnconSyncContext) ReadDid(c *gin.Context)

func (*AnconSyncContext) ReadDidWebUrl added in v0.4.1

func (dagctx *AnconSyncContext) ReadDidWebUrl(c *gin.Context)

type AvailableDid added in v0.4.1

type AvailableDid string
const (
	DidTypeWeb AvailableDid = "web"
	DidTypeKey AvailableDid = "key"
)

type ReceivedMessage added in v0.4.1

type ReceivedMessage struct {
	Message gsmsg.GraphSyncMessage
	Sender  peer.ID
}

type Receiver added in v0.4.1

type Receiver struct {
	MessageReceived chan ReceivedMessage
}

Receiver is an interface for receiving messages from the GraphSyncNetwork.

func (*Receiver) Connected added in v0.4.1

func (r *Receiver) Connected(p peer.ID)

func (*Receiver) Disconnected added in v0.4.1

func (r *Receiver) Disconnected(p peer.ID)

func (*Receiver) ReceiveError added in v0.4.1

func (r *Receiver) ReceiveError(_ peer.ID, err error)

func (*Receiver) ReceiveMessage added in v0.4.1

func (r *Receiver) ReceiveMessage(
	ctx context.Context,
	sender peer.ID,
	incoming gsmsg.GraphSyncMessage)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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