openmmtools.storage.storageinterface.StorageInterfaceDirVar

class openmmtools.storage.storageinterface.StorageInterfaceDirVar(name, storage_interface, predecessor=None)[source]

Storage Interface Directory/Variable (SIDV) class is a versatile, dynamic class which gives structure to the variables stored on disk by representing them as methods of the StorageInterface and other instances of itself. New variables and folders are created by simply trying to use them as properties of the class itself. The data stored and read is not kept in memory, the SIDV passes the data onto the writer or tells the fetcher to read from disk on demand.

The API only shows the protected and internal methods of the SIDV class which cannot be used for variable and directory names.

This class is NEVER meant to be used as its own object and should never be invoked by itself. The class is currently housed outside of the main StorageInterface class to show the API to users.

Examples are located in the StorageInterface main class

TODO: Move this class as an internal class of StorageInterface (NOT a subclass)

Attributes:
bound_target

Fetch the handler for the bound target, either the directory or the variable so that the user can directly manipulate the handler has they need.

directory

Checks if the object can be used as a directory for accepting other SIDV objects.

name

Pointer to this directory or variable as it will appear on the disk

path

Generate the complete path of this instance by getting its predecessor’s path + itself.

predecessor

Give the parent SIDV to construct the full path on the way down

variable

Checks if the object can be used in the .write, .append, .read functions can be used.

Methods

add_metadata(name, data)

Attempt to add metadata to the variable/directory.

append(data)

Write data to a variable whose size changes every time this function is called.

read()

Read the variable and its data from disk.

write(data[, at_index])

Write data to a variable which cannot be appended to or write data at a specific index of an appendable variable.

__init__(name, storage_interface, predecessor=None)[source]
Parameters:
namestring

Specify the name of the storage variable on the disk. Full path is determined from the predecessor chain

storage_interfaceStorageInterface instance

Acting interface which is handling top level IO operations on the file itself The storage driver which handles all the commands is derived from this interface

predecessorStorageInterfaceDirVar

Directory-like SIDV above this instance

Methods

__init__(name, storage_interface[, predecessor])

Parameters:

add_metadata(name, data)

Attempt to add metadata to the variable/directory.

append(data)

Write data to a variable whose size changes every time this function is called.

read()

Read the variable and its data from disk.

write(data[, at_index])

Write data to a variable which cannot be appended to or write data at a specific index of an appendable variable.

Attributes

bound_target

Fetch the handler for the bound target, either the directory or the variable so that the user can directly manipulate the handler has they need.

directory

Checks if the object can be used as a directory for accepting other SIDV objects.

name

Pointer to this directory or variable as it will appear on the disk

path

Generate the complete path of this instance by getting its predecessor's path + itself.

predecessor

Give the parent SIDV to construct the full path on the way down

variable

Checks if the object can be used in the .write, .append, .read functions can be used.