loaders

package
v2.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 2

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL