clone_object: Clone objects between DataONE Member Nodes

View source: R/clone_package.R

clone_objectR Documentation

Clone objects between DataONE Member Nodes

Description

Clones objects between DataONE Member Nodes. Note:

  • the dateUploaded, obsoletes, and obsoletedBy fields in the sysmeta will be reset on the cloned object.

  • the limit of the file size is set at a default of 1TB

Usage

clone_object(
  pid,
  from,
  to,
  add_access_to,
  change_auth_node,
  public = FALSE,
  new_pid = TRUE
)

Arguments

pid

(character) Object PID.

from

(D1Client) D1Client to clone objects from. (Objects must be public)

to

(D1Client) D1Client to clone objects to. (Token must be set for this node)

add_access_to

(character, vector) Will give read, write, and changePermission access to all strings in vector. If no additional access is desired, set to NULL. Note: setting this to NULL could lead to situations where it is not possible to read, write, or changePermission on the cloned object.

change_auth_node

(logical) Will change the authoritativeMemberNode in the system metadata to the cloned member node if TRUE. Setting this to TRUE will allow you to edit the package after cloning. Setting this to FALSE syncs the system metadata with the package on the Authoritative Member Node, and will only allow DataONE admins with special privileges to edit the package system metadata.

public

(logical) Optional. Will set public read access. Defaults to FALSE.

new_pid

(logical) Optional. Will give the clone a new PID. Defaults to TRUE.

Value

(character) PID of cloned object. NULL if could not clone.

Examples

## Not run: 
# First set up the member nodes we're cloning between
# (in this example they are the same but could be different)
to <- dataone::D1Client("STAGING", "urn:node:mnTestARCTIC")
from <- dataone::D1Client("STAGING", "urn:node:mnTestARCTIC")

# Choose an object to clone (here a new one is created)
pid <- arcticdatautils::create_dummy_object(to@mn)

# Clone object
cloned_pid <- clone_object(pid = pid,
                          from = from,
                           to = to,
                           add_access_to = arcticdatautils:::get_token_subject(),
                           change_auth_node = TRUE,
                           public = TRUE,
                           new_pid = TRUE)

## End(Not run)

NCEAS/datamgmt documentation built on June 5, 2023, 6:14 a.m.