httk.serve.dsp.models¶
Immutable records and protocol errors for the Data Space Protocol provider.
Attributes¶
An immutable JSON value snapshot. |
|
A JSON scalar -- string, number, boolean, or null. |
|
An arbitrary JSON value modelled with ordinary mutable containers. |
|
Exceptions¶
Represent a protocol failure that an HTTP adapter can serialize directly. |
|
Report that a callback was delivered but a concurrent transition won the commit. |
Classes¶
Describe delivery health without claiming an unacknowledged DSP transition. |
|
Describe the one static, unconditional offer exposed by the provider. |
|
Describe the single service through which the dataset is delivered. |
|
Describe a public API included only in the owned DCAT projection. |
|
Describe the one pull distribution for the provider dataset. |
|
Group one dataset with its DSP offer, distribution, and data address. |
|
Describe the immutable multi-dataset catalogue served by this provider. |
|
Record the provider-created agreement associated with a negotiation. |
|
Record an in-memory contract negotiation and its acknowledged state. |
|
Record an in-memory transfer process and its acknowledged state. |
Functions¶
|
Freeze a JSON-compatible value without retaining caller-owned containers. |
|
Return an independent ordinary JSON value from an immutable snapshot. |
Module Contents¶
- type httk.serve.dsp.models.FrozenJsonValue = JsonScalar | tuple['FrozenJsonValue', ...] | Mapping[str, 'FrozenJsonValue'][source]¶
An immutable JSON value snapshot.
The mapping arm is typed as
Mappingso a plain mutabledictsatisfies it statically, whilefreeze_json()guarantees aMappingProxyTypeat runtime. This static/runtime gap is intentional and is not closed here.
- type httk.serve.dsp.models.JsonScalar = str | int | float | bool | None[source]¶
A JSON scalar – string, number, boolean, or null.
- type httk.serve.dsp.models.JsonValue = JsonScalar | list['JsonValue'] | dict[str, 'JsonValue'][source]¶
An arbitrary JSON value modelled with ordinary mutable containers.
- httk.serve.dsp.models.freeze_json(value)[source]¶
Freeze a JSON-compatible value without retaining caller-owned containers.
- Parameters:
value (object) – JSON-compatible value to copy into an immutable representation.
- Returns:
An immutable JSON-compatible value.
- Raises:
TypeError – If
valueis not JSON-compatible.ValueError – If a floating-point value is non-finite.
- Return type:
- httk.serve.dsp.models.thaw_json(value)[source]¶
Return an independent ordinary JSON value from an immutable snapshot.
- Parameters:
value (FrozenJsonValue) – Immutable JSON-compatible value to copy.
- Returns:
Plain JSON-compatible lists and dictionaries.
- Return type:
- class httk.serve.dsp.models.DeliveryStatus[source]¶
Describe delivery health without claiming an unacknowledged DSP transition.
- Parameters:
last_error – Most recent callback failure, if any.
retry_count – Number of delivery attempts made for the last callback.
out_of_sync – Whether the remote peer may not have the acknowledged local state.
- class httk.serve.dsp.models.OfferProfile[source]¶
Describe the one static, unconditional offer exposed by the provider.
- Parameters:
id – Stable offer identifier.
target – Dataset identifier to which a message offer must refer.
- class httk.serve.dsp.models.DataServiceProfile[source]¶
Describe the single service through which the dataset is delivered.
- Parameters:
id – Stable data-service identifier.
title – Human-readable service title.
endpoint_url – HTTPS endpoint used for data delivery.
- class httk.serve.dsp.models.DcatDataServiceProfile[source]¶
Describe a public API included only in the owned DCAT projection.
- Parameters:
id – Stable service identifier.
title – Human-readable service title.
endpoint_url – Public HTTPS API endpoint.
conforms_to – Technical standards implemented by the service.
serves_dataset_ids – Catalogue dataset identifiers served by the API.
endpoint_description – Optional IRI describing the API interface.
- class httk.serve.dsp.models.DistributionProfile[source]¶
Describe the one pull distribution for the provider dataset.
- Parameters:
id – Stable distribution identifier.
format – DSP transfer format advertised for the distribution.
access_url – HTTPS URL from which data are pulled.
data_service – Embedded service description for DSP catalogue output.
- data_service: DataServiceProfile[source]¶
- class httk.serve.dsp.models.DatasetProfile[source]¶
Group one dataset with its DSP offer, distribution, and data address.
- Parameters:
dataset – Protocol-neutral dataset metadata.
offer – Unconditional ODRL use offer for this dataset.
distribution – Pull distribution advertised for this dataset.
data_service – Service embedded in the distribution.
data_address – Immutable pull address returned for authorized transfers.
- dataset: httk.core.Dataset[source]¶
- offer: OfferProfile[source]¶
- distribution: DistributionProfile[source]¶
- data_service: DataServiceProfile[source]¶
- data_address: collections.abc.Mapping[str, httk.serve.jsondata.FrozenJsonValue][source]¶
- class httk.serve.dsp.models.CatalogueProfile[source]¶
Describe the immutable multi-dataset catalogue served by this provider.
- Parameters:
id – Stable catalogue identifier.
title – Human-readable catalogue title.
description – Human-readable catalogue description.
participant_id – Provider participant identifier.
dcat_ap_profile – Configured minimal DCAT-AP profile IRI.
datasets – Dataset publication profiles in stable declaration order.
dcat_data_services – Additional public APIs for the DCAT projection.
- datasets: tuple[DatasetProfile, Ellipsis][source]¶
- dcat_data_services: tuple[DcatDataServiceProfile, Ellipsis][source]¶
- class httk.serve.dsp.models.AgreementRecord[source]¶
Record the provider-created agreement associated with a negotiation.
- Parameters:
id – Unique agreement identifier in
urn:uuid:form.policy – Immutable agreement policy JSON.
target – Dataset identifier covered by the agreement.
assigner – Provider participant identifier.
assignee – Consumer participant identifier.
timestamp – UTC XML Schema date-time at which the agreement was created.
- class httk.serve.dsp.models.NegotiationRecord[source]¶
Record an in-memory contract negotiation and its acknowledged state.
- Parameters:
provider_pid – Provider process identifier.
consumer_pid – Consumer process identifier.
callback_address – Consumer callback base URL.
state – Last state acknowledged by both protocol processing and callback delivery.
policy – Immutable message offer accepted for the negotiation.
agreement – Created agreement after an agreement callback is acknowledged.
pending_transition – Reserved transition token, if a callback is currently in flight.
delivery – Local delivery health for the latest callback.
- agreement: AgreementRecord | None = None[source]¶
- delivery: DeliveryStatus[source]¶
- class httk.serve.dsp.models.TransferRecord[source]¶
Record an in-memory transfer process and its acknowledged state.
- Parameters:
provider_pid – Provider transfer-process identifier.
consumer_pid – Consumer transfer-process identifier.
callback_address – Consumer callback base URL.
agreement_id – Finalized agreement authorizing this transfer.
format – Requested transfer format.
state – Last state acknowledged by both protocol processing and callback delivery.
pending_transition – Reserved transition token, if a callback is currently in flight.
delivery – Local delivery health for the latest callback.
- delivery: DeliveryStatus[source]¶
- exception httk.serve.dsp.models.DspProtocolError(kind, status_code, detail, *, code=None, provider_pid=None, consumer_pid=None)[source]¶
Bases:
ExceptionRepresent a protocol failure that an HTTP adapter can serialize directly.
- Parameters:
kind (ErrorKind) – DSP area whose official error document must be emitted.
status_code (int) – HTTP status suitable for the adapter response.
detail (str) – Safe human-readable failure detail.
code (str | None) – Optional machine-readable DSP error code.
provider_pid (str | None) – Provider process identifier, when one is known.
consumer_pid (str | None) – Consumer process identifier, when one is known.
- exception httk.serve.dsp.models.DspTransitionSuperseded[source]¶
Bases:
RuntimeErrorReport that a callback was delivered but a concurrent transition won the commit.
This is not a protocol error: by the time it is raised the peer callback has already been delivered successfully, and only the local commit lost a race with a concurrent state transition. There is nothing to report on the wire and no HTTP status to carry, so it deliberately does not subclass
DspProtocolError.