-
Notifications
You must be signed in to change notification settings - Fork 10
ModelSEED Store
Authenticated storage interface layer
For each function in the METHODS section, $ref
is a ModelSEED::Reference object or a string that produces a valid ModelSEED::Reference object when the constructor for that class is called thusly:
my $ref = ModelSEED::Reference->new( ref => $str );
my $Store = ModelSEED::Store->new(\%);
my $Store = ModelSEED::Store->new(%);
This initializes a Storage interface object. This accepts a hash or hash reference to configuration details:
- auth
-
The authorization to use when accessing data, i.e. the user requesting data / objects. This is required and must be an instance of a class that implements the ModelSEED::Auth interface.
- database
-
A reference to a ModelSEED::Database object. This is the base storage interface that the Store will use. If this is not provided, it will be initialized based on the contents of the ModelSEED::Configuration package.
These functions operate on ModelSEED::MS objects.
my $object = $Store->create("Biochemistry, { name => "Foo" });
This creates a ModelSEED::MS::Biochemistry object and returns it. It does not save the object, however, it does initialize the object with the "parent" pointing back at the $Store
instance. This instance will be used if $object-
save()> is called without another store object. It will also be used if the ModelSEED::MS object needs additional data.
my $bool = $Store->has_object($ref);
Returns true if the object matching the reference exists in the database. Otherwise returns false.
my $obj = $Store->get_object($ref);
Returns an object for the reference if it exists. Otherwise, returns undef.
my $bool = $Store->save_object($ref, $obj, $config);
Saves the object $obj
using the reference $ref
. Returns true if the save was successful, false otherwise. $config
is an optional hash ref. This is passed to the save_data
function ModelSEED::Database as $config
. See the documentation of that function for details.
TODO: Not implemented.
These functions operate on standard perl hashes. Each of these functions have the same calling conventions as the Object Methods functions, but with perl hashes instead of blessed ModelSEED::MS objects.
my $bool = $Store->has_data($ref);
my $data = $Store->get_data($ref);
my $bool = $Store->save_data($ref, $data, $config);
TODO: Not implemented.
These functions manipulate aliases and read/write permissions on aliases. For deatails on usage, see the Alias Functions section of ModelSEED::Database
my \@aliases = $Store->get_aliases($query);
my \@usernames = $Store->alias_viewers($ref);
my $username = $Store->alias_owner($ref);
my $bool = $Store->alias_public($ref);
my $success = $Store->add_viewer( $ref, $username );
my $success = $Store->revmove_viewer( $ref, $username );
my $success = $Store->set_public( $ref, $bool );