Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultRetriever(ua *http.Client) *retrieve.R
- func NewCIDVerifier(bg blockGetter) *cidVerifier
- type AI
- func (ai *AI) Extensions(a remote.Annex, want []string) []string
- func (ai *AI) Init(a remote.Annex) error
- func (ai *AI) ListConfigs(a remote.Annex) (css []remote.ConfigSetting)
- func (ai *AI) Prepare(a remote.Annex) error
- func (ai *AI) Present(a remote.Annex, key string) (bool, error)
- func (ai *AI) Remove(a remote.Annex, key string) error
- func (ai *AI) Retrieve(a remote.Annex, key, file string) error
- func (ai *AI) Store(a remote.Annex, key, file string) error
- type Gateway
- type GatewayURL
- type IPFSRemote
- type Key
- type LocalNode
- type Preparer
- type RemotePinner
- type Transport
Constants ¶
const DefaultGetPathPattern = "/ipfs/%s"
const DefaultPollWait time.Duration = time.Second / 2
DefaultPollWait is the time waited between requests for a pin's status. Its default value is the duration used by go-ipfs for the `ipfs pin remote add` command
Variables ¶
var ( DwebLink = GatewayURL{Base: "https://dweb.link/", SubDomainPattern: "https://%s.ipfs.dweb.link/", API: true} IPFSIo = GatewayURL{Base: "https://ipfs.io/", API: true} CloudflareIPFS = GatewayURL{Base: "https://cloudflare-ipfs.com/"} InfuraIPFSIo = GatewayURL{Base: "https://infura-ipfs.io/", SubDomainPattern: "https://%s.ipfs.infura-ipfs.io/"} PinataCloud = GatewayURL{Base: "https://gateway.pinata.cloud/", API: true} EstuaryTech = GatewayURL{Base: "https://api.estuary.tech/gw/"} )
var DefaultLinkGateway = DwebLink
var DefaultPinTimeout = time.Minute * 5
var DefaultVerifier = func(ctx context.Context, bg retrieve.BlockGetter, c cid.Cid, rsa readerSeekerAt) (int64, error) { v := NewCIDVerifier(bg) return v.ExpectedSize(), v.Verify(ctx, c, rsa) }
var ErrCantPin = errors.New("client doesn't have access to the PSA endpoint")
var ErrUnprepared = errors.New("method called on unprepared remote")
var KeyPat = regexp.MustCompile(`^(?P<backend>[A-Z\d]+[^E])(?P<ext>E)?(-s(?P<size>\d+))?(-m(?P<mtime>\d+))?(-S(?P<chunkSize>\d+)-C(?P<chunkNum>\d+))?--(?P<name>[^/\n]+)$`)
Functions ¶
func NewCIDVerifier ¶
func NewCIDVerifier(bg blockGetter) *cidVerifier
Types ¶
type AI ¶ added in v0.0.11
type AI struct { I IPFSRemote R *retrieve.R UA *http.Client LinkGateway GatewayURL Prep Preparer PinTimeout time.Duration // contains filtered or unexported fields }
func (*AI) Extensions ¶ added in v0.0.11
func (*AI) ListConfigs ¶ added in v0.0.11
func (ai *AI) ListConfigs(a remote.Annex) (css []remote.ConfigSetting)
func (*AI) Prepare ¶ added in v0.0.11
Prepare creates the IPFSRemote used in most of the other exported methods. If called more than once, it will merely return a nil error.
type Gateway ¶
type Gateway struct { URL GatewayURL UA *http.Client }
type GatewayURL ¶
func (GatewayURL) Block ¶
func (gu GatewayURL) Block(c cid.Cid) string
func (GatewayURL) Public ¶
func (gu GatewayURL) Public(c cid.Cid) string
type IPFSRemote ¶
type Key ¶ added in v0.0.11
type LocalNode ¶
type RemotePinner ¶
type RemotePinner struct { *pinclient.Client // PollWait is the time Pin waits before polling for a status change. If nil it is equal to DefaultPollWait. PollWait *time.Duration // contains filtered or unexported fields }
RemotePinner is a client for the IPFS Pinning Service API which implements the methods necessary for a Git Annex remote.
This API is specified in https://ipfs.github.io/pinning-services-api-spec/
func NewRemotePinner ¶
func NewRemotePinner(endpoint, jwt string, ua *http.Client) *RemotePinner
func (*RemotePinner) IsPinned ¶
func (rp *RemotePinner) IsPinned(ctx context.Context, c cid.Cid) (bool, error)
IsPinned returns true if the given CID has a pinned status, false if the CID has another status or is not known to the endpoint. A non-nil error is returned if there was a problem communicating with the endpoint.
func (*RemotePinner) Pin ¶
func (rp *RemotePinner) Pin(ctx context.Context, c cid.Cid, key string) error
Pin requests that the remote pinning service pin the given CID, then waits for confirmation that the pin has been created, the pin couldn't be created, or an error occurred while communicating with the service. Where possible, the pin is named with the given Git Annex key. To impose a timeout on this operation or otherwise abort it prematurely, cancel the supplied context. In the absence of a time-limited Context this method could block indefinitely if the remote service misbehaves or is unable to retrieve the CID.
See https://ipfs.github.io/pinning-services-api-spec/#section/The-pin-lifecycle for background on how the pin status changes. Note that we treat an unknown status as pending.
func (*RemotePinner) Unpin ¶
func (rp *RemotePinner) Unpin(ctx context.Context, c cid.Cid) error
Unpin removes all pins for the given CID on the remote pinning service
The Pinning Service API permits multiple pins to exist for a single CID, and has no facility to remove them in bulk, so the run time of this method is proportional to the number of pins.
This method attempts to remove all pins, regardless of their status. That is, pins that are in the pinning, queued, or failed states will be deleted along with pins in the pinned state. TODO: Use metadata to only delete pins made for this repo
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
estuary allows Git Annex remotes to work with the Estuary service
|
estuary allows Git Annex remotes to work with the Estuary service |
internal
|
|
Package w3s provides a client to interact with the web3.storage API in the context of Git Annex remotes.
|
Package w3s provides a client to interact with the web3.storage API in the context of Git Annex remotes. |