Hexagon
Hexagon
DDeno
Created by Hexagon on 6/26/2023 in #help
Purging Kv keys
I have a logger which write logs to a kv store with dual keys, something like
kv.set(["logs_by_time", Date.now()], logObject)
kv.set(["logs_by_process", "current-process-id", Date.now()],logObject)
kv.set(["logs_by_time", Date.now()], logObject)
kv.set(["logs_by_process", "current-process-id", Date.now()],logObject)
So far all is well.. But a problem pups up when i want to purge all logs before a specific start time, i could loop through all processes, deleting using this selector:
{
prefix: ["logs_by_process", currentProcessId],
end: ["logs_by_process", currentProcessId, startTime],
}
{
prefix: ["logs_by_process", currentProcessId],
end: ["logs_by_process", currentProcessId, startTime],
}
But as end-users can add/delete processes over time, i cannot be sure i known which processes exist in history, so i would need to use a wildcard, like:
{
prefix: ["logs_by_process", "*"],
end: ["logs_by_process", "*", startTime],
}
{
prefix: ["logs_by_process", "*"],
end: ["logs_by_process", "*", startTime],
}
Any idéas on how to make this happen efficiently, without looping over all possible keys? Actual, non-functioning code: https://github.com/Hexagon/pup/blob/afd8d3f3b292c8e317d21dea9c7d0509f1e40d59/lib/core/logger.ts#L236
6 replies
DDeno
Created by Hexagon on 3/16/2023 in #help
IPC solution for a process manager
👋 I'm at day 7 of working on Pup (https://github.com/hexagon/pup) - a universal process manager run by Deno. Next step towards 1.0.0 is to allow one instance of pup to restart a process of another instance. Something like pup - Boots up the process ecosystem defined in pup.json of the current directory then pup --restart --id task-1 - Restart process named task-1 in the main process, print results, and exit. What are the options on this in Deno, while keeping everything nice and secure. Is there a stable IPC solution ready for Deno yet? Security considerations? The first that comes to mind is to use unix sockets, with maybe a common secret key defined in pup.json, that way, even if a evil process have access to the unix socket, it won't be able to command processes without the secret key. This would make the actual file permissions (read) to pup.json control who can control the process manager. Of cours normal unix socket permissions would be handled in some way. Good or bad? Cross platform considerations? Is the secret totally useless?
14 replies
DDeno
Created by Hexagon on 2/3/2023 in #help
Two questions on documentation
RTFM in 3... 2... 🙂 Question 1: How do i hide documentation for specific exports, i do not want to document exports of dependencies, like https://deno.land/x/entsoe_api_client@0.5.1/deps.ts . I tried /** @ignore */ to no avail Question 2: Is it possible to get some sort of generic description for a file, like: https://deno.land/x/entsoe_api_client@0.5.1/mod.ts , similar to the docs that appear if i click on a function, like https://deno.land/x/entsoe_api_client@0.5.1/mod.ts?s=Query
20 replies