Commit d3658fc
authored
Send recv (#18)
First implementation of send/recv. Few things might move around in the
future (e.g., were we create the notifier connection). Also this PR does
not handle breaks on the connection checking for NOTIFY.
How it works:
- Send/Recv functions are special durable steps
- Recv, before checking in the DB if the message exists, will wait for
PG notifications for a set timeout.
- A notification listener loop is created with the system database, and
"launched" with it.
Some details:
- Use the builtin PGX `WaitForNotification` and `OnNotification`
mechanisms.
- A recv call will create a new channel and share it with the
notification listener. Upon receiving a notification, the notification
listener will check if a channel was shared for a given payload, and
write a value on the channel to signal the receiver.
About what can be sent: to send non built-in types, users must register
them with `encoding/gob` because that's what we use to serialize the
message. Usual constraints apply (e.g., no exported fields <-> not
serializable). Also note that `encoding/gob` cannot encode raw `nil`
values.1 parent 6fafdb5 commit d3658fc
File tree
7 files changed
+680
-17
lines changed- dbos
- migrations
7 files changed
+680
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
3 | 9 | | |
4 | 10 | | |
5 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
71 | 86 | | |
72 | 87 | | |
73 | 88 | | |
| |||
0 commit comments