Skip to content

Commit

Permalink
Update wording, minor cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-grunder committed Aug 6, 2024
1 parent d728131 commit 4a8a265
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions docs/standalone.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# standalone API documentation

This document describes using `libvalkey` in standalone (non-cluster) mode, including an overview of the synchronous and asynchronous APIs. It is not intended as a complete reference. For that it's always best to refer to the source code.

## Table of Contents

- [Synchronous API](#synchronous-api)
- [Connecting](#connecting)
- [Connection options](#connection-options)
Expand All @@ -8,9 +14,9 @@
- [Pipelining](#pipelining)
- [Errors](#errors)
- [Thread safety](#thread-safety)
- [Other mechanisms](#other-mechanisms)
- [Maxbuffer](#maxbuffer)
- [Maxelements](#maxelements)
- [Reader configuration](#reader-configuration)
- [Input buffer size](#maxinput-buffer-size)
- [Maximum array elements](#maximum-array-elements)
- [RESP3 Push Replies](#resp3-push-replies)
- [Allocator injection](#allocator-injection)
- [Asynchronous API](#asynchronous-api)
Expand Down Expand Up @@ -203,19 +209,19 @@ As previously mentioned, when there is a communication error libvalkey will retu
Libvalkey context structs are not thread safe. You should not attempt to share them between threads, unless you really know what you're doing.
### Other mechanisms
### Reader configuration
Libvalkey has a few other mechanisms worth detailing in the README.
Libvalkey contexts have a few more mechanisms you can customize to your needs.
#### Maxbuffer
#### Maximum input buffer size
libvalkey uses a buffer to hold incoming bytes, which is typically restored to the configurable max buffer size (`16KB`) when it is empty. To avoid continually reallocating this buffer you can set the value higher, or to zero which means "no limit".
```c
context->reader->maxbuf = 0;
```

#### Maxelements
#### Maximum array elements

By default, libvalkey will refuse to parse array-like replies if they have more than 2^32-1 or 4,294,967,295 elements. This value can be set to any arbitrary 64-bit value or zero which just means "no limit".

Expand All @@ -229,7 +235,7 @@ The `RESP` protocol introduced out-of-band "push" replies in the third version o

If your application needs to perform specific actions on PUSH messages you can install your own handler which will be called as they are received. It is also possible to set the push handler to NULL, in which case the messages will be delivered "in-band". This can be useful for example in a blocking subscribe loop.

**Note**: You may also specify a push handler in the `valkeyOptions` struct and set it on initialization .
**NOTE**: You may also specify a push handler in the `valkeyOptions` struct and set it on initialization .

#### Synchronous context

Expand Down Expand Up @@ -279,6 +285,8 @@ They can also be reset to the glibc or musl defaults
valkeyResetAllocators();
```

**NOTE**: The `vk_calloc` function handles the case where `nmemb` * `size` would overflow a `size_t` and returns `NULL` in that case.

## Asynchronous API

Libvalkey also has an asynchronous API which supports a great many different event libraries. See the [examples](examples) directory for specific information about each individual event library.
Expand Down

0 comments on commit 4a8a265

Please sign in to comment.