Attach a tracking database to the search path.

Share:

Description

Attach a tracking database to the search path at a position other than 1. Variables in the tracking database are made available through a new environment attached at pos on the search path.

Usage

1
2
3
4
5
track.attach(dir, pos = 2, name = NULL,
             create = FALSE, readonly = !create,
             lockEnv = FALSE, verbose = TRUE, auto = NULL,
             dup.ok = FALSE)
track.detach(pos = NULL, name = NULL, detach = TRUE)

Arguments

dir

The directory where the tracking database resides.

pos

The position on the search path to attach the new environment at, or where it is currently attached.

name

The name to use on the search path for the new environment.

create

Should the tracking database be created if it does not exist?

readonly

Logical flag indicating whether the tracking db should be attached in a readonly mode. The global environment (pos=1 in the search path) cannot be tracked in a readonly mode.

lockEnv

Should the environment be locked for a readonly tracking environment? The default is FALSE because locking the environment is irreversible, and it prevents rescanning or caching (because can't delete or add bindings)

verbose

print a message about what directory is being tracked?

detach

If TRUE, the environment attached to the search path (in a position other than 2) will be detached after stopping tracking, IF it was created by track.attach() and if there are no variables left remaining in the environment after removing all tracked variables. If detach="force", the attached environment will be removed even if there are variables remaining in it (though not if it was not created by track.attach).

auto

Should auto-tracking be used? (see track.start).

dup.ok

Is it OK to proceed if the tracking database is already attached on the search path? If dup.ok=FALSE (the default) and the tracking database is already attached, the function issues a warning and does nothing.

Details

track.attach attaches a new environment to the search path at the specified position and variables in the tracking database are made available in it through lazy loading. Using readonly==TRUE ensure that no changes at all are made to the tracking database, and the environment is locked to ensure that variables cannot be created or deleted.

track.detach syncs all variables to files and detaches the environment from the search list if it is empty. See track.stop for conditions under which the environment may not be detached.

Value

NULL

Author(s)

Tony Plate tplate@acm.org

See Also

track.start

Examples

1
2
3
4
5
## Not run: 
track.attach("path/to/tracking-database", pos=2, name="trackdb")
track.detach(pos=2)

## End(Not run)