Skip to content

refactor(core): Eliminate XxxProvider enums#830

Merged
gtema merged 1 commit into
mainfrom
eliminate-prov-enums
Jun 23, 2026
Merged

refactor(core): Eliminate XxxProvider enums#830
gtema merged 1 commit into
mainfrom
eliminate-prov-enums

Conversation

@gtema

@gtema gtema commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Replace 13 XxxProvider enums (with Service/Mock variants and delegation
impls) with Box trait objects in Provider. Consolidate
13 mock.rs files into single mocks.rs with all mock! definitions.

This removes ~3300 lines of repetitive enum, delegation, and per-module
mock boilerplate. Provider fields are now Box, builder
accepts impl XxxApi for mock injection, and getters return trait refs.

This also slightly improves the compilation time (roughly 60%)

Signed-off-by: Artem Goncharov artem.goncharov@gmail.com

Replace 13 XxxProvider enums (with Service/Mock variants and delegation
impls) with Box<dyn XxxApi> trait objects in Provider. Consolidate
13 mock.rs files into single mocks.rs with all mock! definitions.

This removes ~3300 lines of repetitive enum, delegation, and per-module
mock boilerplate. Provider fields are now Box<dyn XxxApi>, builder
accepts impl XxxApi for mock injection, and getters return trait refs.

This also slightly improves the compilation time (roughly 60%)

Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
@github-actions

Copy link
Copy Markdown

🦢 Load Test Results

Goose Attack Report

Plan Overview

Action Started Stopped Elapsed Users
Increasing 26-06-23 12:20:33 26-06-23 12:20:35 00:00:02 0 → 4
Maintaining 26-06-23 12:20:35 26-06-23 12:21:05 00:00:30 4
Decreasing 26-06-23 12:21:05 26-06-23 12:21:05 00:00:00 0 ← 4

Request Metrics

Method Name # Requests # Fails Average (ms) Min (ms) Max (ms) RPS Failures/s
GET 7484 0 15.56 10 31 249.47 0.00
Aggregated 7484 0 15.56 10 31 249.47 0.00

Response Time Metrics

Method Name 50%ile (ms) 60%ile (ms) 70%ile (ms) 80%ile (ms) 90%ile (ms) 95%ile (ms) 99%ile (ms) 100%ile (ms)
GET 13 16 19 20 21 21 23 31
Aggregated 13 16 19 20 21 21 23 31

Status Code Metrics

Method Name Status Codes
GET 7,484 [200]
Aggregated 7,484 [200]

Transaction Metrics

Transaction # Times Run # Fails Average (ms) Min (ms) Max (ms) RPS Failures/s
ListUsers
0.0 0 0 0.00 0 0 0.00 0.00
0.1 4581 0 12.63 10 22 152.70 0.00
ValidateToken
1.0 0 0 0.00 0 0 0.00 0.00
1.1 2903 0 20.23 17 31 96.77 0.00
Aggregated 7484 0 15.56 10 31 249.47 0.00

Scenario Metrics

Transaction # Users # Times Run Average (ms) Min (ms) Max (ms) Scenarios/s Iterations
ListUsers 2 4579 12.63 10 22 152.63 2289.50
ValidateToken 2 2901 20.23 17 31 96.70 1450.50
Aggregated 4 7480 15.58 10 31 249.33 3740.00

View full report

@github-actions

Copy link
Copy Markdown

🐰 Bencher Report

Brancheliminate-prov-enums
Testbedubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
nanoseconds (ns)
(Result Δ%)
Upper Boundary
nanoseconds (ns)
(Limit %)
Command_Serde/apply/remove📈 view plot
🚷 view threshold
130,500.00 ns
(-9.70%)Baseline: 144,521.31 ns
460,662.50 ns
(28.33%)
Command_Serde/apply/set📈 view plot
🚷 view threshold
147,520.00 ns
(+11.83%)Baseline: 131,916.55 ns
290,548.75 ns
(50.77%)
Command_Serde/pack/delete📈 view plot
🚷 view threshold
119.64 ns
(-1.06%)Baseline: 120.92 ns
142.71 ns
(83.83%)
Command_Serde/pack/delete_index📈 view plot
🚷 view threshold
108.91 ns
(-3.10%)Baseline: 112.39 ns
133.51 ns
(81.57%)
Command_Serde/pack/set📈 view plot
🚷 view threshold
201.79 ns
(+3.09%)Baseline: 195.74 ns
235.62 ns
(85.64%)
Command_Serde/pack/set_index📈 view plot
🚷 view threshold
109.11 ns
(-3.02%)Baseline: 112.51 ns
133.25 ns
(81.89%)
Command_Serde/unpack/delete📈 view plot
🚷 view threshold
193.20 ns
(+1.20%)Baseline: 190.91 ns
236.09 ns
(81.83%)
Command_Serde/unpack/delete_index📈 view plot
🚷 view threshold
155.72 ns
(-5.86%)Baseline: 165.42 ns
204.88 ns
(76.01%)
Command_Serde/unpack/set📈 view plot
🚷 view threshold
248.17 ns
(+0.45%)Baseline: 247.06 ns
291.97 ns
(85.00%)
Command_Serde/unpack/set_index📈 view plot
🚷 view threshold
160.33 ns
(-2.04%)Baseline: 163.66 ns
201.87 ns
(79.42%)
Payload_encryption/pack/inner📈 view plot
🚷 view threshold
65.05 ns
(+4.07%)Baseline: 62.51 ns
76.52 ns
(85.02%)
Payload_encryption/pack/remove_cmd📈 view plot
🚷 view threshold
122.34 ns
(+1.69%)Baseline: 120.31 ns
151.42 ns
(80.79%)
Payload_encryption/pack/set_cmd📈 view plot
🚷 view threshold
196.89 ns
(-11.52%)Baseline: 222.52 ns
282.73 ns
(69.64%)
Payload_encryption/unpack/inner📈 view plot
🚷 view threshold
168.92 ns
(+2.29%)Baseline: 165.13 ns
193.78 ns
(87.17%)
Payload_encryption/unpack/remove_cmd📈 view plot
🚷 view threshold
214.32 ns
(+6.94%)Baseline: 200.42 ns
248.58 ns
(86.22%)
Payload_encryption/unpack/set_cmd📈 view plot
🚷 view threshold
280.31 ns
(+8.77%)Baseline: 257.72 ns
308.04 ns
(91.00%)
Raft_1Node_Latency/prefix/1node📈 view plot
🚷 view threshold
2,400,500.00 ns
(-35.18%)Baseline: 3,703,493.28 ns
6,918,962.94 ns
(34.69%)
Raft_1Node_Latency/read/1node📈 view plot
🚷 view threshold
588.54 ns
(+2.30%)Baseline: 575.28 ns
671.44 ns
(87.65%)
Raft_1Node_Latency/remove/1node📈 view plot
🚷 view threshold
391,210.00 ns
(+2.97%)Baseline: 379,929.22 ns
976,128.36 ns
(40.08%)
Raft_1Node_Latency/write/1node📈 view plot
🚷 view threshold
401,480.00 ns
(+9.06%)Baseline: 368,132.81 ns
780,104.83 ns
(51.46%)
build_snapshot/default📈 view plot
🚷 view threshold
86,249.00 ns
(-7.12%)Baseline: 92,858.03 ns
153,114.67 ns
(56.33%)
fernet token/project📈 view plot
🚷 view threshold
1,430.60 ns
(+1.07%)Baseline: 1,415.44 ns
1,617.04 ns
(88.47%)
get_data_keyspace📈 view plot
🚷 view threshold
0.33 ns
(+1.97%)Baseline: 0.32 ns
0.38 ns
(86.15%)
get_db📈 view plot
🚷 view threshold
0.33 ns
(+1.85%)Baseline: 0.32 ns
0.38 ns
(86.01%)
get_fernet_token_timestamp/project📈 view plot
🚷 view threshold
144.72 ns
(-0.13%)Baseline: 144.91 ns
170.04 ns
(85.11%)
get_keyspace📈 view plot
🚷 view threshold
4.36 ns
(-11.42%)Baseline: 4.92 ns
9.48 ns
(45.95%)
🐰 View full continuous benchmarking report in Bencher

@gtema gtema merged commit 8a3e081 into main Jun 23, 2026
30 checks passed
@gtema gtema deleted the eliminate-prov-enums branch June 23, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant