Skip to content

Commit a358f51

Browse files
api: deprecate using space id in len
Part of #255
1 parent be9b566 commit a358f51

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Changed
11+
* Deprecate using space id in `crud.len` (#255).
12+
813
## [0.13.0] - 29-08-22
914

1015
### Added

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,13 +1037,15 @@ local result, err = crud.len(space_name, opts)
10371037

10381038
where:
10391039

1040-
* `space_name` (`string|number`) - name of the space as well
1041-
as numerical id of the space
1040+
* `space_name` (`string`) - name of the space
10421041
* `opts`:
10431042
* `timeout` (`?number`) - `vshard.call` timeout (in seconds)
10441043

10451044
Returns number or nil with error.
10461045

1046+
Using space id instead of space name is also possible, but
1047+
deprecated and will be removed in future releases.
1048+
10471049
**Example:**
10481050

10491051
Using `memtx`:

crud/len.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local checks = require('checks')
22
local errors = require('errors')
33
local vshard = require('vshard')
4+
local log = require('log')
45

56
local utils = require('crud.common.utils')
67
local dev_checks = require('crud.common.dev_checks')
@@ -43,6 +44,11 @@ function len.call(space_name, opts)
4344

4445
opts = opts or {}
4546

47+
if type(space_name) == 'number' then
48+
log.warn('Using space id in crud.len is deprecated and will be removed in future releases.' ..
49+
'Please, use space name instead.')
50+
end
51+
4652
local space = utils.get_space(space_name, vshard.router.routeall())
4753
if space == nil then
4854
return nil, LenError:new("Space %q doesn't exist", space_name)

0 commit comments

Comments
 (0)