Skip to content

Commit da2d2a7

Browse files
author
Adriano Santos
committedJan 4, 2025·
Merge branch 'main' of github.com:eigr/spawn
2 parents d5a4343 + 6c53354 commit da2d2a7

File tree

10 files changed

+165
-46
lines changed

10 files changed

+165
-46
lines changed
 

‎.github/workflows/ci.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ jobs:
5353
run: |
5454
PGPASSWORD=postgres psql -U postgres -d eigr-functions-db -h localhost -c "SHOW max_connections;"
5555
56-
5756
- name: Shutdown Ubuntu MySQL (SUDO)
5857
run: sudo service mysql stop
5958

@@ -133,13 +132,13 @@ jobs:
133132
MIX_ENV=test \
134133
PROXY_DATABASE_TYPE=postgres \
135134
PROXY_DATABASE_PORT=5432 \
136-
PROXY_DATABASE_POOL_SIZE=95 \
135+
PROXY_DATABASE_POOL_SIZE=10 \
137136
PROXY_DATABASE_USERNAME=postgres \
138137
PROXY_DATABASE_SECRET=postgres \
139138
PROXY_CLUSTER_STRATEGY=gossip \
140139
PROXY_HTTP_PORT=9005 \
141140
SPAWN_STATESTORE_KEY=3Jnb0hZiHIzHTOih7t2cTEPEpY98Tu1wvQkPfq/XwqE= \
142-
elixir --name spawn@127.0.0.1 -S mix test
141+
elixir --name spawn@127.0.0.1 -S mix test --max-cases=1
143142
cd ../../
144143
145144
# - name: Run tests spawn_statestores_mariadb

‎mix.lock

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
%{
22
"acceptor_pool": {:hex, :acceptor_pool, "1.0.0", "43c20d2acae35f0c2bcd64f9d2bde267e459f0f3fd23dab26485bf518c281b21", [:rebar3], [], "hexpm", "0cbcd83fdc8b9ad2eee2067ef8b91a14858a5883cb7cd800e6fcd5803e158788"},
3-
"bakeware": {:hex, :bakeware, "0.2.4", "0aaf49b34f4bab2aa433f9ff1485d9401e421603160abd6d269c469fc7b65212", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "7b97bcf6fbeee53bb32441d6c495bf478d26f9575633cfef6831e421e86ada6d"},
4-
"bandit": {:hex, :bandit, "1.5.3", "c7ee44871da696371a5674dd2c2062e974a18cd787732efcf50cc70b98c78fdc", [:mix], [{:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "3812ed5e48c1f1e3109edb5c463c6f8aaf25ecfac2826606be3e5237550116ef"},
53
"broadway": {:hex, :broadway, "1.1.0", "8ed3aea01fd6f5640b3e1515b90eca51c4fc1fac15fb954cdcf75dc054ae719c", [:mix], [{:gen_stage, "~> 1.0", [hex: :gen_stage, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.3.7 or ~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "25e315ef1afe823129485d981dcc6d9b221cea30e625fd5439e9b05f44fb60e4"},
4+
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
65
"castore": {:hex, :castore, "1.0.11", "4bbd584741601eb658007339ea730b082cc61f3554cf2e8f39bf693a11b49073", [:mix], [], "hexpm", "e03990b4db988df56262852f20de0f659871c35154691427a5047f4967a16a62"},
76
"chacha20": {:hex, :chacha20, "1.0.4", "0359d8f9a32269271044c1b471d5cf69660c362a7c61a98f73a05ef0b5d9eb9e", [:mix], [], "hexpm", "2027f5d321ae9903f1f0da7f51b0635ad6b8819bc7fe397837930a2011bc2349"},
87
"chatterbox": {:hex, :ts_chatterbox, "0.15.1", "5cac4d15dd7ad61fc3c4415ce4826fc563d4643dee897a558ec4ea0b1c835c9c", [:rebar3], [{:hpack, "~> 0.3.0", [hex: :hpack_erl, repo: "hexpm", optional: false]}], "hexpm", "4f75b91451338bc0da5f52f3480fa6ef6e3a2aeecfc33686d6b3d0a0948f31aa"},
@@ -11,6 +10,7 @@
1110
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
1211
"cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911aa1771639bef82651e"},
1312
"cowlib": {:hex, :cowlib, "2.13.0", "db8f7505d8332d98ef50a3ef34b34c1afddec7506e4ee4dd4a3a266285d282ca", [:make, :rebar3], [], "hexpm", "e1e1284dc3fc030a64b1ad0d8382ae7e99da46c3246b815318a4b848873800a4"},
13+
"credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"},
1414
"ctx": {:hex, :ctx, "0.6.0", "8ff88b70e6400c4df90142e7f130625b82086077a45364a78d208ed3ed53c7fe", [:rebar3], [], "hexpm", "a14ed2d1b67723dbebbe423b28d7615eb0bdcba6ff28f2d1f1b0a7e1d4aa5fc2"},
1515
"curve25519": {:hex, :curve25519, "1.0.5", "f801179424e4012049fcfcfcda74ac04f65d0ffceeb80e7ef1d3352deb09f5bb", [:mix], [], "hexpm", "0fba3ad55bf1154d4d5fc3ae5fb91b912b77b13f0def6ccb3a5d58168ff4192d"},
1616
"db_connection": {:hex, :db_connection, "2.7.0", "b99faa9291bb09892c7da373bb82cba59aefa9b36300f6145c5f201c7adf48ec", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dcf08f31b2701f857dfc787fbad78223d61a32204f217f15e881dd93e4bdd3ff"},
@@ -21,9 +21,9 @@
2121
"ecto": {:hex, :ecto, "3.12.5", "4a312960ce612e17337e7cefcf9be45b95a3be6b36b6f94dfb3d8c361d631866", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "6eb18e80bef8bb57e17f5a7f068a1719fbda384d40fc37acb8eb8aeca493b6ea"},
2222
"ecto_sql": {:hex, :ecto_sql, "3.12.1", "c0d0d60e85d9ff4631f12bafa454bc392ce8b9ec83531a412c12a0d415a3a4d0", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.12", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "aff5b958a899762c5f09028c847569f7dfb9cc9d63bdb8133bff8a5546de6bf5"},
2323
"ed25519": {:hex, :ed25519, "1.4.1", "479fb83c3e31987c9cad780e6aeb8f2015fb5a482618cdf2a825c9aff809afc4", [:mix], [], "hexpm", "0dacb84f3faa3d8148e81019ca35f9d8dcee13232c32c9db5c2fb8ff48c80ec7"},
24-
"elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"},
2524
"equivalex": {:hex, :equivalex, "1.0.3", "170d9a82ae066e0020dfe1cf7811381669565922eb3359f6c91d7e9a1124ff74", [:mix], [], "hexpm", "46fa311adb855117d36e461b9c0ad2598f72110ad17ad73d7533c78020e045fc"},
2625
"ex_doc": {:hex, :ex_doc, "0.36.1", "4197d034f93e0b89ec79fac56e226107824adcce8d2dd0a26f5ed3a95efc36b1", [:mix], [{:earmark_parser, "~> 1.4.42", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "d7d26a7cf965dacadcd48f9fa7b5953d7d0cfa3b44fa7a65514427da44eafd89"},
26+
"file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"},
2727
"finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"},
2828
"flame": {:hex, :flame, "0.5.2", "d46c4daa19b8921b71e0e57dc69edc01ce1311b1976c160192b05d4253b336e8", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, ">= 0.0.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "82560ebef6ab3c277875493d0c93494740c930db0b1a3ff1a570eee9206cc6c0"},
2929
"flame_k8s_backend": {:hex, :flame_k8s_backend, "0.5.7", "d1085a0ee47b551da6603018a06c7477cd2023d0a27f21dede8e2a24a17435b7", [:mix], [{:flame, "~> 0.4.0 or ~> 0.5.0", [hex: :flame, repo: "hexpm", optional: false]}], "hexpm", "8eeeb7688f7bf79a2a2bb340f8a66ad757651dff76f7a2e9e92415cb224abc48"},
@@ -62,7 +62,6 @@
6262
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
6363
"nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"},
6464
"nkeys": {:hex, :nkeys, "0.3.0", "837add5261a3cdd8ff75b54e0475062313093929ab5e042fa48e010f33b10d16", [:mix], [{:ed25519, "~> 1.3", [hex: :ed25519, repo: "hexpm", optional: false]}, {:kcl, "~> 1.4", [hex: :kcl, repo: "hexpm", optional: false]}], "hexpm", "b5af773a296620ee8eeb1ec6dc5b68f716386f7e53f7bda8c4ac23515823dfe4"},
65-
"observer_cli": {:hex, :observer_cli, "1.8.1", "edfe0c0f983631961599326f239f6e99750aba7387515002b1284dcfe7fcd6d2", [:mix, :rebar3], [{:recon, "~> 2.5.6", [hex: :recon, repo: "hexpm", optional: false]}], "hexpm", "a3cd6300dd8290ade93d688fbd79c872e393b01256309dd7a653feb13c434fb4"},
6665
"opentelemetry": {:hex, :opentelemetry, "1.5.0", "7dda6551edfc3050ea4b0b40c0d2570423d6372b97e9c60793263ef62c53c3c2", [:rebar3], [{:opentelemetry_api, "~> 1.4", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}], "hexpm", "cdf4f51d17b592fc592b9a75f86a6f808c23044ba7cf7b9534debbcc5c23b0ee"},
6766
"opentelemetry_api": {:hex, :opentelemetry_api, "1.4.0", "63ca1742f92f00059298f478048dfb826f4b20d49534493d6919a0db39b6db04", [:mix, :rebar3], [], "hexpm", "3dfbbfaa2c2ed3121c5c483162836c4f9027def469c41578af5ef32589fcfc58"},
6867
"opentelemetry_ecto": {:hex, :opentelemetry_ecto, "1.2.0", "2382cb47ddc231f953d3b8263ed029d87fbf217915a1da82f49159d122b64865", [:mix], [{:opentelemetry_api, "~> 1.0", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "70dfa2e79932e86f209df00e36c980b17a32f82d175f0068bf7ef9a96cf080cf"},
@@ -79,20 +78,16 @@
7978
"protobuf": {:hex, :protobuf, "0.13.0", "7a9d9aeb039f68a81717eb2efd6928fdf44f03d2c0dfdcedc7b560f5f5aae93d", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "21092a223e3c6c144c1a291ab082a7ead32821ba77073b72c68515aa51fef570"},
8079
"protobuf_generate": {:hex, :protobuf_generate, "0.1.3", "57841bc60e2135e190748119d83f78669ee7820c0ad6555ada3cd3cd7df93143", [:mix], [{:protobuf, "~> 0.12", [hex: :protobuf, repo: "hexpm", optional: false]}], "hexpm", "dae4139b00ba77a279251a0ceb5593b1bae745e333b4ce1ab7e81e8e4906016b"},
8180
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
82-
"recon": {:hex, :recon, "2.5.6", "9052588e83bfedfd9b72e1034532aee2a5369d9d9343b61aeb7fbce761010741", [:mix, :rebar3], [], "hexpm", "96c6799792d735cc0f0fd0f86267e9d351e63339cbe03df9d162010cefc26bb0"},
8381
"retry": {:hex, :retry, "0.18.0", "dc58ebe22c95aa00bc2459f9e0c5400e6005541cf8539925af0aa027dc860543", [:mix], [], "hexpm", "9483959cc7bf69c9e576d9dfb2b678b71c045d3e6f39ab7c9aa1489df4492d73"},
8482
"salsa20": {:hex, :salsa20, "1.0.4", "404cbea1fa8e68a41bcc834c0a2571ac175580fec01cc38cc70c0fb9ffc87e9b", [:mix], [], "hexpm", "745ddcd8cfa563ddb0fd61e7ce48d5146279a2cf7834e1da8441b369fdc58ac6"},
8583
"shards": {:hex, :shards, "1.1.1", "8b42323457d185b26b15d05187784ce6c5d1e181b35c46fca36c45f661defe02", [:make, :rebar3], [], "hexpm", "169a045dae6668cda15fbf86d31bf433d0dbbaec42c8c23ca4f8f2d405ea8eda"},
86-
"sobelow": {:hex, :sobelow, "0.13.0", "218afe9075904793f5c64b8837cc356e493d88fddde126a463839351870b8d1e", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "cd6e9026b85fc35d7529da14f95e85a078d9dd1907a9097b3ba6ac7ebbe34a0d"},
8784
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"},
8885
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
8986
"telemetry_metrics": {:hex, :telemetry_metrics, "1.0.0", "29f5f84991ca98b8eb02fc208b2e6de7c95f8bb2294ef244a176675adc7775df", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f23713b3847286a534e005126d4c959ebcca68ae9582118ce436b521d1d47d5d"},
9087
"telemetry_metrics_prometheus_core": {:hex, :telemetry_metrics_prometheus_core, "1.2.1", "c9755987d7b959b557084e6990990cb96a50d6482c683fb9622a63837f3cd3d8", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "5e2c599da4983c4f88a33e9571f1458bf98b0cf6ba930f1dc3a6e8cf45d5afb6"},
9188
"telemetry_poller": {:hex, :telemetry_poller, "1.1.0", "58fa7c216257291caaf8d05678c8d01bd45f4bdbc1286838a28c4bb62ef32999", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9eb9d9cbfd81cbd7cdd24682f8711b6e2b691289a0de6826e58452f28c103c8f"},
92-
"thousand_island": {:hex, :thousand_island, "1.3.7", "1da7598c0f4f5f50562c097a3f8af308ded48cd35139f0e6f17d9443e4d0c9c5", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "0139335079953de41d381a6134d8b618d53d084f558c734f2662d1a72818dd12"},
9389
"tls_certificate_check": {:hex, :tls_certificate_check, "1.25.0", "702b1835fe718a52310509537392abd067dbe941ebc05fe72409d2b2f8061651", [:rebar3], [{:ssl_verify_fun, "~> 1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "167343ccf50538cf2faf61a3f1460e749b3edf2ecef55516af2b5834362abcb1"},
9490
"uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], [], "hexpm", "c790593b4c3b601f5dc2378baae7efaf5b3d73c4c6456ba85759905be792f2ac"},
95-
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
9691
"x509": {:hex, :x509, "0.8.10", "5d1ec6d5f4db31982f9dc34e6a1eebd631d04599e0b6c1c259f1dadd4495e11f", [:mix], [], "hexpm", "a191221665af28b9bdfff0c986ef55f80e126d8ce751bbdf6cefa846410140c0"},
9792
"yamerl": {:hex, :yamerl, "0.10.0", "4ff81fee2f1f6a46f1700c0d880b24d193ddb74bd14ef42cb0bcf46e81ef2f8e", [:rebar3], [], "hexpm", "346adb2963f1051dc837a2364e4acf6eb7d80097c0f53cbdc3046ec8ec4b4e6e"},
9893
"yaml_elixir": {:hex, :yaml_elixir, "2.11.0", "9e9ccd134e861c66b84825a3542a1c22ba33f338d82c07282f4f1f52d847bd50", [:mix], [{:yamerl, "~> 0.10", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "53cc28357ee7eb952344995787f4bb8cc3cecbf189652236e9b163e8ce1bc242"},

‎spawn_sdk/spawn_sdk_example/lib/_generated/actors/projection_actor.pb.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ defmodule Example.Actors.ProjectionActor.Service do
4949
uninterpreted_option: [],
5050
__pb_extensions__: %{
5151
{Spawn.Actors.PbExtension, :view} => %Spawn.Actors.ActorViewOption{
52-
query: "SELECT * FROM projection_actor",
52+
query: "SELECT * FROM projection_actor WHERE :enum_test IS NULL",
5353
map_to: "results",
5454
page_size: 40,
5555
__unknown_fields__: []
@@ -301,7 +301,7 @@ defmodule Example.Actors.ProjectionActor.Service do
301301
view: %{
302302
type: Spawn.Actors.PbExtension,
303303
value: %Spawn.Actors.ActorViewOption{
304-
query: "SELECT * FROM projection_actor",
304+
query: "SELECT * FROM projection_actor WHERE :enum_test IS NULL",
305305
map_to: "results",
306306
page_size: 40,
307307
__unknown_fields__: []

‎spawn_sdk/spawn_sdk_example/lib/_generated/example/example.pb.ex

+68-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,39 @@
1+
defmodule Example.EnumTest do
2+
@moduledoc false
3+
use Protobuf, enum: true, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
4+
5+
def descriptor do
6+
# credo:disable-for-next-line
7+
%Google.Protobuf.EnumDescriptorProto{
8+
name: "EnumTest",
9+
value: [
10+
%Google.Protobuf.EnumValueDescriptorProto{
11+
name: "ENUM_TEST_UNKNOWN",
12+
number: 0,
13+
options: nil,
14+
__unknown_fields__: []
15+
},
16+
%Google.Protobuf.EnumValueDescriptorProto{
17+
name: "ENUM_TEST_TEST",
18+
number: 1,
19+
options: nil,
20+
__unknown_fields__: []
21+
}
22+
],
23+
options: nil,
24+
reserved_range: [],
25+
reserved_name: [],
26+
__unknown_fields__: []
27+
}
28+
end
29+
30+
field(:ENUM_TEST_UNKNOWN, 0)
31+
field(:ENUM_TEST_TEST, 1)
32+
end
33+
134
defmodule Example.ValuePayload do
235
@moduledoc false
3-
use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.13.0"
36+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
437

538
def descriptor do
639
# credo:disable-for-next-line
@@ -46,6 +79,34 @@ defmodule Example.ValuePayload do
4679
json_name: "id",
4780
proto3_optional: nil,
4881
__unknown_fields__: []
82+
},
83+
%Google.Protobuf.FieldDescriptorProto{
84+
name: "enum_test",
85+
extendee: nil,
86+
number: 3,
87+
label: :LABEL_OPTIONAL,
88+
type: :TYPE_ENUM,
89+
type_name: ".example.EnumTest",
90+
default_value: nil,
91+
options: nil,
92+
oneof_index: nil,
93+
json_name: "enumTest",
94+
proto3_optional: nil,
95+
__unknown_fields__: []
96+
},
97+
%Google.Protobuf.FieldDescriptorProto{
98+
name: "kind",
99+
extendee: nil,
100+
number: 4,
101+
label: :LABEL_OPTIONAL,
102+
type: :TYPE_STRING,
103+
type_name: nil,
104+
default_value: nil,
105+
options: nil,
106+
oneof_index: nil,
107+
json_name: "kind",
108+
proto3_optional: nil,
109+
__unknown_fields__: []
49110
}
50111
],
51112
nested_type: [],
@@ -62,11 +123,13 @@ defmodule Example.ValuePayload do
62123

63124
field(:value, 1, type: :int32)
64125
field(:id, 2, type: :string, deprecated: false)
126+
field(:enum_test, 3, type: Example.EnumTest, json_name: "enumTest", enum: true)
127+
field(:kind, 4, type: :string)
65128
end
66129

67130
defmodule Example.ExampleState.Data do
68131
@moduledoc false
69-
use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.13.0"
132+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
70133

71134
def descriptor do
72135
# credo:disable-for-next-line
@@ -132,7 +195,7 @@ end
132195

133196
defmodule Example.ExampleState do
134197
@moduledoc false
135-
use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.13.0"
198+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
136199

137200
def descriptor do
138201
# credo:disable-for-next-line
@@ -280,7 +343,7 @@ end
280343

281344
defmodule Example.SumResponse do
282345
@moduledoc false
283-
use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.13.0"
346+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
284347

285348
def descriptor do
286349
# credo:disable-for-next-line
@@ -319,7 +382,7 @@ end
319382

320383
defmodule Example.SomeQueryResponse do
321384
@moduledoc false
322-
use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.13.0"
385+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
323386

324387
def descriptor do
325388
# credo:disable-for-next-line

‎spawn_sdk/spawn_sdk_example/priv/protos/actors/projection_actor.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ service ProjectionActor {
3131

3232
rpc All (.example.ValuePayload) returns (.example.SomeQueryResponse) {
3333
option (spawn.actors.view) = {
34-
query: "SELECT * FROM projection_actor"
34+
query: "SELECT * FROM projection_actor WHERE :enum_test IS NULL"
3535
map_to: "results"
3636
page_size: 40
3737
};

‎spawn_sdk/spawn_sdk_example/priv/protos/example/example.proto

+7
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ package example;
44

55
import "spawn/actors/extensions.proto";
66

7+
enum EnumTest {
8+
ENUM_TEST_UNKNOWN = 0;
9+
ENUM_TEST_TEST = 1;
10+
}
11+
712
message ValuePayload {
813
int32 value = 1;
914
string id = 2 [(spawn.actors.actor_id) = true];
15+
EnumTest enum_test = 3;
16+
string kind = 4;
1017
}
1118

1219
message ExampleState {

‎spawn_statestores/statestores_mariadb/lib/statestores/adapters/mariadb_projection_adapter.ex

+14-17
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ defmodule Statestores.Adapters.MariaDBProjectionAdapter do
207207
{:error, message} ->
208208
{:error, message}
209209

210-
:ok ->
211-
{query, values} = build_params_for_query(params, query)
210+
{:ok, required_params} ->
211+
{query, values} = build_params_for_query(params, query, required_params)
212212

213213
page = opts[:page] || 1
214214
page_size = opts[:page_size] || 10
@@ -221,11 +221,7 @@ defmodule Statestores.Adapters.MariaDBProjectionAdapter do
221221
# If already present, don't modify the query
222222
{query, values}
223223
else
224-
query = """
225-
#{query}
226-
LIMIT ?
227-
OFFSET ?
228-
"""
224+
query = "#{query} LIMIT ? OFFSET ?"
229225

230226
values = values ++ [page_size, offset]
231227

@@ -321,16 +317,17 @@ defmodule Statestores.Adapters.MariaDBProjectionAdapter do
321317
end
322318
end
323319

324-
defp build_params_for_query(params, query) when is_struct(params),
325-
do: Map.from_struct(params) |> build_params_for_query(query)
320+
defp build_params_for_query(params, query, required_params) when is_struct(params),
321+
do: Map.from_struct(params) |> build_params_for_query(query, required_params)
326322

327-
defp build_params_for_query(params, query) when is_map(params) do
328-
Enum.reduce(params, {query, []}, fn {key, value}, {q, acc} ->
329-
if String.contains?(q, ":#{key}") do
330-
{String.replace(q, ":#{key}", "?"), acc ++ [value]}
331-
else
332-
{q, acc}
333-
end
323+
defp build_params_for_query(params, query, required_params) when is_map(params) do
324+
Enum.reduce(required_params, {query, []}, fn param, {q, acc} ->
325+
key = String.to_existing_atom(param)
326+
value = to_proto_decoded(Map.get(params, key))
327+
328+
new_query = String.replace(q, ":#{param}", "?")
329+
330+
{new_query, acc ++ [value]}
334331
end)
335332
end
336333

@@ -346,7 +343,7 @@ defmodule Statestores.Adapters.MariaDBProjectionAdapter do
346343
contains_all_params? = Enum.all?(required_params, fn param -> param in param_keys end)
347344

348345
if contains_all_params? do
349-
:ok
346+
{:ok, required_params}
350347
else
351348
{:error, "Required parameters(s): #{Enum.join(required_params, ", ")}"}
352349
end

‎spawn_statestores/statestores_mariadb/test/mariadb_projection_adapter_test.exs

+32-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ defmodule StatestoresMariaDB.MariaDBProjectionAdapterTest do
2929
created_at: DateTime.utc_now(),
3030
metadata: %{"key" => "value"},
3131
tags: ["elixir", "protobuf"],
32-
attributes: %{"role" => "admin"}
32+
attributes: %{"role" => "admin"},
33+
enum_test: :ENUM_TEST_ACTIVE
3334
}
3435

3536
{:ok, _} = Ecto.Adapters.SQL.query(repo, "DROP TABLE IF EXISTS #{table_name}")
@@ -59,7 +60,7 @@ defmodule StatestoresMariaDB.MariaDBProjectionAdapterTest do
5960
StateManager.projection_query(
6061
TestMessage,
6162
"SELECT age, name FROM test_messages WHERE name = :name",
62-
%{name: "test_user"},
63+
%{name: :test_user},
6364
[]
6465
)
6566

@@ -129,6 +130,35 @@ defmodule StatestoresMariaDB.MariaDBProjectionAdapterTest do
129130
)
130131
end
131132

133+
test "performs query with nil value", ctx do
134+
%{table_name: table_name, data: data} = ctx
135+
136+
:ok = StateManager.projection_upsert(TestMessage, table_name, %{data | document: nil})
137+
138+
{:ok, result} =
139+
StateManager.projection_query(
140+
TestMessage,
141+
"SELECT * FROM test_messages WHERE (:document IS NULL OR document LIKE :document) AND name = :name ORDER BY :document",
142+
%{document: "", name: :test_user},
143+
[]
144+
)
145+
146+
# document is "" because of the serialization for binary
147+
assert [%TestMessage{name: "test_user", document: ""}] = result
148+
149+
:ok = StateManager.projection_upsert(TestMessage, table_name, %{data | document: "test"})
150+
151+
{:ok, result} =
152+
StateManager.projection_query(
153+
TestMessage,
154+
"SELECT * FROM test_messages WHERE (:document IS NULL OR document LIKE :document) AND name = :name ORDER BY :document",
155+
%{document: "test", name: "test_user"},
156+
[]
157+
)
158+
159+
assert [%TestMessage{name: "test_user", document: "\xB5\xEB-"}] = result
160+
end
161+
132162
test "performs a query with more unecessary parameters", ctx do
133163
%{table_name: table_name, data: data} = ctx
134164

‎spawn_statestores/statestores_postgres/lib/statestores/adapters/postgres_projection_adapter.ex

+4-6
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,7 @@ defmodule Statestores.Adapters.PostgresProjectionAdapter do
190190
# If already present, don't modify the query
191191
{query, values}
192192
else
193-
query = """
194-
#{query}
195-
LIMIT $#{length(values) + 1}
196-
OFFSET $#{length(values) + 2}
197-
"""
193+
query = "#{query} LIMIT $#{length(values) + 1} OFFSET $#{length(values) + 2}"
198194

199195
values = values ++ [page_size, offset]
200196

@@ -240,6 +236,8 @@ defmodule Statestores.Adapters.PostgresProjectionAdapter do
240236

241237
defp build_params_for_query(params, query) when is_map(params) do
242238
Enum.reduce(params, {query, []}, fn {key, value}, {q, acc} ->
239+
value = to_proto_decoded(value)
240+
243241
if String.contains?(q, ":#{key}") do
244242
{String.replace(q, ":#{key}", "$#{length(acc) + 1}"), acc ++ [value]}
245243
else
@@ -250,7 +248,7 @@ defmodule Statestores.Adapters.PostgresProjectionAdapter do
250248

251249
defp validate_params(query, params) do
252250
required_params =
253-
Regex.scan(~r/:("\w+"|\w+)/, query)
251+
Regex.scan(~r/(?<!:):("\w+"|\w+)/, query)
254252
|> List.flatten()
255253
|> Enum.filter(&String.starts_with?(&1, ":"))
256254
|> Enum.map(&String.trim_leading(&1, ":"))

‎spawn_statestores/statestores_postgres/test/postgres_projection_test.exs

+32-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ defmodule StatestoresPostgres.PostgresProjectionTest do
2929
created_at: DateTime.utc_now(),
3030
metadata: %{"key" => "value"},
3131
tags: ["elixir", "protobuf"],
32-
attributes: %{"role" => "admin"}
32+
attributes: %{"role" => "admin"},
33+
enum_test: :ENUM_TEST_ACTIVE
3334
}
3435

3536
{:ok, _} = Ecto.Adapters.SQL.query(repo, "DROP TABLE IF EXISTS #{table_name}")
@@ -75,7 +76,7 @@ defmodule StatestoresPostgres.PostgresProjectionTest do
7576
StateManager.projection_query(
7677
TestMessage,
7778
"SELECT age, name FROM test_messages WHERE name = :name",
78-
%{name: "test_user"},
79+
%{name: :test_user},
7980
[]
8081
)
8182

@@ -96,6 +97,35 @@ defmodule StatestoresPostgres.PostgresProjectionTest do
9697
assert [%TestMessage{age: 30}] = result
9798
end
9899

100+
test "performs query with nil value", ctx do
101+
%{table_name: table_name, data: data} = ctx
102+
103+
:ok = StateManager.projection_upsert(TestMessage, table_name, %{data | document: nil})
104+
105+
{:ok, result} =
106+
StateManager.projection_query(
107+
TestMessage,
108+
"SELECT * FROM test_messages WHERE ((:document)::text IS NULL OR convert_from(document, 'UTF8') LIKE :document)",
109+
%{document: ""},
110+
[]
111+
)
112+
113+
# document is "" because of the serialization for binary
114+
assert [%TestMessage{name: "test_user", document: ""}] = result
115+
116+
:ok = StateManager.projection_upsert(TestMessage, table_name, %{data | document: "test"})
117+
118+
{:ok, result} =
119+
StateManager.projection_query(
120+
TestMessage,
121+
"SELECT * FROM test_messages WHERE ((:document)::text IS NULL OR convert_from(document, 'UTF8') LIKE :document)",
122+
%{document: "test"},
123+
[]
124+
)
125+
126+
assert [%TestMessage{name: "test_user", document: "\xB5\xEB-"}] = result
127+
end
128+
99129
test "performs upsert and query operations with pagination", ctx do
100130
%{table_name: table_name, data: data} = ctx
101131

0 commit comments

Comments
 (0)
Please sign in to comment.