yast2-snapper
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SnapperAgent Class Reference

An interface class between YaST2 and Snapper Agent. More...

#include <SnapperAgent.h>

Inheritance diagram for SnapperAgent:
SCRAgent

Public Member Functions

 SnapperAgent ()
 
virtual ~SnapperAgent ()
 
virtual YCPValue Read (const YCPPath &path, const YCPValue &arg=YCPNull(), const YCPValue &opt=YCPNull())
 
virtual YCPBoolean Write (const YCPPath &path, const YCPValue &arg, const YCPValue &arg2=YCPNull())
 
virtual YCPValue Execute (const YCPPath &path, const YCPValue &arg=YCPNull(), const YCPValue &arg2=YCPNull())
 
virtual YCPList Dir (const YCPPath &path)
 
virtual YCPValue otherCommand (const YCPTerm &term)
 

Private Member Functions

string getValue (const YCPMap &map, const YCPString &key, const string &deflt)
 
int getIntValue (const YCPMap &map, const YCPString &key, const int deflt)
 
YCPList getListValue (const YCPMap &map, const YCPString &key)
 
YCPMap getMapValue (const YCPMap &map, const YCPString &key)
 

Private Attributes

snapper::Snapper * sh
 
bool snapper_initialized
 
string snapper_error
 

Detailed Description

An interface class between YaST2 and Snapper Agent.

Constructor & Destructor Documentation

SnapperAgent::SnapperAgent ( )

Default constructor.

Constructor

References log_do(), log_query(), sh, snapper_error, and snapper_initialized.

SnapperAgent::~SnapperAgent ( )
virtual

Destructor.

Destructor

References sh.

Member Function Documentation

YCPList SnapperAgent::Dir ( const YCPPath path)
virtual

Provides SCR Dir ().

Dir

Implements SCRAgent.

References y2error.

YCPValue SnapperAgent::Execute ( const YCPPath path,
const YCPValue arg = YCPNull(),
const YCPValue arg2 = YCPNull() 
)
virtual

Provides SCR Execute ().

Execute

Execute (.snapper) call: Initialize snapper object

Execute(.snapper.delete_config, $[ "config_name" : name $] -> deletes given configuration

Rollback the list of given files from snapshot num1 to num2 (system by default)

References btrfs_ioctl_call(), getIntValue(), getListValue(), getMapValue(), getValue(), YCPMap::hasKey(), PC, sh, YCPList::size(), snapper_error, snapper_initialized, YCPList::value(), y2debug, y2error, y2milestone, and ycpmap2stringmap().

int SnapperAgent::getIntValue ( const YCPMap map,
const YCPString key,
const int  deflt 
)
private

Search the map for value of given key

Parameters
mapYCP Map to look in
keykey we are looking for
defltthe default value to be returned if key is not found

References YCPMap::value().

Referenced by Execute(), and Read().

YCPList SnapperAgent::getListValue ( const YCPMap map,
const YCPString key 
)
private

Search the map for value of given key; key is string and value is YCPList

References YCPMap::value().

Referenced by Execute().

YCPMap SnapperAgent::getMapValue ( const YCPMap map,
const YCPString key 
)
private

Search the map for value of given key; key is string and value is YCPMap

References YCPMap::value().

Referenced by Execute().

string SnapperAgent::getValue ( const YCPMap map,
const YCPString key,
const string &  deflt 
)
private

search the map for value of given key; both key and value have to be strings when key is not present, default value is returned

References YCPMap::value().

Referenced by Execute().

YCPValue SnapperAgent::otherCommand ( const YCPTerm term)
virtual

Used for mounting the agent.

otherCommand

Reimplemented from SCRAgent.

References YCPTerm::name().

YCPValue SnapperAgent::Read ( const YCPPath path,
const YCPValue arg = YCPNull(),
const YCPValue opt = YCPNull() 
)
virtual

Provides SCR Read ().

Parameters
pathPath that should be read.
argAdditional parameter.

Read

Read (.snapper.is_subvolume, "path/to/dir") -> returns true if given directory is a subvolume

Read (.snapper.error) -> returns last error message

Read (.snapper.path, $[ "num" : num]) -> returns the path to directory with given snapshot

Read(.snapper.snapshots) -> return list of snapshot description maps

Read(.snapper.diff_list) -> show difference between snapnots num1 and num2 as list.

Read(.snapper.diff_index) -> show difference between snapnots num1 and num2 as one-level map: (mapping each file to its changes)

Read(.snapper.diff_tree) -> show difference between snapnots num1 and num2 as tree.

Implements SCRAgent.

References YCPList::add(), YCPMap::add(), getIntValue(), make_ycpmap(), map2ycpmap(), PC, sh, snapper_error, snapper_initialized, Tree::trees, y2debug, and y2error.

YCPBoolean SnapperAgent::Write ( const YCPPath path,
const YCPValue arg,
const YCPValue arg2 = YCPNull() 
)
virtual

Provides SCR Write ().

Write

Implements SCRAgent.

References y2debug.

Member Data Documentation

snapper::Snapper* SnapperAgent::sh
private

Agent private variables and methods

Referenced by Execute(), Read(), SnapperAgent(), and ~SnapperAgent().

string SnapperAgent::snapper_error
private

Referenced by Execute(), Read(), and SnapperAgent().

bool SnapperAgent::snapper_initialized
private

Referenced by Execute(), Read(), and SnapperAgent().


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

Generated on a sunny day for yast2-snapper by doxygen 1.8.5