store

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// ContextStoreName is a JSON-LD context store name.
	ContextStoreName = "ldcontexts"

	// ContextRecordTag is a tag associated with every record in the store.
	ContextRecordTag = "record"
)
View Source
const (
	// RemoteProviderStoreName is a remote provider store name.
	RemoteProviderStoreName = "remoteproviders"

	// RemoteProviderRecordTag is a tag associated with every record in the store.
	RemoteProviderRecordTag = "record"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextStore

type ContextStore interface {
	Get(u string) (*jsonld.RemoteDocument, error)
	Put(u string, rd *jsonld.RemoteDocument) error
	Import(documents []ldcontext.Document) error
	Delete(documents []ldcontext.Document) error
}

ContextStore represents a repository for JSON-LD context operations.

type ContextStoreImpl

type ContextStoreImpl struct {
	// contains filtered or unexported fields
}

ContextStoreImpl is a default implementation of JSON-LD context repository.

func NewContextStore

func NewContextStore(storageProvider storage.Provider) (*ContextStoreImpl, error)

NewContextStore returns a new instance of ContextStoreImpl.

func (*ContextStoreImpl) Delete

func (s *ContextStoreImpl) Delete(documents []ldcontext.Document) error

Delete deletes matched context documents in the underlying storage. Documents are matched by context URL and ld.RemoteDocument content hash.

func (*ContextStoreImpl) Get

Get returns JSON-LD remote document from the underlying storage by context url.

func (*ContextStoreImpl) Import

func (s *ContextStoreImpl) Import(documents []ldcontext.Document) error

Import imports JSON-LD contexts into the underlying storage.

func (*ContextStoreImpl) Put

Put saves JSON-LD remote document into the underlying storage under key u (context url).

type RemoteProviderRecord

type RemoteProviderRecord struct {
	ID       string `json:"id"`
	Endpoint string `json:"endpoint"`
}

RemoteProviderRecord is a record in store with remote provider info.

type RemoteProviderStore

type RemoteProviderStore interface {
	Get(id string) (*RemoteProviderRecord, error)
	GetAll() ([]RemoteProviderRecord, error)
	Save(endpoint string) (*RemoteProviderRecord, error)
	Delete(id string) error
}

RemoteProviderStore represents a repository for remote context provider operations.

type RemoteProviderStoreImpl

type RemoteProviderStoreImpl struct {
	// contains filtered or unexported fields
}

RemoteProviderStoreImpl is a default implementation of remote provider repository.

func NewRemoteProviderStore

func NewRemoteProviderStore(storageProvider storage.Provider) (*RemoteProviderStoreImpl, error)

NewRemoteProviderStore returns a new instance of RemoteProviderStoreImpl.

func (*RemoteProviderStoreImpl) Delete

func (s *RemoteProviderStoreImpl) Delete(id string) error

Delete deletes a remote provider record in the underlying storage.

func (*RemoteProviderStoreImpl) Get

Get returns a remote provider record from the underlying storage.

func (*RemoteProviderStoreImpl) GetAll

GetAll returns all remote provider records from the underlying storage.

func (*RemoteProviderStoreImpl) Save

Save creates a new remote provider record and saves it to the underlying storage. If record with given endpoint already exists in the store, it is returned to the caller.

Jump to

Keyboard shortcuts

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