-
Notifications
You must be signed in to change notification settings - Fork 3
adding new tplogutils module #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
jonathonmcmurray
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please align all code to style guide at https://github.com/DataIntellectTech/kdbx-modules/blob/main/style.md
(e.g. comment style, naming conventions etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these tests still pass? (I'm pretty sure they won't)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bumping this, have you re-run the tests? I'm fairly certain they will fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bumping this, have you re-run the tests? I'm fairly certain they will fail
di/tplogutils/test.q
Outdated
| result:tplogsutils.repair[testfile]; | ||
|
|
||
| / assert | ||
| nameCorrect:result~goodfile; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still some camelCase in here
di/tplogutils/tplogutils.md
Outdated
| |----------|-------------| | ||
| | `check[logfile;lastmsgtoreplay]` | Returns `logfile` if it should be used as-is per `check` logic, otherwise triggers `repair` and returns `<logfile>.good`. | | ||
| | `repair[logfile]` | Creates `<logfile>.good` and writes any recoverable messages into it. Returns the new filename. | | ||
| | `repairover[logfile;goodlogh;d]` | Internal chunk worker called repeatedly by `repair` (exported for testing/advanced use). | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is no longer exported
di/tplogutils/tplogutils.md
Outdated
| ### `repairover` | ||
|
|
||
| ```q | ||
| tplogutils.repairover[logfile; goodlogh; d] | ||
| ``` | ||
|
|
||
| **Parameters** | ||
|
|
||
| | Parameter | Type | Description | | ||
| |----------:|------|-------------| | ||
| | `logfile` | symbol | Source logfile | | ||
| | `goodlogh` | int | Handle to the output `.good` logfile (opened via `hopen`) | | ||
| | `d` | dict | State dictionary with keys `start` and `size` (byte offset and chunk length) | | ||
|
|
||
| **Notes** | ||
| - `repair` calls `repairover` repeatedly using `over` and a `(start;size)` state dictionary. | ||
| - This is exported for transparency/testing; most users should call `check` or `repair`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer exported
di/tplogutils/tplogutils.md
Outdated
| The module exports: | ||
|
|
||
| ```q | ||
| export:([check;repair;repairover]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outdated
di/tplogutils/init.q
Outdated
| / header to build deserialisable msg | ||
| header: 8 # -8!(`upd;`trade;()); | ||
| / first part of tp update msg | ||
| updmsg: `char$10 # 8 _ -8!(`upd;`trade;()); | ||
| / size of default chunk to read (10MB) | ||
| chunk: 10 * 1024 * 1024; | ||
| / don't let single read exceed this | ||
| maxchunk: 8 * chunk; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| / header to build deserialisable msg | |
| header: 8 # -8!(`upd;`trade;()); | |
| / first part of tp update msg | |
| updmsg: `char$10 # 8 _ -8!(`upd;`trade;()); | |
| / size of default chunk to read (10MB) | |
| chunk: 10 * 1024 * 1024; | |
| / don't let single read exceed this | |
| maxchunk: 8 * chunk; | |
| / header to build deserialisable msg | |
| header:8#-8!(`upd;`trade;()); | |
| / first part of tp update msg | |
| updmsg:`char$10#8_-8!(`upd;`trade;()); | |
| / size of default chunk to read (10MB) | |
| chunk:10*1024*1024; | |
| / don't let single read exceed this | |
| maxchunk:8*chunk; |

Description
Create module containing utils for recovering data from corrupt log files
Potential start point:
TorQ TP Log Utils Documentation
TorQ TP Log Utils Code
KDB-X Modules
Acceptance Criteria
Please create a separate directory for each package and place code, documentation and unit tests within. All packages must have documentation and unit tests to be accepted.Package: TP Log File Recovery · DataIntellectTech kdbx-modules · Discussion #20
Project Owner
Jonathon McMurray