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 ¶
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 ¶
func NewMemoryCacheEngine( opts ...MemoryCacheEngineOption) (CacheEngine, error)
type DocumentLoaderOption ¶
type DocumentLoaderOption func(*documentLoader)
func WithCacheEngine ¶
func WithCacheEngine(cacheEngine CacheEngine) DocumentLoaderOption
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) DocumentLoaderOption
type IPFSClient ¶
type IPFSClient interface {
Cat(url string) (io.ReadCloser, error)
}
type MemoryCacheEngineOption ¶
type MemoryCacheEngineOption func(*memoryCacheEngine) error
func WithEmbeddedDocumentBytes ¶
func WithEmbeddedDocumentBytes(u string, doc []byte) MemoryCacheEngineOption
Click to show internal directories.
Click to hide internal directories.