Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCacheMiss = errors.New("cache miss")
Functions ¶
func NewDocumentLoader ¶
func NewDocumentLoader(ipfsCli IPFSClient, ipfsGW string, opts ...DocumentLoaderOption) ld.DocumentLoader
NewDocumentLoader creates a new document loader with a cache for http. ipfs cache is not implemented yet.
Types ¶
type CacheEngine ¶ added in v2.1.0
type CacheEngine interface { Get(key string) (doc *ld.RemoteDocument, expireTime time.Time, err error) Set(key string, doc *ld.RemoteDocument, expireTime time.Time) error }
func NewMemoryCacheEngine ¶ added in v2.1.0
func NewMemoryCacheEngine( opts ...MemoryCacheEngineOption) (CacheEngine, error)
type DocumentLoaderOption ¶ added in v2.1.0
type DocumentLoaderOption func(*documentLoader)
func WithCacheEngine ¶ added in v2.1.0
func WithCacheEngine(cacheEngine CacheEngine) DocumentLoaderOption
func WithHTTPClient ¶ added in v2.1.0
func WithHTTPClient(httpClient *http.Client) DocumentLoaderOption
type IPFSClient ¶ added in v2.2.0
type IPFSClient interface {
Cat(url string) (io.ReadCloser, error)
}
type MemoryCacheEngineOption ¶ added in v2.1.0
type MemoryCacheEngineOption func(*memoryCacheEngine) error
func WithEmbeddedDocumentBytes ¶ added in v2.1.0
func WithEmbeddedDocumentBytes(u string, doc []byte) MemoryCacheEngineOption
Click to show internal directories.
Click to hide internal directories.