Documentation ¶
Index ¶
- Constants
- Variables
- func NewCIDVerifier(bg blockGetter) *cidVerifier
- type Gateway
- type GatewayURL
- type Getter
- type IA
- func (ia *IA) Extensions(a remote.Annex, want []string) []string
- func (ia *IA) Init(a remote.Annex) error
- func (ia *IA) ListConfigs(a remote.Annex) (css []remote.ConfigSetting)
- func (ia *IA) Prepare(a remote.Annex) error
- func (ia *IA) Present(a remote.Annex, key string) (bool, error)
- func (ia *IA) Remove(a remote.Annex, key string) error
- func (ia *IA) Retrieve(a remote.Annex, key, file string) error
- func (ia *IA) Store(a remote.Annex, key, file string) error
- type IPFSRemote
- type LocalNode
- type Preparer
- type Progress
- type ProgressReader
- 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} )
var DefaultLinkGateway = DwebLink
var ErrCantPin = errors.New("client doesn't have access to the PSA endpoint")
var ErrUnprepared = errors.New("method called on unprepared remote")
Functions ¶
func NewCIDVerifier ¶
func NewCIDVerifier(bg blockGetter) *cidVerifier
Types ¶
type Gateway ¶
type Gateway struct { URL GatewayURL UA *http.Client Verifier blockGetter }
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 IA ¶
type IA struct { I IPFSRemote UA *http.Client LinkGateway GatewayURL Prep Preparer // contains filtered or unexported fields }
func (*IA) ListConfigs ¶
func (ia *IA) ListConfigs(a remote.Annex) (css []remote.ConfigSetting)
func (*IA) Prepare ¶
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 IPFSRemote ¶
type Progress ¶
type Progress struct { FileSize int64 Fn func(int64) TotalReported int64 Err error IsClosed bool sync.Mutex // contains filtered or unexported fields }
func NewProgress ¶
func (*Progress) SetOverhead ¶
type ProgressReader ¶
func (*ProgressReader) Close ¶
func (pr *ProgressReader) Close() error
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. |