-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
298 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Nim-RocksDB | ||
# Copyright 2024 Status Research & Development GmbH | ||
# Licensed under either of | ||
# | ||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) | ||
# * GPL license, version 2.0, ([LICENSE-GPLv2](LICENSE-GPLv2) or https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) | ||
# | ||
# at your option. This file may not be copied, modified, or distributed except according to those terms. | ||
|
||
{.used.} | ||
|
||
import unittest2, ../../rocksdb/options/tableopts | ||
|
||
suite "TableOptionsRef Tests": | ||
test "Test createTableOptions": | ||
let tableOpts = createTableOptions() | ||
|
||
check not tableOpts.cPtr.isNil() | ||
|
||
tableOpts.close() | ||
|
||
test "Test defaultTableOptions": | ||
let tableOpts = defaultTableOptions() | ||
|
||
check not tableOpts.cPtr.isNil() | ||
|
||
tableOpts.close() | ||
|
||
test "Test close": | ||
let tableOpts = defaultTableOptions() | ||
|
||
check not tableOpts.isClosed() | ||
tableOpts.close() | ||
check tableOpts.isClosed() | ||
tableOpts.close() | ||
check tableOpts.isClosed() | ||
|
||
test "Test auto close enabled": | ||
# TODO: enable filter policy once creating updated DLL build | ||
let | ||
tableOpts = defaultTableOptions() | ||
cache = cacheCreateLRU(1000, autoClose = true) | ||
# filter = createRibbon(9.9, autoClose = true) | ||
|
||
tableOpts.blockCache = cache | ||
# tableOpts.filterPolicy = filter | ||
|
||
check: | ||
tableOpts.isClosed() == false | ||
cache.isClosed() == false | ||
# filter.isClosed() == true # closed because tableopts takes ownership | ||
|
||
tableOpts.close() | ||
|
||
check: | ||
tableOpts.isClosed() == true | ||
cache.isClosed() == true | ||
# filter.isClosed() == true | ||
|
||
test "Test auto close disabled": | ||
# TODO: enable filter policy once creating updated DLL build | ||
let | ||
tableOpts = defaultTableOptions() | ||
cache = cacheCreateLRU(1000, autoClose = false) | ||
# filter = createRibbon(9.9, autoClose = true) | ||
|
||
tableOpts.blockCache = cache | ||
# tableOpts.filterPolicy = filter | ||
|
||
check: | ||
tableOpts.isClosed() == false | ||
cache.isClosed() == false | ||
# filter.isClosed() == true # closed because tableopts takes ownership | ||
|
||
tableOpts.close() | ||
|
||
check: | ||
tableOpts.isClosed() == true | ||
cache.isClosed() == false | ||
# filter.isClosed() == true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.