Learn R Programming

memshare (version 1.1.0)

retrieveMetadata: Function to obtain the metadata of a variable from a shared memory space.

Description

Given a namespace identifier (identifies the shared memory space to register to), this function retrieves the metadata of the stored variable.

NOTE: If no view of the variable was previously retrieved this implicitly retrieves a view and thus has to free'd afterwards!

Usage

retrieveMetadata(namespace, variableName)

Value

A [1:m] named list mapping the variable names to their retrieved metadata. Each list element contains a list of two elements called "type" and length "n"

Arguments

namespace

string of the identifier of the shared memory context.

variableName

[1:m] character vector, names of one ore more than one variable to retrieve the metadata from the shared memory space.

Author

Julian Maerte

Details

In some contexts, querying metadata may create an implicit view. If so, you must call releaseViews for that variable afterwards. See examples.

See Also

releaseVariables, releaseViews, registerVariables

Examples

Run this code
  if (FALSE) {
  # MASTER SESSION:
  # allocate data
  }
  n = 1000
  m = 100

  mat = matrix(rnorm(n * m), n, m) # target matrix

  namespace = "ns_meta"
  memshare::registerVariables(namespace, list(mat=mat))
  if (FALSE) {
  # WORKER SESSION:
  # retrieve metadata of the variable
  }
  res = memshare::retrieveMetadata(namespace, "mat")
  if (FALSE) {
  # res$type = "matrix"
  # res$nrow = 1000
  # res$ncol = 100
  }
  releaseViews(namespace, c("mat"))
  if (FALSE) {
  # MASTER SESSION:
  # free memory
  }
  memshare::releaseVariables(namespace, c("mat"))

Run the code above in your browser using DataLab