Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove CONSUMER_ and PROVIDER_ prefixes from CN states #71

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions negotiation/contract.negotiation.binding.https.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ the [ContractNegotiation](./message/contract-negotiation.json):
"@context": "https://w3id.org/dspace/v0.8/context.json",
"@type": "dspace:ContractNegotiation"
"@id": "urn:uuid:dcbf434c-eacf-4582-9a02-f8dd50120fd3",
"dspace:state" :"CONSUMER_REQUESTED"
"dspace:state" :"REQUESTED"
}
```

Predefined states are: `CONSUMER_REQUESTED`, `PROVIDER_OFFERED`, `CONSUMER_AGREED`, `PROVIDER_AGREED`, `CONSUMER_VERIFIED`, `PROVIDER_FINALIZED`, and `TERMINATED`.
Predefined states are: `REQUESTED`, `OFFERED`, `ACCEPTED`, `AGREED`, `VERIFIED`, `FINALIZED`, and `TERMINATED`.

If the negotiation does not exist or the client is not authorized, the provider connector must return an HTTP 404 (Not Found) response.

### 2.5 The provider `negotiations/request` resource

#### 2.5.1 POST

A contract negotiation is started and placed in the `CONSUMER_REQUESTED` state when a consumer POSTs
A contract negotiation is started and placed in the `REQUESTED` state when a consumer POSTs
a [ContractRequestMessage](./contract.negotiation.protocol.md#1-contractrequestmessage)to `negotiations/request`:

```
Expand Down Expand Up @@ -103,7 +103,7 @@ Location: /negotiations/urn:uuid:dcbf434c-eacf-4582-9a02-f8dd50120fd3
"@context": "https://w3id.org/dspace/v0.8/context.json",
"@type": "dspace:ContractNegotiation"
"@id": "urn:uuid:dcbf434c-eacf-4582-9a02-f8dd50120fd3",
"dspace:state" :"CONSUMER_REQUESTED"
"dspace:state" :"REQUESTED"
}
```

Expand Down
26 changes: 13 additions & 13 deletions negotiation/contract.negotiation.protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ the counter-party. Both parties have the same state of the CN. In case the state

The CN states are:

- **CONSUMER_REQUESTED** - A contract for an asset has been requested by the consumer based on an offer and the provider has sent an ACK response.
- **PROVIDER_OFFERED** - The provider has sent a contract offer to the consumer and the consumer has sent an ACK response.
- **CONSUMER_AGREED** - The consumer has accepted the latest contract offer and the provider has sent an ACK response.
- **PROVIDER_AGREED** - The provider has accepted the latest contract offer, sent an agreement to the consumer, and the consumer has sent an ACK response.
- **CONSUMER_VERIFIED** - The consumer has sent an agreement verification to the provider and the provider has sent an ACK response.
- **PROVIDER_FINALIZED** - The provider has sent a finalization message including his own agreement verification to the consumer and the consumer has sent an ACK response. Data is
- **REQUESTED** - A contract for an asset has been requested by the consumer based on an offer and the provider has sent an ACK response.
- **OFFERED** - The provider has sent a contract offer to the consumer and the consumer has sent an ACK response.
- **ACCEPTED** - The consumer has accepted the latest contract offer and the provider has sent an ACK response.
- **AGREED** - The provider has accepted the latest contract offer, sent an agreement to the consumer, and the consumer has sent an ACK response.
- **VERIFIED** - The consumer has sent an agreement verification to the provider and the provider has sent an ACK response.
- **FINALIZED** - The provider has sent a finalization message including his own agreement verification to the consumer and the consumer has sent an ACK response. Data is
now available to the consumer.
- **TERMINATED** - The provider or consumer has placed the contract negotiation in a terminated state. A termination message has been sent by either of the participants and the
other has sent an ACK response. This is a terminal state.
Expand Down Expand Up @@ -58,7 +58,7 @@ The CN state machine is transitioned upon receipt and acknowledgement of a messa

**Sent by**: Consumer

**Resulting State**: CONSUMER_REQUESTED, TERMINATED
**Resulting State**: REQUESTED, TERMINATED

**Example**: [ContractRequestMessage](./message/contract-request-message.json)

Expand Down Expand Up @@ -91,7 +91,7 @@ The `ContractRequestMessage` is sent by a consumer to initiate a contract negoti

**Sent by**: Provider

**Resulting State**: PROVIDER_OFFERED, TERMINATED
**Resulting State**: OFFERED, TERMINATED

**Example**: [ContractOfferMessage](./message/contract-offer-message.json)

Expand All @@ -110,7 +110,7 @@ The `ContractOfferMessage` is sent by a provider to initiate a contract negotiat

**Sent by**: Provider

**Resulting State**: PROVIDER_AGREED, TERMINATED
**Resulting State**: AGREED, TERMINATED

**Example**: [ContractAgreementMessage](./message/contract-agreement-message.json)

Expand All @@ -133,7 +133,7 @@ A `ContractAgreementMessage` must contain an ODRL `Agreement`.

**Sent by**: Consumer

**Resulting State**: CONSUMER_VERIFIED, TERMINATED
**Resulting State**: VERIFIED, TERMINATED

**Example**: [ContractAgreementVerificationMessage](./message/contract-agreement-verification-message.json)

Expand All @@ -155,7 +155,7 @@ A `ContractAgreementVerificationMessage` must contain a `processId`.

**Sent by**: Provider or Consumer

**Resulting State**: PROVIDER_FINALIZED, CONSUMER_AGREED, TERMINATED
**Resulting State**: FINALIZED, ACCEPTED, TERMINATED

**Example**: [ContractNegotiationEventMessage](./message/contract-negotiation-event-message.json)

Expand All @@ -166,12 +166,12 @@ A `ContractAgreementVerificationMessage` must contain a `processId`.
#### Description

When the `ContractNegotiationEventMessage` is sent by a provider with an `eventType` property set to `FINALIZED`, a contract agreement has been finalized and the associated asset
is accessible. The state machine is transitioned to the `PROVIDER_FINALIZED` state. Other event types may be defined in the future. A consumer responds with an error if the signature
is accessible. The state machine is transitioned to the `FINALIZED` state. Other event types may be defined in the future. A consumer responds with an error if the signature
can't be validated or is incorrect.

It is an error for a consumer to send a `ContractNegotiationEventMessage` with an eventType `finalized` to the provider.

When the `ContractNegotiationEventMessage` is sent by a consumer with an `eventType` set to `ACCEPTED`, the state machine is placed in the `CONSUMER_AGREED` state.
When the `ContractNegotiationEventMessage` is sent by a consumer with an `eventType` set to `ACCEPTED`, the state machine is placed in the `ACCEPTED` state.

It is an error for a provider to send a `ContractNegotiationEventMessage` with an eventType `ACCEPTED` to the consumer.

Expand Down
Binary file modified negotiation/contract.negotiation.state.machine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 17 additions & 17 deletions negotiation/contract.negotiation.state.machine.puml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
@startuml "hub-request-processing"
@startuml "contract-negotiation-state-machine"
!pragma layout smetana

!include ../common/style/diagram.styles.puml

hide empty description

state CONSUMER_REQUESTED: <color:$darkGray>ContractRequestMessage
state PROVIDER_OFFERED: <color:$darkGray>ContractOfferMessage
state CONSUMER_AGREED: <color:$darkGray>ContractNegotiationEventMessage:accepted
state PROVIDER_AGREED: <color:$darkGray>ContractAgreementMessage
state CONSUMER_VERIFIED: <color:$darkGray>ContractAgreementVerificationMessage
state PROVIDER_FINALIZED: <color:$darkGray>ContractNegotiationEventMessage:finalized
state REQUESTED: <color:$darkGray>ContractRequestMessage
state OFFERED: <color:$darkGray>ContractOfferMessage
state ACCEPTED: <color:$darkGray>ContractNegotiationEventMessage:accepted
state AGREED: <color:$darkGray>ContractAgreementMessage
state VERIFIED: <color:$darkGray>ContractAgreementVerificationMessage
state FINALIZED: <color:$darkGray>ContractNegotiationEventMessage:finalized

state TERMINATED $lightRed #$borderRed: <color:$darkGray>ContractNegotiationTerminationMessage

[*] --> CONSUMER_REQUESTED: C
CONSUMER_REQUESTED --> PROVIDER_OFFERED: P
CONSUMER_REQUESTED --> PROVIDER_AGREED: P
[*] --> REQUESTED: C
REQUESTED --> OFFERED: P
REQUESTED --> AGREED: P

[*] --> PROVIDER_OFFERED: P
PROVIDER_OFFERED --> CONSUMER_REQUESTED: C
PROVIDER_OFFERED --> CONSUMER_AGREED: C
CONSUMER_AGREED --> PROVIDER_AGREED: P
[*] --> OFFERED: P
OFFERED --> REQUESTED: C
OFFERED --> ACCEPTED: C
ACCEPTED --> AGREED: P

PROVIDER_AGREED --> CONSUMER_VERIFIED: C
AGREED --> VERIFIED: C

CONSUMER_VERIFIED --> PROVIDER_FINALIZED: P
VERIFIED --> FINALIZED: P

PROVIDER_FINALIZED -->[*]
FINALIZED -->[*]
TERMINATED --> [*]

@enduml
4 changes: 2 additions & 2 deletions negotiation/message/contract-negotiation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"@id": "urn:uuid:dcbf434c-eacf-4582-9a02-f8dd50120fd3",
"@type": "dspace:ContractNegotiation",
"dspace:processId": "urn:uuid:dcbf434c-eacf-4582-9a02-f8dd50120fd3",
"dspace:state": "CONSUMER_REQUESTED",
"dspace:state": "REQUESTED",
"dspace:checksum": "..."
}
}
Binary file modified negotiation/message/diagram/contract-negotiation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions negotiation/message/diagram/contract-negotiation.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ class "dspace:ContractNegotiation" {
}

enum dspace:ContractNegotiationState {
"dspace:CONSUMER_REQUESTED"
"dspace:PROVIDER_OFFERED"
"dspace:CONSUMER_AGREED"
"dspace:PROVIDER_AGREED"
"dspace:CONSUMER_VERIFIED"
"dspace:PROVIDER_FINALIZED"
"dspace:REQUESTED"
"dspace:OFFERED"
"dspace:ACCEPTED"
"dspace:AGREED"
"dspace:VERIFIED"
"dspace:FINALIZED"
"dspace:TERMINATED"
"..."
}

"dspace:ContractNegotiation" "1" *-- "1" "dspace:ContractNegotiationState" : "dspace:contractNegotiationState"

@enduml
@enduml