Skip to content

Commit

Permalink
Merge pull request #330 from sshanks-kx/refactor
Browse files Browse the repository at this point in the history
refactor
  • Loading branch information
vcalescu authored Oct 4, 2024
2 parents 3f85375 + 96a29b7 commit b6e9ede
Show file tree
Hide file tree
Showing 34 changed files with 1,012 additions and 1,156 deletions.
2 changes: 1 addition & 1 deletion docs/basics/cmdline.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ Timeout in seconds for client queries, i.e. maximum time a client call will exec
`-u 1` disables

- system commands from a remote (signals `'access`), including exit via `"\\"`
- access to files outside the current directory for any handle context ([`.z.w`](../ref/dotz.md#zw-handle)) other than 0
- access to files outside the current directory for any handle context ([`.z.w`](../ref/dotz.md#zw-handle)) other than 0. Segmented database partitions using directories outside the current working directory can be enabled using the method described [here](../database/segment.md#using-symlinks).
- hopen on a fifo (since 4.1t 2021.10.13, 4.0 2023.08.11)
- hopen of a file (since 4.1t 2021.10.13, 4.0 2023.08.11)
- the [`exit`](../ref/exit.md) keyword (since 4.1t 2021.07.12)
Expand Down
436 changes: 404 additions & 32 deletions docs/basics/funsql.md

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions docs/basics/internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,15 +466,23 @@ where `x` is a list of socket handles, returns a table with columns
Since v4.0 2020.06.01.

```q
q)h:hopen 5000
q)-38!h
p| "q"
f| "t"
z| 0b
n| 0
m| 0
q){([]h)!-38!h:.z.H}[]
h| p f z n m
-| ---------
8| q u 0 0 0
9| q t 0 0 0
```

:fontawesome-solid-book:
[`.z.H` active sockets](../ref/dotz.md#zh-active-sockets)
:fontawesome-solid-hand-point-right:
[`.z.H` active sockets](../ref/dotz.md#zh-active-sockets), [`.z.W` handles](../ref/dotz.md#zw-handles), [`.z.w` handle](../ref/dotz.md#zw-handle)

## `-120!x` (memory domain)

```syntax
Expand Down
16 changes: 7 additions & 9 deletions docs/basics/ipc.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Sync messages can also be sent without a pre-existing connection using [one-shot
The maximum number of connections is defined by the system limit for protocol (operating system configurable). Prior to 4.1t 2023.09.15, the limit was hardcoded to 1022.
After the limit is reached, you see the error `'conn` on the server process. All successfully opened connections remain open.

!!! note "It is important to use [`hclose`](../ref/hopen.md#hclose) once finished with any connection. Connections do not automatically close if their associated handle is deleted."

## Closing connections

Client or server connections can be closed using [`hclose`](../ref/hopen.md#hclose).
Expand Down Expand Up @@ -154,22 +156,18 @@ q)h(`add;2;3) / execute the 'add' function as defined on the server, pas

#### One-shot message

A sync message can also be sent on a short-lived connection.
A sync message can also be sent on a short-lived connection (called a [one-shot](../ref/hopen.md#one-shot-request)).
When sending multiple messages, this is less efficient than [using a pre-existing connection](#sync-request-get) due to the effort of repeated connections/disconnections.

A useful shorthand for a one-shot get is:

```q
q)`::5001 "1+1"
q)`::5001 "1+1"
2
```

Since V4.0 2020.03.09, a one-shot query can be run with a timeout (in milliseconds), as in the second example below:

which is equivalent to
```q
q)`::4567"2+2"
4
q)`::[(`::4567;100);"1+1"]
q)`:localhost:5001 "1+1"
2
```

Expand Down Expand Up @@ -217,7 +215,7 @@ You may consider increasing the size of TCP send/receive buffers on your system
Messages can be queued for sending to a remote process through using async messaging.
kdb+ queues the serialized message in user space, later writing it to the socket as the remote end drains the message queue.

You can see how many messages are queued on a handle and their sizes as a dictionary using the command variable [`.z.W`](../ref/dotz.md#zw-handles "handles").
You can see the queue size using [-38!](internal.md#-38x-socket-table), or [`.z.W`](../ref/dotz.md#zw-handles "handles") for all handles.

Sometimes it is useful to send a large number of aysnc messages, but then to block until they have all been sent.
This can be achieved through using async flush – invoked as `neg[h][]` or `neg[h](::)`.
Expand Down
Loading

0 comments on commit b6e9ede

Please sign in to comment.