Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions di/serverselect/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
10 changes: 10 additions & 0 deletions di/serverselect/deps.q
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/ hard module dependencies and their minimum versions, validated by di.depcheck.
/ di.serverselect has NONE, and the empty manifest is deliberate rather than the file being absent:
/ di.depcheck's finddepsq returns (::) for a module that ships no deps.q, which is indistinguishable
/ from "nobody has decided yet". an explicit empty dict records that the STANDALONE classification in
/ the modularisation plan was checked against the source and holds.
/ verified: init.q and serverselect.q contain no `use` at all. logging is INJECTED via init, not a
/ hard dep - the plan's tier table excludes logging, timer and handler management from the dependency
/ tree by design. integration.q does load kx.log, but it is a harness run directly rather than loaded
/ by init.q, so it is not an edge of this module.
deps:(`$())!();
27 changes: 27 additions & 0 deletions di/serverselect/init.q
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
\l ::serverselect.q

/ logging is an injected dependency: the start-up script that wires the modules together -
/ or the user at run time - must call init with a required `log dependency before using the
/ module. kx.log is intentionally NOT loaded here.
/ note: the injected log dict must already be binary `info`warn`error!{[c;m]} - no adaptation
/ is done here; init fans it out into .z.m.loginfo/.z.m.logwarn/.z.m.logerr, called as
/ .z.m.loginfo[`ctx;"msg"]

/ module version, read from the VERSION file rather than hardcoded, so a release bump touches one
/ plain-text file. read module-relative (`:::` resolves to di/serverselect) and BEFORE the export
/ line, since export:([...]) evaluates each name.
/ NB `version` must STAY in the export: di.depcheck resolves a dependency's version from the export
/ dict (checkdepversion) and classes a missing one as a FAILURE - which makes di.depcheck.init throw
/ for any process loading a module that declares this one as a hard dependency
/ trim, and fail LOUD on a missing/unreadable/empty VERSION, rather than a bare `first read0`: a raw

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERSION file loses its trailing newline (as shown by the \ No newline at end of file in the diff). The read0 call in init.q reads the file and takes first, then trims. If the file has no trailing newline, read0 returns a one-element list with the version string (no trailing \r or space issues). trim first read0 handles this correctly. However, other tooling (e.g. cat, diff, some CI version-check scripts) that expects a newline-terminated file may be broken. This is a minor portability concern but not a code defect in the q module itself.

/ OS error names no module, and read0 strips the line terminator but NOT a trailing \r on a CRLF file
/ or trailing spaces - and di.depcheck compares versions as STRINGS, so a padded value silently fails
/ every dependent module's check. an empty value is worse still: it reads to depcheck as
/ "exports no version", i.e. the exact failure the VERSION file was added to prevent
version:@[{trim first read0 x};`:::VERSION;{'"di.serverselect: VERSION file missing or unreadable"}];
if[0=count version;'"di.serverselect: VERSION file is empty"];

export:([init;
addserverfull;addserverattr;addserver;setserveractive;setserveridactive;getserverstable;addserversfromtable;
getservers;selector;setselector;getserverbytype;gethandlebytype;gethpbytype;getserverids;
removeinactive;getapimeta;version])
360 changes: 360 additions & 0 deletions di/serverselect/integration.q

Large diffs are not rendered by default.

572 changes: 572 additions & 0 deletions di/serverselect/serverselect.md

Large diffs are not rendered by default.

518 changes: 518 additions & 0 deletions di/serverselect/serverselect.q

Large diffs are not rendered by default.

545 changes: 545 additions & 0 deletions di/serverselect/test.csv

Large diffs are not rendered by default.