From 356eec2c2b3915392faf5c44ed693af674283e40 Mon Sep 17 00:00:00 2001 From: Florian Schade Date: Thu, 16 May 2024 15:41:11 +0200 Subject: [PATCH] enhancement(docs): add activity data structure example --- docs/ocis/adr/0028-activities-service.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/docs/ocis/adr/0028-activities-service.md b/docs/ocis/adr/0028-activities-service.md index 4b84d9fff6..aef1e2e2e1 100644 --- a/docs/ocis/adr/0028-activities-service.md +++ b/docs/ocis/adr/0028-activities-service.md @@ -39,7 +39,21 @@ Besides the current resource, the user should also be able to decide if he wants ### Activity format * Normalize the activities before storing them. -* Only store event ids and get the related event from the event-history service when needed. +* Only store relevant data to get the related event from the event-history service when needed, e.g., + ```go + package pseudo_code + + import ( + "time" + ) + + type Activity struct { + ResourceId string + EventID string + Depth int64 + Timestamp time.Time + } + ``` * Store the activity in a human-readable way e.g. "resource A has been shared with user B." * Store each activity only on the resource itself. * Store each activity only on the resource itself and all its parents. @@ -71,9 +85,9 @@ Besides the current resource, the user should also be able to decide if he wants * Other database types might be more efficient for storing activities. * Using the go-micro-store only allows storing the activity in a key-value format. * Activity Format: - * Storing only the event ids and getting the related data from the event-history service when needed - might introduce additional latency when querying activities. - * Adding each event-id to each resource parent leads to a lot of duplicated data. + * Storing only the event ids and getting the related data from the event-history service when needed + might introduce additional latency when querying activities. + * Adding each event-id to each resource parent leads to a lot of duplicated data. ## Pros and Cons of the Options