Skip to content

Commit

Permalink
api: deprecate using space id in len
Browse files Browse the repository at this point in the history
Part of #255
  • Loading branch information
DifferentialOrange committed Aug 31, 2022
1 parent 933c742 commit 1920cca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed
* Deprecate using space id in `crud.len` (#255).

## [0.13.0] - 29-08-22

### Added
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1037,13 +1037,15 @@ local result, err = crud.len(space_name, opts)

where:

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

Returns number or nil with error.

Using space id instead of space name is also possible, but
deprecated and will be removed in future releases.

**Example:**

Using `memtx`:
Expand Down
6 changes: 6 additions & 0 deletions crud/len.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local checks = require('checks')
local errors = require('errors')
local vshard = require('vshard')
local log = require('log')

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

opts = opts or {}

if type(space_name) == 'number' then
log.warn('Using space id in crud.len is deprecated and will be removed in future releases.' ..
'Please, use space name instead.')
end

local space = utils.get_space(space_name, vshard.router.routeall())
if space == nil then
return nil, LenError:new("Space %q doesn't exist", space_name)
Expand Down

0 comments on commit 1920cca

Please sign in to comment.