loaders

package
v2.6.4 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: Apache-2.0, MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheMiss = errors.New("cache miss")

ErrCacheMiss is an error when there is no info in cache

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
}

CacheEngine is engine interface for cache storages

func NewMemoryCacheEngine added in v2.1.0

func NewMemoryCacheEngine(
	opts ...MemoryCacheEngineOption) (CacheEngine, error)

NewMemoryCacheEngine creates new memory cache engine

type DocumentLoaderOption added in v2.1.0

type DocumentLoaderOption func(*documentLoader)

DocumentLoaderOption is an option for document loader

func WithCacheEngine added in v2.1.0

func WithCacheEngine(cacheEngine CacheEngine) DocumentLoaderOption

WithCacheEngine is an option for setting cache

func WithHTTPClient added in v2.1.0

func WithHTTPClient(httpClient *http.Client) DocumentLoaderOption

WithHTTPClient is an option for setting http client

type IPFSClient added in v2.2.0

type IPFSClient interface {
	Cat(url string) (io.ReadCloser, error)
}

IPFSClient interface

type MemoryCacheEngineOption added in v2.1.0

type MemoryCacheEngineOption func(*memoryCacheEngine) error

MemoryCacheEngineOption is an option to set cache engine

func WithEmbeddedDocumentBytes added in v2.1.0

func WithEmbeddedDocumentBytes(u string, doc []byte) MemoryCacheEngineOption

WithEmbeddedDocumentBytes sets bytes for given url

Jump to

Keyboard shortcuts

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