Smee.MDQ (Smee v0.1.0) View Source
Smee.MDQ
provides a client API to MDQ services, and also attempts to emulate MDQ-style behaviour with old-fashioned
metadata aggregates. MDQ allows individual entities to be looked up when needed without downloading and processing
an increasingly enormous metadata aggregate file.
Emulation of MDQ for aggregates depends on caching and is usually slower for individual entity lookups even after the initial download and caching is complete.
Link to this section Summary
Functions
Returns the aggregated XML for the MDQ service as a Metadata struct, if one is available.
Fetches an individual entity's metadata from the MDQ service and returns it as an Entity struct.
Fetches an individual entity's metadata from the MDQ service and returns it as an Entity struct.
Returns a list of all entity ID URIs available at the MDQ service.
Fetches an individual entity's metadata from the MDQ service and returns it as an Entity struct in an :ok/:error tuple.
Fetches an individual entity's metadata from the MDQ service and returns it as an Entity struct.
A convenient shortcut for specifying an MDQ service as a source.
Fetches every entity from the MDQ service one by one and returns them as a stream of Entity structs.
Fetches the specified entities from the MDQ service one by one and returns them as a stream of Entity structs.
If passed an entity ID URI is returns the MDQ "transformed" version of the identifer, based on a sha1 hash.
Returns the full download URL for an entity at the specified service.
Link to this section Functions
Specs
aggregate!(source :: Smee.Source.t()) :: Smee.Metadata.t()
Returns the aggregated XML for the MDQ service as a Metadata struct, if one is available.
Specs
get(source :: Smee.Source.t(), entity_id :: binary()) :: Smee.Entity.t() | nil
Fetches an individual entity's metadata from the MDQ service and returns it as an Entity struct.
Get attempts to behave like Ecto's Repo.get
- it will return an entity or nil if the entity is unavailable.
Specs
get!(source :: Smee.Source.t(), entity_id :: binary()) :: Smee.Entity.t()
Fetches an individual entity's metadata from the MDQ service and returns it as an Entity struct.
Get attempts to behave like Ecto's Repo.get!
- it will return an entity or raises an exception if the entity is unavailable.
This is identical to lookup!2
but exists for consistency.
Specs
list!(source :: Smee.Source.t()) :: [binary()]
Returns a list of all entity ID URIs available at the MDQ service.
This will probably involve downloading the MDQ service's aggregate in most cases, but this aggregate will be cached.
Specs
lookup(source :: Smee.Source.t(), entity_id :: binary()) :: {:ok, Smee.Entity.t()} | {:error, any()}
Fetches an individual entity's metadata from the MDQ service and returns it as an Entity struct in an :ok/:error tuple.
Missing or unknown entities will cause an {:error, :http_404} result.
Specs
lookup!(source :: Smee.Source.t(), entity_id :: binary()) :: Smee.Entity.t()
Fetches an individual entity's metadata from the MDQ service and returns it as an Entity struct.
This is identical to get!2
but exists for consistency.
Specs
source(url :: binary(), options :: keyword()) :: Smee.Source.t()
A convenient shortcut for specifying an MDQ service as a source.
This is functionally identical to using Smee.Source.new(url, type: :mdq)
Specs
stream(source :: Smee.Source.t()) :: Enumerable.t()
Fetches every entity from the MDQ service one by one and returns them as a stream of Entity structs.
This stream allows entities to be processed individually, using relatively little memory.
The stream is relatively laid-back even on a fast M1 Mac, but please don't abuse this function and overwhelm public MDQ services.
Specs
stream(source :: Smee.Source.t(), ids :: list()) :: Enumerable.t()
Fetches the specified entities from the MDQ service one by one and returns them as a stream of Entity structs.
This stream allows entities to be processed individually, using relatively little memory.
The stream is relatively laid-back even on a fast M1 Mac, but please don't abuse this function and overwhelm public MDQ services.
Specs
If passed an entity ID URI is returns the MDQ "transformed" version of the identifer, based on a sha1 hash.
Already-transformed identifiers are passed through unchanged.
Specs
url(source :: Smee.Source.t(), entity_id :: binary()) :: binary()
Returns the full download URL for an entity at the specified service.