Skip to content

Commit abdb35b

Browse files
committed
Add ADaaS documentation.
1 parent 8b5b2a7 commit abdb35b

11 files changed

+1175
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Airdrop-as-a-Service (ADaaS)
2+
3+
Airdrop-as-a-Service (ADaaS) as a system consists of the internal Airdrop components and a Worker (Extractor or Loader),
4+
which is a Snap-In with a predefined structure.
5+
These Workers (Extractors and Loaders) can be built by anyone, not just DevRevelers.
6+
7+
It is useful to know how the system works though, so this section explains how ADaaS works at a high level.
8+
Message protocols and other specifics can be found in the Extractor and Loader sections.
9+
10+
It’s also useful to know that Airdrop uses its own AWS S3 structure
11+
(and its own buckets) and that only Airdrop components have access to it.
12+
This means that Workers can’t access these buckets directly,
13+
which is why all their data has to be uploaded to DevRev through S3Interact.
14+
15+
For clarity, Artifact API and Airdrop are shown as separate entities,
16+
even though they are both accessed through DevRev’s API.
17+
Worker is shown as external, to clarify that it is developed by third parties,
18+
even though it runs on DevRev’s infrastructure.
19+
20+
```mermaid
21+
---
22+
title: ADaaS architecture high-level overview
23+
---
24+
graph TB
25+
externalSystem[External system]
26+
worker([Worker])
27+
s3interact[s3interact]
28+
airdrop[Airdrop]
29+
s3[(AWS S3)]
30+
31+
externalSystem <-- Get/create users, issues, ... --> worker
32+
33+
worker <-- Exchange artifact upload/download URLs --> s3interact
34+
worker <-- Upload/download artifacts --> s3
35+
worker <-- ADaaS messages and REST API --> airdrop
36+
37+
38+
subgraph DevRev
39+
s3interact <-- Prepare upload/download URL --> s3
40+
airdrop <-- Download/upload artifacts --> s3
41+
end
42+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Creating Keyrings
2+
3+
Keyrings are a DevRev-specific mechanism for managing authentication for External Systems.
4+
They are called Connections in the DevRev app.
5+
6+
They provide a secure way to store and manage credentials within your DevRev Snap-In.
7+
This eliminates the need to expose sensitive information like passwords
8+
or access tokens directly within your code or configuration files, enhancing overall security.
9+
10+
Read more about Keyrings in the [developer documentation](https://developer.devrev.ai/snapin-development/references/keyrings).
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Attachment Extraction phase
2+
3+
For the Attachment Extraction phase of the import process,
4+
the Extractor has to upload each Attachment to DevRev’s S3 using the using S3Interact.
5+
6+
After uploading an attachment or a batch of attachments, the Extractor also has to prepare and upload an SSOR attachment file.
7+
It should contain the DevRev IDs of the extracted attachments, along with the parent and actor IDs from the External System.
8+
This needs to be done because only the Extractor knows to what the attachment was attached in the External system.
9+
The SSOR attachment file should then be sent just like any normal Artifact, but with the `ssor_attachment` item type.
10+
11+
## Examples
12+
13+
Here is an example of an SSOR attachment file:
14+
```json
15+
[
16+
{
17+
"id": {
18+
"external": "don:core:dvrv-us-1:devo/1:artifact/1" // The DON of the uploaded artifact
19+
},
20+
"parent_id": {
21+
"external": "12345", // ID of the parent in the source system
22+
},
23+
"actor_id": {
24+
"external": "123456", // ID of the uploader in the source system
25+
}
26+
},
27+
{
28+
"id": {
29+
"external": "don:core:dvrv-us-1:devo/1:artifact/2" // The DON of the uploaded artifact
30+
},
31+
"parent_id": {
32+
"external": "12344", // ID of the parent in the source system
33+
},
34+
"actor_id": {
35+
"external": "123457", // ID of the uploader in the source system
36+
}
37+
}
38+
]
39+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Data Extraction Phase
2+
3+
In the data extraction phase, the Extractor is expected to call the External System’s APIs
4+
to retrieve all the items that were updated since the start of the last extraction.
5+
If there was no previous extraction (the current run is an Initial Import), then all the items should be extracted.
6+
The Extractor should remember at what time it started each extraction,
7+
so that it can extract only items created and/or updated since this date in the next extraction run.
8+
The reason for remembering it at the start of the extraction, and not at the end, is to allow some overlap
9+
in case the items are updated during extraction (which happens very often in bigger organizations).
10+
11+
Each batch of extracted items (the recommended batch size is 2000-5000 items) must be formatted in JSONL
12+
(JSON Lines format), gzipped, and submitted as an Artifact to S3Interact (with tooling from `@devrev/adaas-sdk`).
13+
14+
Each Artifact is submitted with an `item_type`, defining a separate domain object from the External System.
15+
Item types defined when uploading extracted data must match those in the Initial Domain Mapping Artifact.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Extract External Sync Units Phase
2+
3+
In the External Sync Unit extraction phase, the Extractor is expected to get the list of projects, repositories, etc.
4+
(whatever the equivalent of those is called in the External System)
5+
that it can extract with the provided credentials and send it to Airdrop in its response.
6+
7+
The most important structure in the message is the list of External Sync Units (event_data.external_sync_units in JSON),
8+
which contains the following fields:
9+
- ID: This is the unique identifier in the External System
10+
- Name: This is the human-readable name in the External System
11+
- Description: A short description if the External System provides it
12+
- Item count (item_count): The number of items (issues, tickets, comments, etc.) in the External System,
13+
if it can be obtained in a very lightweight manner, such as by calling a special API endpoint.
14+
If there is no such way to get it, i.e., the items would need to be extracted to count them,
15+
then the item count should be `-1`, to avoid blocking the import with long-running queries.
16+
17+
Example:
18+
```json
19+
[
20+
{
21+
"id": "a-microservice-repository",
22+
"name": "A Microservice Repository",
23+
"description": "Our greatest microservice repo",
24+
"item_count": 232
25+
}
26+
]
27+
```

0 commit comments

Comments
 (0)