Skip to content

Commit

Permalink
readme: fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
DifferentialOrange committed Apr 16, 2024
1 parent 053a322 commit de9a6e3
Showing 1 changed file with 70 additions and 70 deletions.
140 changes: 70 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1848,79 +1848,79 @@ scope, so that you can call them via `net.box`.

1. Add `crud` to dependencies in the project rockspec.

**Note**: it's better to use tagged version than `scm-1`.
Check the latest available [release](https://github.com/tarantool/crud/releases) tag and use it.

```lua
-- <project-name>-scm-1.rockspec
dependencies = {
...
'crud == <the-latest-tag>-1',
...
}
```

2. Create the role that stores your data and depends on `crud-storage`.

```lua
-- app.roles.customers-storage.lua
local cartridge = require('cartridge')

return {
role_name = 'customers-storage',
init = function()
local customers_space = box.schema.space.create('customers', {
format = {
{name = 'id', type = 'unsigned'},
{name = 'bucket_id', type = 'unsigned'},
{name = 'name', type = 'string'},
{name = 'age', type = 'number'},
},
if_not_exists = true,
})
customers_space:create_index('id', {
parts = { {field ='id', is_nullable = false} },
if_not_exists = true,
})
customers_space:create_index('bucket_id', {
parts = { {field ='bucket_id', is_nullable = false} },
if_not_exists = true,
})
customers_space:create_index('age', {
parts = { {field ='age'} },
unique = false,
if_not_exists = true,
})
end,
dependencies = {'cartridge.roles.crud-storage'},
}
```

```lua
-- app.roles.customers-router.lua
local cartridge = require('cartridge')
return {
role_name = 'customers-router',
dependencies = {'cartridge.roles.crud-router'},
**Note**: it's better to use tagged version than `scm-1`.
Check the latest available [release](https://github.com/tarantool/crud/releases) tag and use it.

```lua
-- <project-name>-scm-1.rockspec
dependencies = {
...
'crud == <the-latest-tag>-1',
...
}
```

3. Start the application and create `customers-storage` and
`customers-router` replica sets.
```

4. Don't forget to bootstrap vshard.
2. Create the role that stores your data and depends on `crud-storage`.

5. Configure the statistics with clusterwide configuration
(see `crud.cfg` options in [statistics](#statistics) section):
```yaml
crud:
stats: true
stats_driver: metrics
stats_quantiles: false
stats_quantile_tolerated_error: 0.001
stats_quantile_age_buckets_count: 5
stats_quantile_max_age_time: 180
```
```lua
-- app.roles.customers-storage.lua
local cartridge = require('cartridge')

return {
role_name = 'customers-storage',
init = function()
local customers_space = box.schema.space.create('customers', {
format = {
{name = 'id', type = 'unsigned'},
{name = 'bucket_id', type = 'unsigned'},
{name = 'name', type = 'string'},
{name = 'age', type = 'number'},
},
if_not_exists = true,
})
customers_space:create_index('id', {
parts = { {field ='id', is_nullable = false} },
if_not_exists = true,
})
customers_space:create_index('bucket_id', {
parts = { {field ='bucket_id', is_nullable = false} },
if_not_exists = true,
})
customers_space:create_index('age', {
parts = { {field ='age'} },
unique = false,
if_not_exists = true,
})
end,
dependencies = {'cartridge.roles.crud-storage'},
}
```

```lua
-- app.roles.customers-router.lua
local cartridge = require('cartridge')
return {
role_name = 'customers-router',
dependencies = {'cartridge.roles.crud-router'},
}
```

3. Start the application and create `customers-storage` and
`customers-router` replica sets.

4. Don't forget to bootstrap vshard.

5. Configure the statistics with clusterwide configuration
(see `crud.cfg` options in [statistics](#statistics) section):
```yaml
crud:
stats: true
stats_driver: metrics
stats_quantiles: false
stats_quantile_tolerated_error: 0.001
stats_quantile_age_buckets_count: 5
stats_quantile_max_age_time: 180
```

Now your cluster contains storages that are configured to be used for
CRUD-operations.
Expand Down

0 comments on commit de9a6e3

Please sign in to comment.