aboutsummaryrefslogtreecommitdiffstats
path: root/docs/query-execution-flow.puml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2025-12-01 18:34:31 -0300
committerGitHub <noreply@github.com>2025-12-01 18:34:31 -0300
commit8c8b32d59acc78c7c3e1e8ecae8492a1b728b482 (patch)
treeb218e550b2b09e4920af6e12db531bfd65f65929 /docs/query-execution-flow.puml
parente03b7c75be589d12ddc97d074abd2e3a5c6b7cdf (diff)
downloadSakura-8c8b32d59acc78c7c3e1e8ecae8492a1b728b482.tar.gz
Sakura-8c8b32d59acc78c7c3e1e8ecae8492a1b728b482.zip
Diagrams (#18)
Diffstat (limited to '')
-rw-r--r--docs/query-execution-flow.puml54
1 files changed, 54 insertions, 0 deletions
diff --git a/docs/query-execution-flow.puml b/docs/query-execution-flow.puml
new file mode 100644
index 0000000..998b0e2
--- /dev/null
+++ b/docs/query-execution-flow.puml
@@ -0,0 +1,54 @@
+@startuml query-execution-flow
+!theme plain
+title Query Execution Flow
+
+actor Client
+participant "Query Planner" as Planner
+participant "Scan Iterator" as Scan
+participant "Select Iterator" as Select
+participant "Project Iterator" as Project
+participant "Operations API" as Ops
+database "Mnesia" as DB
+
+Client -> Planner: query({project,\n {select, {scan, employee}, Pred},\n [name, age]})
+activate Planner
+Planner -> Planner: parse & validate
+Planner -> Scan: spawn_iterator(employee)
+activate Scan
+Planner -> Select: spawn_iterator(Scan, Pred)
+activate Select
+Planner -> Project: spawn_iterator(Select, [name, age])
+activate Project
+Planner --> Client: {ok, Iterator}
+deactivate Planner
+
+Client -> Project: next_tuple()
+Project -> Select: next_tuple()
+Select -> Scan: next_tuple()
+Scan -> Ops: get_tuples_iterator(employee)
+Ops -> DB: transaction(read tuple)
+DB --> Ops: {ok, Tuple}
+Ops --> Scan: {ok, Tuple}
+Scan --> Select: {ok, Tuple}
+Select -> Select: apply Predicate
+Select --> Project: {ok, Tuple}
+Project -> Project: filter attributes
+Project --> Client: {ok, #{name => "Alice", age => 30}}
+
+Client -> Project: next_tuple()
+Project -> Select: next_tuple()
+Select -> Scan: next_tuple()
+Scan -> Ops: get_tuples_iterator(employee)
+Ops -> DB: transaction(read tuple)
+DB --> Ops: done
+Ops --> Scan: done
+Scan --> Select: done
+Select --> Project: done
+Project --> Client: done
+
+Client -> Project: close_iterator()
+deactivate Project
+deactivate Select
+deactivate Scan
+
+@enduml