Ivor Williams > VCS-Lite-Repository-0.09 > VCS::Lite::Store

Download:
VCS-Lite-Repository-0.09.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source   Latest Release: VCS-Lite-Repository-0.11

NAME ^

VCS::Lite::Store - Base class for repository persistence stores

SYNOPSIS ^

  package mystore;
  use base qw/VCS::Lite::Store/;
  ...

  my $newstore = mystore->new( user => 'fred', password => 'bloggs'...);
  my $rep = VCS::Lite::Repository->new( path => 'src/myfile.c',
                                        store => $newstore );

DESCRIPTION ^

The VCS::Lite::Repository version control system offers a choice of back end storage mechanism. It is architected such that new back end stores can be written, that will plug in with the existing classes. The store is used as an object persistence mechanism for VCS::Lite::Repository and VCS::Lite::Element objects. The store can also potentially act as a proxy, giving access to repositories that live on another machine, or even in another type of version control system.

The store object is passed to the element and repository constructors VCS::Lite::Repository->new and VCS::Lite::Element->new as the optional parameter store. Note that this parameter can take a class name instead, see "In Situ Stores" below.

METHOD CALLS ^

new

The constructor takes a varying list of option value pairs. The exact list depends on which store class used. These may, for example, include a DBI connect string, username and password. Here are the ones inplemented in the base class for use by the YAML and Storable classes:

retrieve

  $store->retrieve( $path);

This is the call which is made by the VCS::Lite::Element and VCS::Lite::Repository constructors, to retrieve an existing object from the store. Return undef if the object does not exist.

create

  $store->create( $proto);

This call writes an object to the store. If this object already exists, it is overwritten. $proto is a prototype object, with a path and a few other members populated, already blessed into the right class. The call returns a persisted, fully populated object.

retrieve_or_create

  $store->retrieve_or_create( $proto);

Perform a retrieve based on the path attribute of the prototype, or create a persisted object if it does not already exist in the store.

save

  $store->save($obj);

Apply updates to persist the object. This method is virtual, i.e. the subclass is expected to provide the save method.

load

  $store->load($obj);

Load an object from a persistance store. This method is virtual, i.e. the subclass is expected to provide the load method.

store_path

This method is internal to flat file stores. It is used to convert between the path of a file or directory being version controlled, and the path for the corresponding store. store_path returns a list of two scalars, which are a directory and a file. There is an optional parameter of the file type used by VCS::Lite::Element::Binary; this is passed over to repos_name.

repos_name

Passed an element name or the empty string, this is a virtual method that turns this into the filename used to persist the element or repository.

There is also an optional file type parameter, which overrides the default one for the type of store.

In Situ Stores ^

As an alternative to an object as a store, VCS::Lite::Repository and VCS::Lite::Element can be passed a class name. These use a more limited type of store that lives in situ inside the directory tree of the files being versioned. The class name can be shortened by missing off the VCS::Lite::Store:: from the front.

The store lives under 'hidden' directories called .VCSLite or in the case of VMS _VCSLITE (dots are not permitted in the directory name syntax).

syntax highlighting: