Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver represents a resolver that can resolve data in a CAS based on a CID (with possible hint) and a WebCAS URL.
func New ¶
func New(casClient extendedcasclient.Client, ipfsReader ipfsReader, webCASResolver WebCASResolver, metrics metricsProvider) *Resolver
New returns a new Resolver. ipfsReader is optional. If not provided (is nil), CIDs with IPFS hints won't be resolvable.
func (*Resolver) Resolve ¶
func (h *Resolver) Resolve(_ *url.URL, hashWithPossibleHint string, data []byte) ([]byte, string, error)
Resolve does the following:
- If data is provided (not nil), then it will be stored via the local CAS. That data passed in will then simply be returned back to the caller, along with the hashlink of the stored data.
- If data is not provided (is nil), then the local CAS will be checked to see if it has data at the cid provided. If it does, then it is returned. If it doesn't, and a webCASURL is provided, then the data will be retrieved by querying the webCASURL. This data will then get stored in the local CAS. Finally, the data is returned to the caller, along with the hashlink of the stored data.
In both cases above, the CID produced by the local CAS will be checked against the cid passed in to ensure they are the same.
type WebCASResolver ¶ added in v0.1.3
type WebCASResolver struct {
// contains filtered or unexported fields
}
WebCASResolver is used to resolve data from another Orb server's CAS.
func NewWebCASResolver ¶ added in v0.1.3
func NewWebCASResolver(httpClient httpClient, webFingerClient *webfingerclient.Client, webFingerURIScheme string) WebCASResolver
NewWebCASResolver returns a new WebCASResolver.
func (*WebCASResolver) GetDataViaWebCASEndpoint ¶ added in v0.1.3
func (w *WebCASResolver) GetDataViaWebCASEndpoint(webCASEndpoint *url.URL) ([]byte, error)
GetDataViaWebCASEndpoint retrieves data from the given webCASEndpoint and returns it.
func (*WebCASResolver) Resolve ¶ added in v0.1.3
func (w *WebCASResolver) Resolve(domain, cid string) ([]byte, error)
Resolve returns the data stored at cid via the WebCAS hosted at domain. First, a WebFinger is done at domain in order to determine the WebCAS URL. Then the data is retrieved using the WebCAS URL.