|
54 | 54 | // KVStores provides an Update and View method that will allow the caller to |
55 | 55 | // perform atomic read and write transactions on and of the key value stores |
56 | 56 | // offered the KVStoreTx. |
57 | | -type KVStores interface { |
58 | | - // Update opens a database read/write transaction and executes the |
59 | | - // function f with the transaction passed as a parameter. After f exits, |
60 | | - // if f did not error, the transaction is committed. Otherwise, if f did |
61 | | - // error, the transaction is rolled back. If the rollback fails, the |
62 | | - // original error returned by f is still returned. If the commit fails, |
63 | | - // the commit error is returned. |
64 | | - Update(ctx context.Context, f func(ctx context.Context, |
65 | | - tx KVStoreTx) error) error |
66 | | - |
67 | | - // View opens a database read transaction and executes the function f |
68 | | - // with the transaction passed as a parameter. After f exits, the |
69 | | - // transaction is rolled back. If f errors, its error is returned, not a |
70 | | - // rollback error (if any occur). |
71 | | - View(ctx context.Context, f func(ctx context.Context, |
72 | | - tx KVStoreTx) error) error |
73 | | -} |
| 57 | +type KVStores = DBExecutor[KVStoreTx] |
74 | 58 |
|
75 | 59 | // KVStoreTx represents a database transaction that can be used for both read |
76 | 60 | // and writes of the various different key value stores offered for the rule. |
|
0 commit comments