sbuild::chroot_facet_union Class Reference

Chroot support for filesystem union based sessions. More...

#include <sbuild-chroot-facet-union.h>

Inheritance diagram for sbuild::chroot_facet_union:

Inheritance graph
[legend]
Collaboration diagram for sbuild::chroot_facet_union:

Collaboration graph
[legend]

List of all members.

Public Types

enum  error_code { UNION_TYPE_UNKNOWN, UNION_OVERLAY_ABS, UNION_UNDERLAY_ABS }
 Error codes. More...
typedef custom_error< error_codeerror
 Exception type.
typedef std::tr1::shared_ptr
< chroot_facet_union
ptr
 A shared_ptr to a chroot facet object.
typedef std::tr1::shared_ptr
< const chroot_facet_union
const_ptr
 A shared_ptr to a const chroot facet object.

Public Member Functions

virtual ~chroot_facet_union ()
 The destructor.
virtual chroot_facet::ptr clone () const
 Copy the chroot facet.
std::string const & get_name () const
 Get the name of the chroot facet.
void clone_source_setup (chroot::ptr &clone) const
 Set the defaults in the cloned source chroot.
bool get_union_configured () const
 Get fs union configured state.
virtual std::string const & get_union_type () const
 Get the filesystem union type.
virtual void set_union_type (std::string const &union_type)
 Set the filesystem union type.
virtual std::string const & get_union_mount_options () const
 Get the filesystem union mount options (branch configuration).
virtual void set_union_mount_options (std::string const &union_mount_options)
 Set the filesystem union mount options (branch configuration).
virtual std::string const & get_union_overlay_directory () const
 Get the union overlay directory.
virtual void set_union_overlay_directory (std::string const &directory)
 Set the union overlay directory.
virtual std::string const & get_union_underlay_directory () const
 Get the union underlay directory.
virtual void set_union_underlay_directory (std::string const &directory)
 Set the union underlay directory.
virtual void setup_env (chroot const &chroot, environment &env) const
 Set environment.
virtual chroot::session_flags get_session_flags (chroot const &chroot) const
 Get the session flags of the chroot.
virtual void get_details (chroot const &chroot, format_detail &detail) const
 Get detailed information about the chroot for output.
virtual void get_keyfile (chroot const &chroot, keyfile &keyfile) const
 Copy the chroot properties into a keyfile.
virtual void set_keyfile (chroot &chroot, keyfile const &keyfile, string_list &used_keys)
 Set the chroot properties from a keyfile.

Static Public Member Functions

static ptr create ()
 Create a chroot facet.

Private Member Functions

 chroot_facet_union ()
 The constructor.

Private Attributes

std::string union_type
 filesystem union type.
std::string union_mount_options
 Union mount options (branch configuration).
std::string union_overlay_directory
 Union read-write overlay directory.
std::string union_underlay_directory
 Union read-only underlay directory.


Detailed Description

Chroot support for filesystem union based sessions.

A chroot may offer session support using a filesystem union like aufs or unionfs. A new union type may need to adapt the 10mount or 05union script to properly populate the underlay and mount directory. The overlay directory and union setup is already handled.


Member Enumeration Documentation

Error codes.

Enumerator:
UNION_TYPE_UNKNOWN  Unknown filesystem union type.
UNION_OVERLAY_ABS  Union overlay must have an absolute path.
UNION_UNDERLAY_ABS  Union underlay must have an absolute path.


Member Function Documentation

chroot_facet_union::ptr chroot_facet_union::create (  )  [static]

Create a chroot facet.

Returns:
a shared_ptr to the new chroot facet.

References chroot_facet_union().

Referenced by sbuild::chroot_block_device::chroot_block_device(), sbuild::chroot_directory::chroot_directory(), and sbuild::chroot_loopback::chroot_loopback().

Here is the caller graph for this function:

chroot_facet::ptr chroot_facet_union::clone (  )  const [virtual]

Copy the chroot facet.

This is a virtual copy constructor.

Returns:
a shared_ptr to the new copy of the chroot facet.

Implements sbuild::chroot_facet.

References chroot_facet_union().

std::string const & chroot_facet_union::get_name (  )  const [virtual]

Get the name of the chroot facet.

Returns:
the chroot facet name.

Implements sbuild::chroot_facet.

void chroot_facet_union::clone_source_setup ( chroot::ptr clone  )  const

Set the defaults in the cloned source chroot.

Parameters:
clone the chroot to set up.

References sbuild::chroot::get_facet(), and sbuild::chroot_facet::owner.

bool chroot_facet_union::get_union_configured (  )  const

Get fs union configured state.

Returns:
if fs union is configured

References get_union_type().

Referenced by get_details(), get_keyfile(), get_session_flags(), set_keyfile(), and setup_env().

Here is the caller graph for this function:

std::string const & chroot_facet_union::get_union_type (  )  const [virtual]

Get the filesystem union type.

See also:
set_union_type
Returns:
the union filesytem type.

References union_type.

Referenced by get_details(), get_keyfile(), get_union_configured(), and setup_env().

Here is the caller graph for this function:

void chroot_facet_union::set_union_type ( std::string const &  union_type  )  [virtual]

Set the filesystem union type.

Currently supported values are aufs, unionfs and none.

Parameters:
union_type the filesystem type.

References sbuild::chroot::add_facet(), sbuild::chroot_facet_source_clonable::create(), sbuild::chroot::get_facet(), sbuild::chroot_facet::owner, sbuild::chroot::remove_facet(), union_type, and UNION_TYPE_UNKNOWN.

Referenced by set_keyfile().

Here is the caller graph for this function:

std::string const & chroot_facet_union::get_union_mount_options (  )  const [virtual]

Get the filesystem union mount options (branch configuration).

See also:
set_union_mount_options
Returns:
the filesystem union branch configuration.

References union_mount_options.

Referenced by get_details(), get_keyfile(), and setup_env().

Here is the caller graph for this function:

void chroot_facet_union::set_union_mount_options ( std::string const &  union_mount_options  )  [virtual]

Set the filesystem union mount options (branch configuration).

Normally a temporary directory is used as the writeable branch, which is removed on session end. This allows the building of a complex union which can merge multiple branches. The string has to be constructed as expected by the filesystem union type and is directly used as the mount '-o' option string.

Parameters:
union_mount_options a union filesystem-specific branch description

Referenced by set_keyfile().

Here is the caller graph for this function:

std::string const & chroot_facet_union::get_union_overlay_directory (  )  const [virtual]

Get the union overlay directory.

Returns:
the writeable overlay directory.

References union_overlay_directory.

Referenced by get_details(), get_keyfile(), and setup_env().

Here is the caller graph for this function:

void chroot_facet_union::set_union_overlay_directory ( std::string const &  directory  )  [virtual]

Set the union overlay directory.

Parameters:
directory the writeable overlay directory.

References sbuild::is_absname(), UNION_OVERLAY_ABS, and union_overlay_directory.

Referenced by set_keyfile().

Here is the caller graph for this function:

std::string const & chroot_facet_union::get_union_underlay_directory (  )  const [virtual]

Get the union underlay directory.

Returns:
the writeable underlay directory.

References union_underlay_directory.

Referenced by get_details(), get_keyfile(), and setup_env().

Here is the caller graph for this function:

void chroot_facet_union::set_union_underlay_directory ( std::string const &  directory  )  [virtual]

Set the union underlay directory.

Parameters:
directory the writeable underlay directory.

References sbuild::is_absname(), UNION_UNDERLAY_ABS, and union_underlay_directory.

Referenced by set_keyfile().

Here is the caller graph for this function:

void chroot_facet_union::setup_env ( chroot const &  chroot,
environment env 
) const [virtual]

Set environment.

Set the environment that the setup scripts will see during execution.

Parameters:
chroot the chroot to use.
env the environment to set.

Implements sbuild::chroot_facet.

References sbuild::environment::add(), get_union_configured(), get_union_mount_options(), get_union_overlay_directory(), get_union_type(), and get_union_underlay_directory().

sbuild::chroot::session_flags chroot_facet_union::get_session_flags ( chroot const &  chroot  )  const [virtual]

Get the session flags of the chroot.

These determine how the Session controlling the chroot will operate.

Parameters:
chroot the chroot to use.
Returns:
the session flags.

Implements sbuild::chroot_facet.

References sbuild::chroot::get_facet(), get_union_configured(), sbuild::chroot::SESSION_NOFLAGS, and sbuild::chroot::SESSION_PURGE.

void chroot_facet_union::get_details ( chroot const &  chroot,
format_detail detail 
) const [virtual]

void chroot_facet_union::get_keyfile ( chroot const &  chroot,
keyfile keyfile 
) const [virtual]

Copy the chroot properties into a keyfile.

The keyfile group with the name of the chroot will be set; if it already exists, it will be removed before setting it.

Parameters:
chroot the chroot to use.
keyfile the keyfile to use.

Implements sbuild::chroot_facet.

References sbuild::chroot::get_name(), get_union_configured(), get_union_mount_options(), get_union_overlay_directory(), get_union_type(), get_union_underlay_directory(), and sbuild::basic_keyfile< K, P >::set_object_value().

void chroot_facet_union::set_keyfile ( chroot chroot,
keyfile const &  keyfile,
string_list used_keys 
) [virtual]

Set the chroot properties from a keyfile.

The chroot name must have previously been set, so that the correct keyfile group may be determined.

Parameters:
chroot the chroot to use.
keyfile the keyfile to get the properties from.
used_keys a list of the keys used will be set.

Implements sbuild::chroot_facet.

References sbuild::chroot::get_facet(), sbuild::chroot::get_name(), sbuild::basic_keyfile< K, P >::get_object_value(), get_union_configured(), sbuild::keyfile_base::PRIORITY_OPTIONAL, sbuild::keyfile_base::PRIORITY_REQUIRED, set_union_mount_options(), set_union_overlay_directory(), set_union_type(), and set_union_underlay_directory().


The documentation for this class was generated from the following files:

Generated on Tue Jan 18 21:49:01 2011 for sbuild by  doxygen 1.5.6