Skip to content

Commit 291a052

Browse files
committed
1 parent b108c1e commit 291a052

File tree

11 files changed

+1125
-208
lines changed

11 files changed

+1125
-208
lines changed

README.md

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ Tarantool - https://hub.docker.com/r/tarantool/tarantool
5959
* [tnt_next_upstream](#tnt_next_upstream)
6060
* [tnt_next_upstream_tries](#tnt_next_upstream_tries)
6161
* [tnt_next_upstream_timeout](#tnt_next_upstream_timeout)
62+
* [tnt_pure_result](#tnt_pure_result)
63+
* [tnt_multireturn_skip_count](#tnt_multireturn_skip_count)
64+
* [Format](#format)
65+
* [tnt_insert](#tnt_insert)
66+
* [tnt_replace](#tnt_replace)
67+
* [tnt_delete](#tnt_delete)
68+
* [tnt_select](#tnt_select)
69+
* [tnt_select_limit_max](#tnt_select_limit_max)
70+
* [tnt_allowed_spaces](#tnt_allowed_spaces)
71+
* [tnt_allowed_indexes](#tnt_allowed_indexes)
6272
* [Performance tuning](#performance-tuning)
6373
* [Examples](#examples)
6474
* [Copyright & License](#copyright--license)
@@ -854,6 +864,165 @@ When it is set to 1:
854864

855865
[Back to content](#content)
856866

867+
Format
868+
------
869+
870+
**syntax:** *tnt_{OPT} [ARGS] [FMT]*
871+
Tarantool stores tuples, tuple is a list some elements. Each element is a value
872+
or an object, and each element should have a strong type. Actual it is a MsgPac,
873+
it's like a JSON in binary format.
874+
875+
So we came to the main goal of Format ([FMT]), it exists to make possible
876+
convertation between query string and MsgPack w/o loosing any type
877+
information and its value.
878+
879+
It has a syntax: {QUERY_ARG_NAME}=%{FMT_TYPE}. A good example is:
880+
```
881+
HTTP GET ... /url?space_id=512&value=some+string
882+
it could be matched by using the follwing format 'space_id=%%space_id,value=%s'
883+
```
884+
885+
Here is a full list withs {FMT_TYPE}
886+
```
887+
%n - int64
888+
%f - float
889+
%d - double
890+
%s - string
891+
%b - boolean
892+
%%space_id - space_id
893+
%%idx_id - index_id
894+
%%off - [select](#tnt_select) offset
895+
%%lim - [select](#tnt_select) limit
896+
%%it - [select](#tnt_select) iterator type, allowed values are: eq,req,all,lt,le,ge,gt,all_set,any_set,all_non_set,overlaps,neighbor
897+
```
898+
899+
Examples could be found at:
900+
./t/ngx_confs/tnt_server_test.conf:342
901+
./t/v26_features.py
902+
903+
[Back to content](#content)
904+
905+
906+
tnt_insert
907+
----------
908+
**syntax:** *tnt_insert [SIZE or off] [FMT]*
909+
910+
**default:** *None*
911+
912+
**context:** *location, location if
913+
914+
This directive allows execute an insert query into the tarantool. It's directive
915+
uses [format](#format).
916+
917+
The first argument is a space id.
918+
The second argument is a [format](#format).
919+
920+
[Back to content](#content)
921+
922+
923+
tnt_insert
924+
----------
925+
**syntax:** *tnt_replace [SIZE or off] [FMT]*
926+
927+
**default:** *None*
928+
929+
**context:** *location, location if*
930+
931+
This directive allows execute a replace query into the tarantool. It's directive
932+
uses [format](#format).
933+
934+
The first argument is a space id.
935+
The second argument is a [format](#format).
936+
937+
[Back to content](#content)
938+
939+
940+
tnt_delete
941+
----------
942+
**syntax:** *tnt_delete [SIZE or off] [SIZE or off] [FMT]*
943+
944+
**default:** *None*
945+
946+
**context:** *location, location if*
947+
948+
This directive allows execute a delete query into the tarantool. It's directive
949+
uses [format](#format).
950+
951+
The first argument is a space id.
952+
The second argument is an index id.
953+
The third argument is a [format](#format).
954+
955+
[Back to content](#content)
956+
957+
tnt_select
958+
----------
959+
**syntax:** *tnt_select [SIZE or off] [SIZE or off] [SIZE] [SIZE] [ENUM] [FMT]*
960+
961+
**default:** *None*
962+
963+
**context:** *location, location if*
964+
965+
This directive allows execute a select query into the tarantool. It's directive
966+
uses [format](#format).
967+
968+
The first argument is a space id.
969+
The second argument is an index id.
970+
The third argument is an offset.
971+
The fourth argument is an limit.
972+
The fifth argument is an iterator type, allowed values are:
973+
eq,req,all,lt,le,ge,gt,all_set,any_set,all_non_set,overlaps,neighbor
974+
The six argument is a [format](#format).
975+
976+
[Back to content](#content)
977+
978+
tnt_select_limit_max
979+
--------------------
980+
**syntax:** *tnt_select_limit_max [SIZE]*
981+
982+
**default:** *100*
983+
984+
**context:** *server, location, location if*
985+
986+
This is constraint for avoiding *large selects*. So, It is a maximum of
987+
returning tuples per select operation. If the client reach this limit, then the
988+
client will have an error on its side.
989+
990+
[Back to content](#content)
991+
992+
tnt_allowed_spaces
993+
------------------
994+
**syntax:** *tnt_allowed_spaces [STR]*
995+
996+
**default:** **
997+
998+
**context:** *server, location, location if*
999+
1000+
This is constraint for prohibit an access to some spaces. Actually, directive
1001+
takes array of number(which is representation of Tarantool's space), each
1002+
space in list will be free to access from the client side.
1003+
1004+
Example:
1005+
```
1006+
location {
1007+
...
1008+
tnt_allowed_spaces 512,523;
1009+
tnt_insert off "s=%%space_id,i=%%idx_id";
1010+
}
1011+
```
1012+
1013+
[Back to content](#content)
1014+
1015+
tnt_allowed_indexes
1016+
-------------------
1017+
**syntax:** *tnt_allowed_indexes [STR]*
1018+
1019+
**default:** **
1020+
1021+
**context:** *server, location, location if*
1022+
1023+
This directive has same idea than [tnt_allowed_spaces], but for indexes.
1024+
1025+
[Back to content](#content)
8571026

8581027
## Performance Tuning
8591028
---------------------

src/debug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/*
23
* Redistribution and use in source and binary forms, with or
34
* without modification, are permitted provided that the following

0 commit comments

Comments
 (0)