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

View source: R/retrieveMetadata.R

retrieveMetadataR Documentation

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)

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.

Details

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

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"

Author(s)

Julian Maerte

See Also

releaseVariables, releaseViews, registerVariables

Examples

  ## Not run: 
  # MASTER SESSION:
  # allocate data
  
## End(Not run)
  n = 1000
  m = 100

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

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

memshare documentation built on Dec. 5, 2025, 9:07 a.m.