Skip to content

Commit

Permalink
Merge pull request #1733 from genesiscommunitysuccess/GSF-6867
Browse files Browse the repository at this point in the history
Adding clarifications regarding behavior of _FROM/_TO ranges
  • Loading branch information
wjhendry authored Jul 10, 2024
2 parents 2a3186d + ebedf34 commit be8e42e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/01_getting-started/09_server_training/03_ssdt-day3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ If timeout is not set for a given requestReply definition, the default value wil

You can specify ranges from the client of the requestReply server by postfixing the request parameter names with _FROM and _TO.

The example below shows a client building a GenesisSet request based upon the requestReplies defined from the previous example. This example stipulates a price range between 1,000 and 10,000. Leaving out FROM will define a top-end range, leaving out TO will define a bottom-end range.
The example below shows a client building a GenesisSet request based upon the requestReplies defined from the previous example. This example stipulates a price range between 1,000 and 10,000. Both ends need to be provided.


```kotlin
Expand All @@ -364,7 +364,7 @@ The example below shows a client building a GenesisSet request based upon the re

sendRequest(request) // details of sending request hidden for brevity
```
Note that ranges that are not based on indexes perform more slowly than those that are.
Note that ranges must be based on indexes. Post-fixing the request parameter targeting records without an index, will process the request ignoring the range.


### Custom Request Servers
Expand Down
10 changes: 8 additions & 2 deletions docs/03_server/03_request-server/03_advanced.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ If timeout is not set for a given requestReply definition, the default value wil
## Ranges

You can specify ranges from the client of the requestReply server by post-fixing the request parameter names with _FROM and _TO. The example below shows a client building a GenesisSet request based upon
the requestReplies defined from previous example. This example stipulates a price range between 1,000 and 10,000. Leaving out FROM will define a top-end range, leaving out TO will define a bottom-end range.
the requestReplies defined from previous example. This example stipulates a price range between 1,000 and 10,000.
Ranges can be used with numeric values and Date/Datetime values.
You must specify both _FROM and _TO to get a result. Specifying only one end will result in an error.


```kotlin
Expand All @@ -96,7 +98,11 @@ the requestReplies defined from previous example. This example stipulates a pric

reply(request)
```
Note that ranges that are not based on indexes perform more slowly than those that are.

:::note
1. Ranges must be based on indexes. Post-fixing the request parameter targeting records without an index, will process the request ignoring the range.
2. It is not possible to get a range using unix timestamps when targeting a GenesisFlake field. The epoch time (millis) is in the most significant bits of the raw GenesisFlake value, so you need to shift once right to decode into epoch millis (GenesisFlake to Timestamp) and once left to do the same thing for encoding (Timestamp to GenesisFlake). This is described in opur page on [timestamps](/database/fields-tables-views/timestamps/).
:::

## Permissioning

Expand Down

0 comments on commit be8e42e

Please sign in to comment.