aboutsummaryrefslogtreecommitdiffstats
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
...
* | util.prosodyctl.check: Update conditions for s2s cert checksKim Alvefur2023-11-131-3/+3
| | | | | | | | | | | | The 'anonymous_login' setting is deprecated and prosodyctl check config will tell you to change it to 'authentication = "internal_hashed"', so we shouldn't need to care about here anymore.
* | util.prosodyctl.check: Simplify conditions for c2s and s2s cert checksKim Alvefur2023-11-131-3/+3
| | | | | | | | This code is hard to follow and in need of some refactoring.
* | util.uuid: Add UUIDv7Kim Alvefur2021-08-151-0/+17
| | | | | | | | | | | | | | | | | | Allows sorting by id as a substitute for sorting by timestamp since it has the timestamp in the encoded in the first part, and only things that happen extremely close together may get out of order by such a sort, which might not matter. From draft-ietf-uuidrev-rfc4122bis formerly draft-peabody-dispatch-new-uuid-format
* | util.prosodyctl.check: Try to clarify check for misplaced k=v in ↵Kim Alvefur2023-11-111-2/+2
| | | | | | | | modules_enabled (thanks aab and Menel)
* | util.startup: Attempt to bring some order to startup/shutdown with util.fsmMatthew Wild2023-11-071-10/+41
| |
* | util.prosodyctl.check: Print DANE TLSA records for certificatesKim Alvefur2023-11-031-0/+10
| | | | | | | | Not the prosodyctl check dane I wanted to make but a start.
* | util.prosodyctl.check: Wrap each check in a functionKim Alvefur2023-11-031-13/+29
| | | | | | | | | | | | | | One small refactor but one huge step in the right direction Mostly because adding another check would make the line checking for a valid check exceed the column limit.
* | util.datamanager: Clean up list index files on purge (i.e. user deletion)Kim Alvefur2023-11-021-0/+2
| |
* | Merge 0.12->trunkKim Alvefur2023-08-301-1/+1
|\|
| * util.prosodyctl.check: Correct modern replacement for 'disallow_s2s'0.12.4Kim Alvefur2023-08-271-1/+1
| | | | | | | | | | The code would have suggested adding to modules_enabled instead of modules_disabled
| * util.array: Fix new() library functionKim Alvefur2023-07-221-1/+3
| | | | | | | | Backport of ffe4adbd2af9 since new was added in the 0.12 branch
* | util.array: Fix new() library functionKim Alvefur2023-07-221-1/+3
| |
* | util.sql: Remove unused String() and Integer() functionsKim Alvefur2023-07-221-4/+0
| | | | | | | | According to MattJ, leftovers from an earlier vision for util.sql
* | util.sqlite3: Clean up unused variablesKim Alvefur2023-07-221-42/+6
| | | | | | | | | | Many leftovers from the earlier version of util.sql this was based on and cleanup applied there since then.
* | util.datamanager: Always reset index after list shiftKim Alvefur2023-07-221-39/+4
| | | | | | | | | | | | Shifting the index does not work reliably yet, better to rebuild it from scratch. Since there is minimal parsing involved in that, it should be more efficient anyway.
* | util.datamanager: Add way to close indexed list storeKim Alvefur2023-07-211-1/+9
| |
* | util.datamanager: Close file handle when done using itKim Alvefur2023-07-211-0/+1
| | | | | | | | | | It gets closed eventually but at high load they could potentially lead to reaching FD limits faster.
* | util.datamanager: Disable blockwise removalKim Alvefur2023-07-211-1/+4
| | | | | | | | In desperate need of tests
* | util.datamanager: Disable block alignmentKim Alvefur2023-07-211-0/+2
| | | | | | | | | | Until we have more test coverage. Somehow the index becomes incorrect after inserting padding, unclear why.
* | Merge 0.12->trunkKim Alvefur2023-07-171-0/+5
|\|
| * util.prosodyctl.check: Hint about the 'external_addresses' config optionKim Alvefur2023-07-171-0/+5
| |
* | Merge 0.12->trunkKim Alvefur2023-07-171-41/+82
|\|
| * util.prosodyctl.check: Validate format of module list optionsKim Alvefur2023-07-171-0/+28
| | | | | | | | Should detect things like misplaced settings inside modules_enabled
| * util.prosodyctl.check: Get some config options via minimal moduleapi #896Kim Alvefur2023-07-171-41/+54
| | | | | | | | | | | | The module API has certain coercion features that are useful. Fixes traceback reported in #1812 and other duplicates
* | util.human.io: Fix stray 'stty' error by only querying width of real ttysKim Alvefur2023-07-161-0/+4
| | | | | | | | | | This adds a dependency on a binary and *nix-specific module but then stty is probably *nix-specific anyway so maybe that's fine.
* | util.human.io: Fix pattern in parse_duration() to cover all used lettersKim Alvefur2023-07-161-2/+2
| | | | | | | | | | Notably 'h' was missing. Awkwardly, 'hour' would result in 'ho' which was missing from table.
* | util.datamanager: Pad list writes to avoid crossing block boundariesKim Alvefur2023-06-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | By padding items so that they do not cross block boundaries, it becomes eaiser to delete whole blocks with fallocate() without cutting items in half, improving efficiency of such operations. Since list stores are used for message archives, where the most common deletion operation would be of the oldest entires, at the top of the file. With this, all blocks that contain items to be removed could be deleted without needing to read, delete and write out the whole file.
* | util.datamanager: Efficiently remove whole blocks to shift listsKim Alvefur2023-07-121-0/+40
| | | | | | | | | | Using the new pposix.remove_blocks() it should be very performant to delete whole sections of a file, given a supporting file system.
* | util.datamanager: Add way to efficiently remove first items in a listKim Alvefur2023-07-121-0/+92
| | | | | | | | | | Copying data without parsing it should be more performant than parsing it serializing back.
* | util.datamanager: Fix indexing first item if not at the very startKim Alvefur2023-07-101-2/+2
| | | | | | | | | | | | | | | | If the first item does not start at position 0 then the index function produces a phantom first entry covering position zero until where the real first item starts. When using the index, this would make it either appear as the first item was missing or cause an off-by-one issue with remaining items.
* | util.datamanager: Reduce log level of left over debug messages to debug ↵Kim Alvefur2023-07-121-2/+2
| | | | | | | | | | | | (thanks Trung) These were mostly 'warn' to make them stand out from the debug noise
* | util.datamanager: Fix missing separator in log lineKim Alvefur2023-07-101-1/+1
| |
* | util.cache: Pass cache itself to eviction callbackKim Alvefur2023-06-301-2/+2
| | | | | | | | | | | | | | Simplifies access to the cache without moving code around a lot given the currently common pattern of local some_cache = cache.new(size, function(k,v) end)
* | util.cache: Keep eviction candidate if callback resized to make roomKim Alvefur2023-06-301-3/+8
| | | | | | | | | | Previously either the old or the new values would be rejected, even if the cache was resized to allow more items.
* | renamening: Fix newly added imports to use the new namespaceKim Alvefur2023-06-183-4/+4
| |
* | util.jsonschema: Remove wrapper functionKim Alvefur2023-06-171-7/+0
| | | | | | | | This was to silence some Teal warning that seems to have gone away.
* | util.jsonschema: Silence Teal warnings about utf8 libraryKim Alvefur2023-06-171-2/+2
| | | | | | | | | | | | Teal worries that we redefine the global. Also that the fallback was missing type information.
* | util.jsonschema: Silence Teal warnings about counting items in tablesKim Alvefur2023-06-171-4/+4
| | | | | | | | | | Teal thinks that these are key-value maps which are always of length zero, but that is not the case.
* | util.argparse: Add support for repeatable parametersKim Alvefur2022-01-051-2/+11
| | | | | | | | These are gathered into arrays
* | util.sqlite3: Don't cache prepared statements for one-off queriesKim Alvefur2023-06-101-10/+8
| | | | | | | | | | | | | | | | | | The :execute method is mainly used for one-off queries such as creating tables and indices. There is no need to cache this prepared statement, as those queries are only done on startup. Further, prepared statements can't be reused without being reset, so this was likely broken anyway.
* | util.sqlite3: Deduplicate query methodsKim Alvefur2023-06-101-34/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There were 3 very similar methods: - :execute() - :execute_query() - :execute_update() The first one returns the prepared statement and is mainly used internally in the library for CREATE statements. The later two only really differ in how the results are returned. Those two are one main method and one small one that only picks out the iterator.
* | util.sqlite3: Fix indentationKim Alvefur2023-06-101-5/+7
| |
* | Merge 0.12->trunkKim Alvefur2023-06-101-0/+2
|\|
| * util.array: Expose new() on module tableKim Alvefur2023-06-101-0/+2
| | | | | | | | | | | | For consistency with other utils. Consistency is good.
* | util.datamanager: Halve size of list indexKim Alvefur2021-05-141-11/+15
| | | | | | | | | | Instead of storing (start, length) tuples, store the offset to the end of items and derive length using the previous entry.
* | util.datamanager: Add O(1) list indexing with on-disk indexKim Alvefur2021-05-111-0/+191
| | | | | | | | | | | | | | | | | | | | | | | | Index file contains offsets and lengths of each item() which allows seeking directly to each item and reading it without parsing the entire file. Also allows tricks like binary search, assuming items have some defined order. We take advantage of the 1-based indexing in tables to store a magic header in the 0 position, so that table index 1 ends up at file index 1.
* | util.serialization: Add a "pretty" presetKim Alvefur2023-06-091-0/+4
| | | | | | | | | | This is the config I want 90% of the time when just showing data in the console or so.
* | util.http: Implement parser for RFC 7239 Forwarded headerKim Alvefur2023-06-031-0/+33
| | | | | | | | | | | | | | | | Standardized and structured replacement for the X-Forwarded-For, X-Forwarded-Proto set of headers. Notably, this allows per-hop protocol information, unlike X-Forwarded-Proto which is always a single value for some reason.
* | util.set: Remove duplicate __freeze metamethodKim Alvefur2023-06-011-9/+0
| | | | | | | | Backs out 895a82c5d8d4 beacuse __freeze already added in a96a2fbcc6c0
* | Merge 0.12->trunkKim Alvefur2023-05-311-4/+5
|\|