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:
1. 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. 2. 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 ¶
type WebCASResolver struct {
// contains filtered or unexported fields
}
WebCASResolver is used to resolve data from another Oak server's CAS.
func NewWebCASResolver ¶
func NewWebCASResolver(httpClient httpClient, webFingerClient *webfingerclient.Client, webFingerURIScheme string) WebCASResolver
NewWebCASResolver returns a new WebCASResolver.
func (*WebCASResolver) GetDataViaWebCASEndpoint ¶
func (w *WebCASResolver) GetDataViaWebCASEndpoint(webCASEndpoint *url.URL) ([]byte, error)
GetDataViaWebCASEndpoint retrieves data from the given webCASEndpoint and returns it.