Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
rust-rocksdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
rust-rocksdb
Commits
ec72a896
Commit
ec72a896
authored
Nov 06, 2017
by
UncP
Committed by
zhangjinpeng1987
Nov 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update rate_limiter api (#153)
parent
c4e5096c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
rocksdb_options.rs
src/rocksdb_options.rs
+2
-2
test_rate_limiter.rs
tests/test_rate_limiter.rs
+2
-2
No files found.
src/rocksdb_options.rs
View file @
ec72a896
...
...
@@ -168,7 +168,7 @@ impl RateLimiter {
RateLimiter
{
inner
:
limiter
}
}
pub
fn
set_bytes_per_second
(
&
mut
self
,
bytes_per_sec
:
i64
)
{
pub
fn
set_bytes_per_second
(
&
self
,
bytes_per_sec
:
i64
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_ratelimiter_set_bytes_per_second
(
self
.inner
,
bytes_per_sec
);
}
...
...
@@ -178,7 +178,7 @@ impl RateLimiter {
unsafe
{
crocksdb_ffi
::
crocksdb_ratelimiter_get_singleburst_bytes
(
self
.inner
)
}
}
pub
fn
request
(
&
mut
self
,
bytes
:
i64
,
pri
:
c_uchar
)
{
pub
fn
request
(
&
self
,
bytes
:
i64
,
pri
:
c_uchar
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_ratelimiter_request
(
self
.inner
,
bytes
,
pri
);
}
...
...
tests/test_rate_limiter.rs
View file @
ec72a896
...
...
@@ -16,7 +16,7 @@ use rocksdb::RateLimiter;
#[test]
fn
test_rate_limiter
()
{
let
mut
rate_limiter
=
RateLimiter
::
new
(
10
*
1024
*
1024
,
100
*
1000
,
10
);
let
rate_limiter
=
RateLimiter
::
new
(
10
*
1024
*
1024
,
100
*
1000
,
10
);
assert_eq!
(
rate_limiter
.get_singleburst_bytes
(),
1
*
1024
*
1024
);
rate_limiter
.set_bytes_per_second
(
20
*
1024
*
1024
);
...
...
@@ -41,7 +41,7 @@ fn test_rate_limiter() {
#[test]
fn
test_rate_limiter_sendable
()
{
let
mut
rate_limiter
=
RateLimiter
::
new
(
10
*
1024
*
1024
,
100
*
1000
,
10
);
let
rate_limiter
=
RateLimiter
::
new
(
10
*
1024
*
1024
,
100
*
1000
,
10
);
let
handle
=
thread
::
spawn
(
move
||
{
rate_limiter
.request
(
1024
,
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment