View Source Smee.Source (Smee v0.5.0)
Defines sources for metadata, which can then be Fetch
ed and prodoce Metadata structs. Source structs are the
usual starting-place for Smee tasks.
Source structs act as the configuration for metadata creation. They require a URL but various other options can be set and their effect will propagate down to Entity records.
Summary
Functions
Attempts to validate a source struct, and will return an :ok/:error tuple containing the Source if it passes checks.
Attempts to validate a source struct, and will return the Source if it passes checks, or raise an exception.
Creates a new source struct, describing where and how to find metadata.
Tags a source with one or more tags, replacing existing tags.
Returns the tags of the source struct, a list of binary strings
Types
@type t() :: %Smee.Source{ auth: nil | keyword(), cache: boolean(), cert_fingerprint: nil | binary(), cert_url: binary(), fedid: binary() | atom(), id: binary() | atom(), label: nil | binary(), priority: integer(), redirects: integer(), retries: integer(), strict: boolean(), tags: [binary()], trustiness: float(), type: nil | atom(), url: binary() }
Functions
Attempts to validate a source struct, and will return an :ok/:error tuple containing the Source if it passes checks.
Attempts to validate a source struct, and will return the Source if it passes checks, or raise an exception.
Creates a new source struct, describing where and how to find metadata.
The only essential parameter is a URL for the metadata. URLs can have file:
, http://
, or https://
schemes.
Bare filesystem paths can also be passed and will be converted to file:
URLs.
MDQ service clients should be configured with the base URL of the service, not the /entity/
endpoint, and a
type of :mdq. Alternatively the Smee.MDQ.source/2
function can be used as a shortcut.
Available options include:
- type: determines the general type of metadata - :aggregate (the default), :single and :mdq
- cert_url: location of certificate to use when verifying signed metadata
- cert_fingerprint: SHA1 fingerprint of the signing certificate
- cache: should HTTP caching be enabled for downloads. true or false, defaults to true.
- redirects: maximum number of 302 redirects to follow
- retries: number of retries to attempt
- label: a relatively useless label for the metadata
- priority: integer between 0 and 9, used for comparing metadata
- trustiness: float between 0.0 and 0.9, for comparing metadata
- strict: defaults to false. If enabled some stricter checks are enabled
MDQ sources are intended for use with the Smee.MDQ
API but will also support normal fetch requests.
Tags a source with one or more tags, replacing existing tags.
Tags are arbitrary strings. They will be inherited by metadata and entities derived from this source.
Returns the tags of the source struct, a list of binary strings
Tags are arbitrary classifiers