Documentation ¶
Index ¶
Constants ¶
const ( // ContextStoreName is a JSON-LD context store name. ContextStoreName = "ldcontexts" // ContextRecordTag is a tag associated with every record in the store. ContextRecordTag = "record" )
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 ¶
func (s *ContextStoreImpl) Get(u string) (*jsonld.RemoteDocument, error)
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 ¶
func (s *ContextStoreImpl) Put(u string, rd *jsonld.RemoteDocument) error
Put saves JSON-LD remote document into the underlying storage under key u (context url).
type RemoteProviderRecord ¶
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 ¶
func (s *RemoteProviderStoreImpl) Get(id string) (*RemoteProviderRecord, error)
Get returns a remote provider record from the underlying storage.
func (*RemoteProviderStoreImpl) GetAll ¶
func (s *RemoteProviderStoreImpl) GetAll() ([]RemoteProviderRecord, error)
GetAll returns all remote provider records from the underlying storage.
func (*RemoteProviderStoreImpl) Save ¶
func (s *RemoteProviderStoreImpl) Save(endpoint string) (*RemoteProviderRecord, error)
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.