---
# System prepended metadata

title: AGORA PoC v0.2 | Message Sequences

---

[Agora-System](/sqedw7tHRye1RoAt5O108A) --- [API](/TreDITwVTiK_KRemt9QOLA) --- [Message Sequences](/AUbhB5KxSb2jQJBloKtC1g) --- [Asset (Proposal)](/cICGuug-Tde1sGuvpsBAJQ) --- [PoC Definition](/aSqmHZ4uRW-iC9N_Pesd5g) --- [Old Stuff](/B4Nn8Zn9RVyGJDk4bHYHbw) --- [Demo](/rAv27FvBQXmv_rLpKQB25w)


# AGORA PoC v0.2 | Message Sequences


[toc]


## Template

```plantuml
actor CLI as CLI order 0
actor aGUIra as Client order 10
participant Keeper as Keep order 20
participant Marketplace as MP order 30
participant SearchEngine as SE order 40
participant AssetManager as AM order 50
participant ExecutionManager as EM order 60
participant NodeExecutor as NE order 70


```

## Register at $n-1$

```plantuml

participant NewComponent as nc
participant HigherLevelComponent as hlc
participant OtherComponents as oc

nc -> hlc: POST /register: Credentials
hlc -> nc: GET /config
nc --> hlc: ComponentMetadataInfo [without CID]

hlc --> nc: RegistrationSuccessfulMessage(CID)

group optional

    hlc -> oc: POST AdvertiseNewComponent(Message)

end

alt registration exception

    hlc --> nc: RegistrationFailed

end
```

## Unregister from $n-1$

```plantuml

participant LowerLevelComponent as nc
participant HigherLevelComponent as hlc
participant OtherComponents as oc

nc -> hlc: POST RequestUnregistration(Credentials)
hlc --> nc: UnregistrationSuccessfulMessage

group optional

    hlc -> oc: AdvertiseUnregistration(Message)

end
```

## Pull Update of Metadata from $n-1$

```plantuml
participant HigherLevelComponent as hlc order 20
participant LowerLevelComponent as llc order 30

hlc -> llc: GET GetMetadata()
llc --> hlc: Metadata

```

## Push Update of Metadata to $n-1$

```plantuml
participant LowerLevelComponent as llc order 20
participant HigherLevelComponent as hlc order 30

llc -> hlc: POST PushNewMetadata()

```

## Keeper: List Marketplaces

```plantuml
actor aGUIra as Client order 10
participant Keeper as Keep order 20

Client -> Keep: GET ListMarketplaces()
Keep --> Client: Marketplace[]

```

## Ban Rules

### Create / Update Ban-Rule to Ban-Rule-List for $n+1$ Components

```plantuml
actor ComponentManager as mgrorder 10
participant LowerLevelComponent as llc order 30
participant HigherLevelComponent as hlc order 20
participant OtherComponents as oc order 40

mgr -> hlc: POST AddBanRule(Credentials, Rule)
hlc -> llc !!: BanAffectedNotification
hlc --> mgr: AddBanRuleSuccessful

group optional

    hlc -> oc: BanSpokenOutNotification(URI)

end
```
+ unimportant error messages are not listed (like "ruleset couldn't be parsed")

### Delete Ban-Rule to Ban-Rule-List for $n+1$ Components

```plantuml
actor ComponentManager as mgrorder 10
participant HigherLevelComponent as hlc order 20

mgr -> hlc: RemoveBanRule(Credentials, Rule)
hlc --> mgr: RemoveBanRuleSuccessful
```
+ unimportant error messages are not listed (like "ruleset couldn't be parsed")

## Get Version

```plantuml
actor Client as client
participant Component as comp

client -> comp: GetVersion()
comp --> client: Version 

```

## Get Metadata

```plantuml
actor Client as client
participant Component as comp

client -> comp: GetMetadata()
comp --> client: Metadata 

```

## Get Configuration

```plantuml
actor Client as client
participant Component as comp

client -> comp: GetConfiguration()
comp --> client: Configuration

```

## Get Certificate

```plantuml
actor Client as client
participant Component as comp

client -> comp: GetCertificate()
comp --> client: Certificate 

```

## Join Logical Keeper [Pending]

```plantuml
actor NewKeeperAdmin as nka
participant ExistingLogicalKeeper as elk order 20
participant NewKeeper as nk order 10


nk -> elk: JoinLogicalKeeper(Ceretificate)


```
## Execute Query [Pending]

Premise:

+ authentication is done


```plantuml
actor aGUIra as Client order 10
participant Marketplace as MP order 30
participant AssetManager as AM order 50
'collections DataAsset as Asset order 55
collections Asset as Asset order 55
participant ExecutionManager as EM order 60
participant NodeExecutor1 as NE order 70
collections NodeExecutor2 as NENext order 85
participant ExecutionPlatform as EP order 80
participant ExecutionPlatform2 as EPNext order 90

Client -> EM: SubmitAgoraQuery(Query)
activate EM 

EM -> MP: StartTransaction(User)
MP --> EM: BillingTxInfo

EM --> Client: AgoraQueryLocation(ID)
EM -> AM: GetAssetMetadata
AM --> EM: AssetMetadata
EM -> NE: GetMetadata
NE --> EM: Metadata
EM -> NENext: GetMetadata
NENext --> EM: Metadata
'Note (Jorge): Makes sure all the assets exists and can be consumed, plus the stats to perform optimizations'
EM -> NE: SubmitAgoraXR(ExecutionRepresentation)
', BillingTxInfo'
activate NE
EM -> MP: AddBillingTxStep(Metrics, BillingTxInfo)
deactivate EM


group optional
    NE -> AM: GetAssetMetadata
    AM --> NE: AssetMetadata
    'Note(Jorge): Some additional metadata the Node Executor might require, it is a bottleneck'

end

NE -> NENext: SubmitAgoraXR(ExecutionRepresentation)
activate NENext

alt fetch data beforehands (Example of Dataset)

    'NE -> Asset: GetData (GetAsset)'
    'Note(Jorge): Get Access/Credentials to use the asset'
    'Note (Jorge): Asset Manager gives access and the Data'
    NE -> AM: GetData (GetAsset)
    AM --> NE: Data/Credentials/Human
    'Discuss about what the get asset for each case is'
end

NE -> EP: RunQuery(Query [, Data])
deactivate NE
activate EP
'NE -> MP: AddBillingTxStep(Metrics, BillingTxInfo)

...

alt fetch data just-in-time
    EP -> Asset: GetData
    Asset --> EP: Data
end

...

group repeat

NENext -> EPNext: RunQuery(Query [, Data])
activate EPNext
...

alt fetch data just-in-time
    EPNext -> Asset: GetData
    Asset --> EPNext: Data
end

...

EP --> NE: Response 
deactivate EP
...


EPNext --> NENext: Response
deactivate EPNext

NE <-> NENext: SendData(Data)

...


end

NENext -> AM: WriteOutput 
'As a private asset, only the user who triggered the query has access'
deactivate NENext

AM -> Asset: PutData

 
group loop until done
    Client -> AM: CheckIfUpdated
    AM --> Client: CheckIfUpdatedResponse
end


```

+ Query includes AssetURIs
+ Output Asset is 
+ Assumptions:
    +  More than one Execution Node is feasible, but details must be defined for such "case", for instance, "orchestration", aggregated or final results
    +  Assets involved in the Query are already 
+ Feedback
    + [x] think about other kinds of assets
        + code, that needs to be executed on an ExecutionPlatform
    + [ ] notification of users
        + maybe via e-mail
+ Final result is sent to a known new Data/Storage Asset, the user can access that asset. Explicitly defined in format and place by the user.
+ Intermediate results and data can be transfered either between Execution Platforms, when possible, or through the Node Executors.
    + This information should be in the Metadata


## Create Pipeline Asset

:::danger
Review the Asset Registration Process at [Register Asset](/AUbhB5KxSb2jQJBloKtC1g#Register-Asset)
:::

Assumption: The goal of a Pipeline Asset (which is a special Asset) is to "run/execute" it within Agora at some point in the future. The Pipeline Manager is a specialized Asset Manager for managing those Pipeline Assets.

Validation is done in two phases, first phase is done in the aGUIra composer. Second phase is optional for the Agora Ecosystem with Execution Layer.

prerequisites:
+ client assumes to know assets already

```plantuml
actor aGUIra as Client order 10
collections AssetManager as AM order 50
participant PipelineManager as PM order 48
participant ExecutionManager as EM order 60
collections NodeExecutor as NE order 70

Client -> PM: POST /assetmanager/asset
activate PM
'check whether all assets exist and get metadata'
PM -> EM: POST /executionmanager/execute/dryrun
activate EM
EM -> AM: GET /assetmanager/asset/:id
activate AM
AM --> EM: Metadata
deactivate AM
EM -> NE: GET /nodeexecutor/asset/:id
activate NE
NE --> EM: Metadata
deactivate NE
EM --> PM: DryRunResult
deactivate EM
PM --> Client: CreateAssetResult
deactivate PM


```

## CRUD Operations over an Asset

:::warning 
This is a preliminary version, meant to test the initial SimpleMetadata schema. Valid until 02/May/2022.
:::

### Asset Registration at Asset Manager (Create)

Assuming one AssetManager is registered in multiple Marketplaces.

```plantuml
actor aGUIra as Client order 10
participant AssetManager as AM order 50


Client -> AM: POST(Metadata) /assets
AM -> AM: Valid registration
group if successful
AM -> Client: Metadata
end

```


### Search Engine Crawling

```plantuml
participant SearchEngine as SE order 30
participant Keeper as KE order 40
participant AssetManager as AM order 60
collections Marketplaces as MP order 50


SE -> KE: GET /marketplaces
KE --> SE: 200 List<Marketplace>
SE -> MP: GET /assetmanagers
MP --> SE: 200 List<AssetManager>
SE -> AM: GET /assets
AM --> SE: 200 List<AssetMetadata>
SE -> SE: Index Entries

```