Skip to content

Commit d412d49

Browse files
committed
📝 docs: polish puml and index page [no ci]
Signed-off-by: Haili Zhang <haili.zhang@outlook.com>
1 parent 2f3451c commit d412d49

File tree

5 files changed

+21
-31
lines changed

5 files changed

+21
-31
lines changed

docs/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@
22

33
This directory contains advanced docs around the Functions Framework.
44

5-
- [Testing events and Pub/Sub](events.md)
65
- [Testing Functions](testing-functions.md)
76
- [Debugging Functions](debugging.md)
8-
- [Running and Deploying Docker Containers](docker.md)
9-
- [Writing a Function in Typescript](typescript.md)
7+
- [Writing a Function in TypeScript](typescript.md)
108
- [ES Modules](esm/README.md)
119

10+
Also containing sequence diagrams of OpenFunction underlying workflows.
11+
12+
- [OpenFunction in Sync Runtime](uml/OpenFunction%20in%20Sync%20Runtime.png)
13+
- [OpenFunction in Async Runtime](uml/OpenFunction%20in%20Async%20Runtime.png)
14+
1215
## Generated Docs
1316

1417
The `generated/` directory contains generated API references.
1518

1619
- [api.md](generated/api.md)
17-
- [api.d.ts](generated/api.d.ts)
1820
- [api.json](generated/api.json)
19-
20-
## TODO Docs
21-
22-
- Run Multiple Cloud Functions [#23](https://github.com/GoogleCloudPlatform/functions-framework-nodejs/issues/23)
99.1 KB
Loading
102 KB
Loading

docs/async-server.puml renamed to docs/uml/ofn-async.puml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@startuml Async Server
1+
@startuml OpenFunction in Async Runtime
22

33
box Function Process in Local Environment or Container
44
control ENTRYPOINT

docs/http-binding.puml renamed to docs/uml/ofn-sync.puml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@startuml HTTP Binding
1+
@startuml OpenFunction in Sync Runtime
22

33
box Function Process in Local Environment or Container
44
control ENTRYPOINT
@@ -9,7 +9,6 @@ participant Express [
99
----
1010
""Express""
1111
]
12-
participant Interceptor
1312
participant "User Function" as UserFunction
1413
participant DaprClient
1514
end box
@@ -22,22 +21,14 @@ ENTRYPOINT -> Main ** : execute
2221
note over ENTRYPOINT, Main: Pass through __CLI arguments__ and \ncontainer __environment variables__
2322

2423
Main -> Main : load user function file
25-
note left: ""function (req, res) {}""
24+
note left: ""function (ctx, data)""
2625

2726
Main -> Server ** : create
2827
note over Main, Server: Hand over __user function__, __function type__ \nand __context__ parsed from env variables
2928

3029
Server -> Express ** : new
3130

32-
Server -> Express : use init middleware
33-
note over Server, Express: Store context in ""res.locals.context""
34-
35-
Server -> Interceptor ** : new
36-
Server -> Express : use interceptor
37-
|||
38-
Server -> Express : use others middlewares
39-
|||
40-
Server -> UserFunction ** : wrap user function
31+
Server -> UserFunction ** : wrap user function in ""function (req, res)""
4132
note over Server, UserFunction: Use Node.js ""Domain"" to run function and catch exceptions
4233
Server -> Express : bind wrapper to "/*" route
4334

@@ -48,27 +39,28 @@ Server -> Express : bind wrapper to "/*" route
4839
[-> Express ++ : HTTP request to "/"
4940

5041
Express -> UserFunction ++ : execute user function
51-
UserFunction --> Express -- : return execution result "data"
5242

53-
alt ""runtime"" = ""knative"" and ""outputs"" is not empty
54-
Express -> Interceptor ++ : invoke interceptor
5543

56-
Interceptor -> Interceptor : load context
57-
Interceptor -> DaprClient ** : new
44+
alt output to Dapr
45+
UserFunction -> DaprClient ** : new
5846

5947
loop each OpenFunction Output
60-
Interceptor -> DaprClient ++ : send "data"
48+
UserFunction -> DaprClient ++ : send "data" asynchronously
6149

62-
DaprClient -> DaprSidecar ++ : invoke binding or publication with "data"
50+
DaprClient -> DaprSidecar ++ : invoke binding \nor pub with "data"
6351
DaprSidecar --> DaprClient -- : return result
6452

65-
DaprClient --> Interceptor -- : forward result
6653
end
6754

68-
Interceptor -> DaprClient !!
69-
Interceptor --> Express -- : return "data" as response
55+
UserFunction -> DaprClient !!
56+
end
57+
58+
alt response via Express
59+
UserFunction -> UserFunction : invoke ""ctx.res"" \n(and ""ctx.req"") methods
7060
end
7161

62+
UserFunction --> Express -- : wrapper ends response
63+
7264
[<- Express -- : send response
7365

7466
...

0 commit comments

Comments
 (0)