fstpackage / synthetic
1
#  syntheticbench - R package for benchmarking of dataset serialization
2
#
3
#  Copyright (C) 2019-present, Mark AJ Klik
4
#
5
#  This file is part of the lazyvec R package.
6
#
7
#  The lazyvec R package is free software: you can redistribute it and/or modify it
8
#  under the terms of the GNU Affero General Public License version 3 as
9
#  published by the Free Software Foundation.
10
#
11
#  The lazyvec R package is distributed in the hope that it will be useful, but
12
#  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
#  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
14
#  for more details.
15
#
16
#  You should have received a copy of the GNU Affero General Public License along
17
#  with the lazyvec R package. If not, see <http://www.gnu.org/licenses/>.
18
#
19
#  You can contact the author at:
20
#  - syntheticbench R package source repository : https://github.com/fstpackage/syntheticbench
21

22

23
#' Define an object of class 'tablestreamer' that defines specific methods for
24
#' serializing of datasets
25
#'
26
#' @param id ID of the table streamer (e.g. 'fst' or 'parguet')
27
#' @param table_writer method for writing with signature f(x, file_name, compress, threads). Parameter
28
#' compression should be a percentage (0.0 to 100.0).
29
#' @param table_reader method for reading with signature f(file_name, threads)
30
#' @param can_select_threads TRUE of FALSE depending on the ability to select the number of threads
31
#' @param variable_compression TRUE of FALSE depending on the ability to select compression
32
#'
33
#' @return a tablestreamer object
34
#' @export
35
table_streamer <- function(id, table_writer, table_reader, can_select_threads, variable_compression) {
36 2
  x <- list(
37 2
    id = id,
38 2
    table_writer = table_writer,
39 2
    table_reader = table_reader,
40 2
    can_select_threads = can_select_threads,
41 2
    variable_compression = variable_compression
42
  )
43

44 2
  class(x) <- "tablestreamer"
45

46 2
  x
47
}

Read our documentation on viewing source code .

Loading