Commit Graph

17 Commits

Author SHA1 Message Date
Wez Furlong e3fdcaa628 cargo clippy --fix 2025-04-09 10:26:07 -07:00
Wez Furlong 62672a2fbd deps: upgrade mlua to 0.10
This is a reasonably significant upgrade, as it allows for
async functions to be Send, which could unlock more efficiencies
in our overall scheduling.

This commit is just the basic changes required to get the updated
mlua version compiling, it doesn't change anything else.
2024-12-07 09:17:54 -07:00
Dirkjan Ochtman 18db31f204 Manage all external dependencies at the workspace level 2024-11-13 13:50:27 -07:00
Wez Furlong f99f852747 mod-sqlite: add :close method 2024-07-09 16:50:48 -07:00
Wez Furlong c524ef5d11 deps: upgrade mlua from 0.8 -> 0.9
I've been holding off on this for a while, because I remember
this upgrade being a bit of a PITA for wezterm.  Since then
there is a `derive(FromLua)` that makes the transition much
easier.

This upgrade makes it potentially a bit easier/nicer/cheaper for
memoize, because it is now possible to retrieve references to userdata
values (rather than always cloning them), but I haven't done anything
special to take advantage of that in this commit.
2024-06-28 17:28:42 -07:00
Wez Furlong 085c587851 deps: update sqlite 2024-02-06 13:29:36 -07:00
Wez Furlong e6973c2a04 slim down some deps
This helps to remove "false" deps on things like openssl; now that
is linked in only to those components that need it (eg: things that
use unbound for dnssec, or the smtp client for DANE).

This makes the binaries other than kumod (which still has max deps)
a few MB smaller; not a massive win, but nice all the same.
2023-12-22 10:24:30 -07:00
Wez Furlong e9ec19fd23 fix an issue where msg:[sg]et_meta would not round-trip nil values 2023-12-13 14:21:12 -07:00
Wez Furlong d843579d1e refactor: control some dep versions via workspace Cargo.toml
This makes it easier to upgrade the version holistically later.
2023-08-17 10:49:25 -07:00
Wez Furlong d2cdd0ca0a tsa: create schema to recall events and actions
This is using an in-memory sqlite db to keep track of events
and actions that we trigger.

In the future, the db will be persisted at a configurable location
on local storage.

Next step is to add endpoints for both config overrides and suspensions
that can be consumed by the mta nodes.
2023-08-02 16:42:33 -07:00
Wez Furlong 0c70ab2c52 improve error message when converting lua -> rust types
refs: https://github.com/KumoCorp/kumomta/issues/56
2023-06-14 20:14:14 -07:00
Wez Furlong b6633b95dc sqlite: bind params as strings, fixup empty rows case
We were binding as blobs which we could read back as strings,
but which didn't match string inputs! Very confusing!
Always bind as strings.

For the empty rows case: don't return the affected row count
unless the query has 0 columns, as we otherwise cannot distinguish
between no matching results and a single column with 0.
2023-03-22 17:01:07 -07:00
Wez Furlong c2cb5b798b fix centos7 build, adjust docker to use /opt/kumomta
Revert building static/bundled sqlite, as the logic deep in sqlite3-src
makes no attempt to deal with this mess on centos7:

  = note: /opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /__w/kumomta/kumomta/target/release/deps/libsqlite3_src-b3c44e6f34aac065.rlib(sqlite3.o):(.data.rel.aSyscall+0xb0): undefined reference to `fcntl64'
          collect2: error: ld returned 1 exit status

(I don't blame it!)

Deal with that in the docker image by simply installing sqlite
in the docker image.

And since I'm touching the docker stuff, adjust its install
path and layout to match that of the rpm and deb packages.
2023-03-14 14:14:37 -07:00
Wez Furlong b287db1944 ensure that we statically link sqlite
This avoids picking up a dynamic dep on libsqlite3.so
when we build the docker image.
2023-03-13 19:41:33 -07:00
Wez Furlong 8e0583b6cf adopt tokio::task::Builder to label tasks 2023-03-06 09:38:18 -07:00
Wez Furlong eaaddbb6b6 add redis client 2023-03-05 09:57:03 -07:00
Wez Furlong 2cf3d2387c add sqlite data access
A bit of a big commit because I wanted sqlite queries to run
async and there isn't a sane way to tell in mlua whether a
given context is safe to yield for an await, which meant making
every case where we call into lua be fully async.

This adds a simple but powerful binding to sqlite that performs
its IO in a blocking tokio thread pool, and returns the results
back to lua.

There is no implicit caching of queries, and no implicit connection
pooling.
2023-03-04 18:07:31 -07:00