Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDocumentLoader ¶
func NewDocumentLoader(p provider, opts ...lddocloader.Opts) (jsonld.DocumentLoader, error)
NewDocumentLoader returns a JSON-LD document loader with preloaded contexts.
Types ¶
type Cache ¶
type Cache interface {
Get(key interface{}) (interface{}, bool)
Set(key, value interface{}, cost int64) bool
Del(key interface{})
}
Cache represents caching functionality. Concrete implementation is expected to be thread-safe.
type CachedContextStore ¶
type CachedContextStore struct {
// contains filtered or unexported fields
}
CachedContextStore is a cached store for JSON-LD contexts.
func NewCachedContextStore ¶
func NewCachedContextStore(cacheImpl Cache, contextStore ContextStore) *CachedContextStore
func (*CachedContextStore) Delete ¶
func (s *CachedContextStore) Delete(documents []ldcontext.Document) error
func (*CachedContextStore) Get ¶
func (s *CachedContextStore) Get(u string) (*jsonld.RemoteDocument, error)
func (*CachedContextStore) Import ¶
func (s *CachedContextStore) Import(documents []ldcontext.Document) error
func (*CachedContextStore) Put ¶
func (s *CachedContextStore) Put(u string, rd *jsonld.RemoteDocument) error
type ContextStore ¶
type ContextStore = ldstore.ContextStore
type RistrettoContextCache ¶ added in v1.13.1
type RistrettoContextCache struct {
// contains filtered or unexported fields
}
RistrettoContextCache adapts the generic Ristretto v2 cache to your non-generic ld.Cache interface.
func NewRistrettoContextCache ¶ added in v1.13.1
func NewRistrettoContextCache(maxItems int64) (*RistrettoContextCache, error)
NewRistrettoContextCache creates a cache sized by "items" when you use cost=1 per item. It sets IgnoreInternalCost=true to preserve your unit-cost semantics.
func NewRistrettoContextCacheWithConfig ¶ added in v1.13.1
func NewRistrettoContextCacheWithConfig(cfg *ristretto.Config[string, *jsonld.RemoteDocument]) ( *RistrettoContextCache, error)
NewRistrettoContextCacheWithConfig lets you provide a full Ristretto v2 config (if you prefer).
func (*RistrettoContextCache) Del ¶ added in v1.13.1
func (r *RistrettoContextCache) Del(key interface{})
func (*RistrettoContextCache) Get ¶ added in v1.13.1
func (r *RistrettoContextCache) Get(key interface{}) (interface{}, bool)
func (*RistrettoContextCache) Set ¶ added in v1.13.1
func (r *RistrettoContextCache) Set(key, value interface{}, cost int64) bool
type StoreProvider ¶
type StoreProvider struct {
ContextStore ldstoreapi.ContextStore
RemoteProviderStore ldstoreapi.RemoteProviderStore
CacheImpl Cache
}
StoreProvider provides stores for JSON-LD contexts and remote providers.
func NewStoreProvider ¶
func NewStoreProvider(mongoClient *mongodb.Client, cacheImpl Cache) (*StoreProvider, error)
NewStoreProvider returns a new instance of StoreProvider.
func (*StoreProvider) JSONLDContextStore ¶
func (p *StoreProvider) JSONLDContextStore() ldstoreapi.ContextStore
JSONLDContextStore returns JSON-LD context store.
func (*StoreProvider) JSONLDRemoteProviderStore ¶
func (p *StoreProvider) JSONLDRemoteProviderStore() ldstoreapi.RemoteProviderStore
JSONLDRemoteProviderStore returns JSON-LD remote provider store.