@@ -1848,79 +1848,79 @@ scope, so that you can call them via `net.box`.
18481848
184918491 . Add ` crud ` to dependencies in the project rockspec.
18501850
1851- ** Note** : it's better to use tagged version than ` scm-1 ` .
1852- Check the latest available [ release] ( https://github.com/tarantool/crud/releases ) tag and use it.
1853-
1854- ``` lua
1855- -- <project-name>-scm-1.rockspec
1856- dependencies = {
1857- ...
1858- ' crud == <the-latest-tag>-1' ,
1859- ...
1860- }
1861- ```
1862-
1863- 2 . Create the role that stores your data and depends on ` crud-storage ` .
1864-
1865- ``` lua
1866- -- app.roles.customers-storage.lua
1867- local cartridge = require (' cartridge' )
1868-
1869- return {
1870- role_name = ' customers-storage' ,
1871- init = function ()
1872- local customers_space = box .schema .space .create (' customers' , {
1873- format = {
1874- {name = ' id' , type = ' unsigned' },
1875- {name = ' bucket_id' , type = ' unsigned' },
1876- {name = ' name' , type = ' string' },
1877- {name = ' age' , type = ' number' },
1878- },
1879- if_not_exists = true ,
1880- })
1881- customers_space :create_index (' id' , {
1882- parts = { {field = ' id' , is_nullable = false } },
1883- if_not_exists = true ,
1884- })
1885- customers_space :create_index (' bucket_id' , {
1886- parts = { {field = ' bucket_id' , is_nullable = false } },
1887- if_not_exists = true ,
1888- })
1889- customers_space :create_index (' age' , {
1890- parts = { {field = ' age' } },
1891- unique = false ,
1892- if_not_exists = true ,
1893- })
1894- end ,
1895- dependencies = {' cartridge.roles.crud-storage' },
1896- }
1897- ```
1898-
1899- ``` lua
1900- -- app.roles.customers-router.lua
1901- local cartridge = require (' cartridge' )
1902- return {
1903- role_name = ' customers-router' ,
1904- dependencies = {' cartridge.roles.crud-router' },
1851+ ** Note** : it's better to use tagged version than ` scm-1 ` .
1852+ Check the latest available [ release] ( https://github.com/tarantool/crud/releases ) tag and use it.
1853+
1854+ ``` lua
1855+ -- <project-name>-scm-1.rockspec
1856+ dependencies = {
1857+ ...
1858+ ' crud == <the-latest-tag>-1' ,
1859+ ...
19051860 }
1906- ```
1907-
1908- 3 . Start the application and create ` customers-storage ` and
1909- ` customers-router ` replica sets.
1861+ ```
19101862
1911- 4 . Don't forget to bootstrap vshard .
1863+ 2. Create the role that stores your data and depends on ` crud-storage ` .
19121864
1913- 5 . Configure the statistics with clusterwide configuration
1914- (see ` crud.cfg ` options in [ statistics] ( #statistics ) section):
1915- ``` yaml
1916- crud :
1917- stats : true
1918- stats_driver : metrics
1919- stats_quantiles : false
1920- stats_quantile_tolerated_error : 0.001
1921- stats_quantile_age_buckets_count : 5
1922- stats_quantile_max_age_time : 180
1923- ` ` `
1865+ ` ` ` lua
1866+ -- app.roles.customers-storage.lua
1867+ local cartridge = require (' cartridge' )
1868+
1869+ return {
1870+ role_name = ' customers-storage' ,
1871+ init = function ()
1872+ local customers_space = box .schema .space .create (' customers' , {
1873+ format = {
1874+ {name = ' id' , type = ' unsigned' },
1875+ {name = ' bucket_id' , type = ' unsigned' },
1876+ {name = ' name' , type = ' string' },
1877+ {name = ' age' , type = ' number' },
1878+ },
1879+ if_not_exists = true ,
1880+ })
1881+ customers_space :create_index (' id' , {
1882+ parts = { {field = ' id' , is_nullable = false } },
1883+ if_not_exists = true ,
1884+ })
1885+ customers_space :create_index (' bucket_id' , {
1886+ parts = { {field = ' bucket_id' , is_nullable = false } },
1887+ if_not_exists = true ,
1888+ })
1889+ customers_space :create_index (' age' , {
1890+ parts = { {field = ' age' } },
1891+ unique = false ,
1892+ if_not_exists = true ,
1893+ })
1894+ end ,
1895+ dependencies = {' cartridge.roles.crud-storage' },
1896+ }
1897+ ```
1898+
1899+ ` ` ` lua
1900+ -- app.roles.customers-router.lua
1901+ local cartridge = require (' cartridge' )
1902+ return {
1903+ role_name = ' customers-router' ,
1904+ dependencies = {' cartridge.roles.crud-router' },
1905+ }
1906+ ```
1907+
1908+ 3. Start the application and create ` customers-storage` and
1909+ ` customers-router` replica sets .
1910+
1911+ 4. Don ' t forget to bootstrap vshard.
1912+
1913+ 5. Configure the statistics with clusterwide configuration
1914+ (see ` crud.cfg` options in [statistics ](# statistics ) section ):
1915+ ` ` ` yaml
1916+ crud :
1917+ stats : true
1918+ stats_driver : metrics
1919+ stats_quantiles : false
1920+ stats_quantile_tolerated_error : 0.001
1921+ stats_quantile_age_buckets_count : 5
1922+ stats_quantile_max_age_time : 180
1923+ ```
19241924
19251925Now your cluster contains storages that are configured to be used for
19261926CRUD - operations .
0 commit comments