Disk ARchive 2.8.0
Full featured and portable backup and archiving tool
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
libdar::entrepot_local Class Reference

#include <entrepot_local.hpp>

+ Inheritance diagram for libdar::entrepot_local:
+ Collaboration diagram for libdar::entrepot_local:

Public Member Functions

 entrepot_local (const std::string &user, const std::string &group, bool x_furtive_mode)
 constructor More...
 
 entrepot_local (const entrepot_local &ref)
 
 entrepot_local (entrepot_local &&ref) noexcept
 
entrepot_localoperator= (const entrepot_local &ref)
 
entrepot_localoperator= (entrepot_local &&ref) noexcept
 
virtual std::string get_url () const override
 full path of current directory + anything necessary to provide URL formated information More...
 
virtual void read_dir_reset () const override
 
virtual bool read_dir_next (std::string &filename) const override
 read the next filename of the current directory More...
 
virtual void read_dir_reset_dirinfo () const override
 routines to read existing files with dir information More...
 
virtual bool read_dir_next_dirinfo (std::string &filename, inode_type &tp) const override
 alternative to the method read_dir_next, should be implemented also More...
 
virtual void create_dir (const std::string &dirname, U_I permission) override
 create a new directory in the current directory More...
 
virtual entrepotclone () const override
 done this way for homogeneity with open/inherited_open More...
 
- Public Member Functions inherited from libdar::entrepot
 entrepot ()
 constructor
 
 entrepot (const entrepot &ref)=default
 copy constructor
 
 entrepot (entrepot &&ref) noexcept=default
 move constructor
 
entrepotoperator= (const entrepot &ref)=default
 assignment operator
 
entrepotoperator= (entrepot &&ref) noexcept=default
 move operator
 
virtual ~entrepot ()=default
 destructor
 
bool operator== (const entrepot &ref) const
 says whether two entrepot objects points to the same location More...
 
virtual void set_location (const path &chemin)
 defines the directory where to proceed to future open() – this is a "chdir" semantics More...
 
virtual void set_root (const path &p_root)
 defines the root to use if set_location is given a relative path More...
 
virtual path get_full_path () const
 returns the full path of location More...
 
virtual std::string get_url () const =0
 full path of current directory + anything necessary to provide URL formated information More...
 
void set_user_ownership (const std::string &x_user)
 set default ownership for files to be created thanks to the open() or create_dir() methods More...
 
void set_group_ownership (const std::string &x_group)
 
virtual const pathget_location () const
 
virtual const pathget_root () const
 retreives relative to root path the current location points to More...
 
const std::string & get_user_ownership () const
 retrieves the given root location More...
 
const std::string & get_group_ownership () const
 
fichier_globalopen (const std::shared_ptr< user_interaction > &dialog, const std::string &filename, gf_mode mode, bool force_permission, U_I permission, bool fail_if_exists, bool erase, hash_algo algo, bool provide_a_plain_file=true) const
 defines the way to open a file and return a "class fichier_global" object as last argument upon success More...
 
virtual void change_user_interaction (const std::shared_ptr< user_interaction > &new_dialog)
 change user_interaction if the implementation recorded it (at construction time for example) More...
 
virtual std::shared_ptr< user_interactionget_current_user_interaction () const
 get the current user_interaction if the implementation reocrded it at construction time (may be nullptr if not) More...
 
virtual void read_dir_reset () const =0
 routines to read existing files in the current directory (see set_location() / set_root() methods) More...
 
virtual bool read_dir_next (std::string &filename) const =0
 read the next filename of the current directory More...
 
virtual void read_dir_reset_dirinfo () const =0
 routines to read existing files with dir information More...
 
virtual bool read_dir_next_dirinfo (std::string &filename, inode_type &tp) const =0
 alternative to the method read_dir_next, should be implemented also More...
 
virtual void create_dir (const std::string &dirname, U_I permission)=0
 create a new directory in the current directory More...
 
void unlink (const std::string &filename) const
 remove the target file from the entrepot More...
 
virtual entrepotclone () const =0
 done this way for homogeneity with open/inherited_open More...
 

Protected Member Functions

virtual fichier_globalinherited_open (const std::shared_ptr< user_interaction > &dialog, const std::string &filename, gf_mode mode, bool force_permission, U_I permission, bool fail_if_exists, bool erase) const override
 
virtual void inherited_unlink (const std::string &filename) const override
 
virtual void read_dir_flush () const override
 ends the read_dir_next, (no more entry available) More...
 
virtual fichier_globalinherited_open (const std::shared_ptr< user_interaction > &dialog, const std::string &filename, gf_mode mode, bool force_permission, U_I permission, bool fail_if_exists, bool erase) const =0
 
virtual void inherited_unlink (const std::string &filename) const =0
 
virtual void read_dir_flush () const =0
 ends the read_dir_next, (no more entry available) More...
 

Private Member Functions

void nullifyptr () noexcept
 
void copy_from (const entrepot_local &ref)
 
void move_from (entrepot_local &&ref) noexcept
 
void detruit () const
 

Private Attributes

bool furtive_mode
 
etagecontents
 

Detailed Description

implementation for entrepot to access to local filesystem

entrepot_local generates objects of class "fichier_local" inherited class of fichier_global

Definition at line 47 of file entrepot_local.hpp.

Constructor & Destructor Documentation

◆ entrepot_local() [1/3]

libdar::entrepot_local::entrepot_local ( const std::string &  user,
const std::string &  group,
bool  x_furtive_mode 
)

constructor

Parameters
[in]userdefines the default user ownership of files created by the entrepot::open() method
[in]groupdefines the default group ownership of files created by the entrepot::open() method
[in]x_furtive_modewhether to ask the operating system to make furtive read access (no mtime/atime/ctime modification)

Referenced by clone().

◆ entrepot_local() [2/3]

libdar::entrepot_local::entrepot_local ( const entrepot_local ref)
inline

Definition at line 57 of file entrepot_local.hpp.

◆ entrepot_local() [3/3]

libdar::entrepot_local::entrepot_local ( entrepot_local &&  ref)
inlinenoexcept

Definition at line 58 of file entrepot_local.hpp.

◆ ~entrepot_local()

libdar::entrepot_local::~entrepot_local ( )
inline

Definition at line 61 of file entrepot_local.hpp.

Member Function Documentation

◆ clone()

virtual entrepot * libdar::entrepot_local::clone ( ) const
inlineoverridevirtual

done this way for homogeneity with open/inherited_open

generate a clone of "this"

Deprecated:
this method will disapear in the future it is only kept there to allow the APIv5 adaptation layer to work over APIv6

Implements libdar::entrepot.

Definition at line 74 of file entrepot_local.hpp.

References entrepot_local().

◆ copy_from()

void libdar::entrepot_local::copy_from ( const entrepot_local ref)
inlineprivate

Definition at line 95 of file entrepot_local.hpp.

◆ create_dir()

virtual void libdar::entrepot_local::create_dir ( const std::string &  dirname,
U_I  permission 
)
overridevirtual

create a new directory in the current directory

Parameters
[in]dirnameis the name of the subdirectory to create (not its path!) It is created in as sub-directory of the directory given to set_location()
[in]permissionis the usual POSIX user/group/other permission bits to set to the directory to create
Note
the operation fails if an entry of that name already exists
the implementation should set the user and group ownership according to the argument provided to set_user_ownership() and set_group_ownership(), if this feature is supported in the underlying implementation

Implements libdar::entrepot.

◆ detruit()

void libdar::entrepot_local::detruit ( ) const
inlineprivate

Definition at line 97 of file entrepot_local.hpp.

◆ get_url()

virtual std::string libdar::entrepot_local::get_url ( ) const
inlineoverridevirtual

full path of current directory + anything necessary to provide URL formated information

Implements libdar::entrepot.

Definition at line 63 of file entrepot_local.hpp.

References libdar::path::display(), and libdar::entrepot::get_full_path().

◆ inherited_open()

virtual fichier_global * libdar::entrepot_local::inherited_open ( const std::shared_ptr< user_interaction > &  dialog,
const std::string &  filename,
gf_mode  mode,
bool  force_permission,
U_I  permission,
bool  fail_if_exists,
bool  erase 
) const
overrideprotectedvirtual

Implements libdar::entrepot.

◆ inherited_unlink()

virtual void libdar::entrepot_local::inherited_unlink ( const std::string &  filename) const
overrideprotectedvirtual

Implements libdar::entrepot.

◆ move_from()

void libdar::entrepot_local::move_from ( entrepot_local &&  ref)
inlineprivatenoexcept

Definition at line 96 of file entrepot_local.hpp.

◆ nullifyptr()

void libdar::entrepot_local::nullifyptr ( )
inlineprivatenoexcept

Definition at line 94 of file entrepot_local.hpp.

◆ operator=()

entrepot_local & libdar::entrepot_local::operator= ( entrepot_local &&  ref)
inlinenoexcept

Definition at line 60 of file entrepot_local.hpp.

◆ read_dir_flush()

virtual void libdar::entrepot_local::read_dir_flush ( ) const
inlineoverrideprotectedvirtual

ends the read_dir_next, (no more entry available)

Implements libdar::entrepot.

Definition at line 88 of file entrepot_local.hpp.

◆ read_dir_next()

virtual bool libdar::entrepot_local::read_dir_next ( std::string &  filename) const
overridevirtual

read the next filename of the current directory

Parameters
[out]filenamename of the next entry in the directory, (valid only if this method returned true)
Returns
false if no more filename could be fould
Note
either use read_dir_reset() followed by read_dir_next() calls, or call read_dir_reset_dirinfo() followed by read_dir_next_dirinfo() calls

Implements libdar::entrepot.

◆ read_dir_next_dirinfo()

virtual bool libdar::entrepot_local::read_dir_next_dirinfo ( std::string &  filename,
inode_type tp 
) const
overridevirtual

alternative to the method read_dir_next, should be implemented also

Parameters
[out]filenamename of the next entry in the directory, (valid only if this method returned true)
[out]tpgives the nature of the entry
Note
a call to read_dir_reset_dirinfo() should be done before the first call to this method
either use read_dir_reset() followed by read_dir_next() calls, or call read_dir_reset_dirinfo() followed by read_dir_next_dirinfo() calls

Implements libdar::entrepot.

◆ read_dir_reset()

virtual void libdar::entrepot_local::read_dir_reset ( ) const
inlineoverridevirtual
Note
dir_details does not matter for this implementation, both read_dir_next() can be used anytime.

Implements libdar::entrepot.

Definition at line 67 of file entrepot_local.hpp.

References read_dir_reset_dirinfo().

◆ read_dir_reset_dirinfo()

virtual void libdar::entrepot_local::read_dir_reset_dirinfo ( ) const
overridevirtual

routines to read existing files with dir information

to be used before calling read_dir_next_dirinfo().

Note
after calling read_dir_reset_dirinfo() calling read_dir_next() gives undefined result, you first need to call read_dir_reset() or continue using read_dir_next_dirinfo()

Implements libdar::entrepot.

Referenced by read_dir_reset().

Member Data Documentation

◆ contents

etage* libdar::entrepot_local::contents
mutableprivate

Definition at line 92 of file entrepot_local.hpp.

◆ furtive_mode

bool libdar::entrepot_local::furtive_mode
private

Definition at line 91 of file entrepot_local.hpp.


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