Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: storr.tiledb
Title: A TileDB Storage Driver for Storr
Version: 0.0.39
Version: 0.0.40
Date: 2026-05-21
Authors@R:
person("Constantinos", "Giachalis", , "xx@github.com", role = c("aut", "cre"))
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# storr.tiledb 0.0.39
# storr.tiledb 0.0.40

* Initial GitHub release.
10 changes: 10 additions & 0 deletions R/StorrTimeTravel.R
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@ StorrTimeTravel <- R6::R6Class(
sort(private$DRIVER$list_hashes())
},

#' @description List unused hashes stored in the storr.
#'
#'
#' @return A sorted character vector with unused hashes.
#'
list_unused_hashes = function() {

sort(private$DRIVER$list_unused_hashes())
},

#' @description List all namespaces in the storr.
#'
#'
Expand Down
10 changes: 10 additions & 0 deletions R/TileDBStorr.R
Original file line number Diff line number Diff line change
Expand Up @@ -1862,6 +1862,16 @@ TileDBStorr <- R6::R6Class(
sort(private$DRIVER$list_hashes())
},

#' @description List unused hashes stored in the storr.
#'
#'
#' @return A sorted character vector with unused hashes.
#'
list_unused_hashes = function() {

sort(private$DRIVER$list_unused_hashes())
},

#' @description List all namespaces in the storr.
#'
#'
Expand Down
1 change: 1 addition & 0 deletions R/storr_tiledb.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
#'
#' - **`list()`** - List all keys in a namespace
#' - **`list_hashes()`** - List all stored object hashes
#' - **`list_unused_hashes()`** - List all stored object unused hashes
#' - **`list_namespaces()`** - List all namespaces
#'
#' **Storage Management**
Expand Down
1 change: 1 addition & 0 deletions R/storr_timetravel.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#'
#' - **`list()`** - List all keys in a namespace
#' - **`list_hashes()`** - List all stored object hashes
#' - **`list_unused_hashes()`** - List all stored object unused hashes
#' - **`list_namespaces()`** - List all namespaces
#'
#' **Storage Management**
Expand Down
16 changes: 16 additions & 0 deletions man/StorrTimeTravel.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions man/TileDBStorr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/storr_tiledb.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/storr_timetravel.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 40 additions & 1 deletion tests/testthat/test-StorrTimeTravel.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,46 @@ test_that("'get'/'mget' with time-travel", {

})

test_that("'list_unsed_hashes' with time-travel", {

uri <- file.path(withr::local_tempdir(), "test-storr")
sto <- storr_tiledb(uri, init = TRUE, default_namespace = "ns1")

t0 <- Sys.time()
sto$mset(c("a", "b"), 1:2)
t1 <- Sys.time()
del_hash <- sto$get_hash("a")
sto$del("a")
sto$set("b", 3, namespace = "ns2")
t2 <- Sys.time()

sto$gc()
t3 <- Sys.time()

hashes <- sto$list_hashes()

# Open at t0 ---
stott <- storr_timetravel(uri, timestamp = t0, default_namespace = "ns1")

# Expect nothing at t0
expect_equal(stott$list_hashes(), character())

# Open at t1
stott$timestamp <- t1
expect_equal(stott$mget(c("a", "b")), list(1, 2))
expect_length(stott$list_hashes(), 2)

# Open at t2
stott$timestamp <- t2
expect_equal(stott$list_unused_hashes(), del_hash)
expect_length(stott$list_hashes(), 3)

stott$timestamp <- t3
expect_equal(stott$list_unused_hashes(), character(0))
expect_length(stott$list_hashes(), 2)

})

test_that("'get_keymeta'/'mget_keymeta' and friends with time-travel", {

uri <- file.path(withr::local_tempdir(), "test-storr")
Expand Down Expand Up @@ -246,7 +286,6 @@ test_that("'export_tdb' with time-travel", {
expect_warning(stott$export_tdb(uri_dest = uri2), class = "warning",
"Nothing to export for the selected key-namespace.")


# Open at t1
stott$timestamp <- t1
expect_no_error(stott$export_tdb(uri_dest = uri2))
Expand Down
20 changes: 20 additions & 0 deletions tests/testthat/test-storr_tiledb.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,23 @@ test_that("cache global option", {
expect_equal(numhash(sto$envir_metadata), 2)

})


test_that("'list_unused_hashes'", {

uri <- file.path(withr::local_tempdir(), "test-driver")
sto <- storr_tiledb(uri, init = TRUE)

sto$mset(letters[1:3], 1:3)

sto$del("a")

expect_length(sto$list_hashes(), 3)
expect_equal(sto$list_unused_hashes(), "9dc695ac953ca975b83c673f7144cffb")

sto$gc()
expect_length(sto$list_hashes(), 2)

expect_equal(sto$list_unused_hashes(), character(0))

})
Loading