Imported Upstream version 15.19.0
[platform/upstream/libzypp.git] / zypp / media / MediaHandler.h
index 2cef963..52fd9a8 100644 (file)
@@ -1,3 +1,4 @@
+
 /*---------------------------------------------------------------------\
 |                          ____ _   __ __ ___                          |
 |                         |__  / \ / / . \ . \                         |
@@ -24,6 +25,7 @@
 
 #include "zypp/media/MediaSource.h"
 #include "zypp/media/MediaException.h"
+#include "zypp/APIConfig.h"
 
 namespace zypp {
   namespace media {
@@ -80,7 +82,7 @@ class MediaHandler {
         *
         *      dir, false => user specified attach point (not removed)
         */
-       AttachPoint     _AttachPointHint;
+       AttachPoint     _attachPointHint;
 
        /**
         * The relative root directory of the data on the media.
@@ -98,6 +100,9 @@ class MediaHandler {
         /** timestamp of the the last attach verification */
         mutable time_t  _attach_mtime;
 
+       /** file usable for delta downloads */
+       mutable Pathname _deltafile;
+
     protected:
         /**
         * Url to handle
@@ -276,12 +281,9 @@ class MediaHandler {
         *        mount table (nfs, smb and cifs) or from mediaSource
         *        while compare of a mount entry with mediaSource.
         */
-       void             forceRelaseAllMedia(bool matchMountFs,
-                                            bool autoMountedOny=true);
+       void             forceRelaseAllMedia(bool matchMountFs);
        void             forceRelaseAllMedia(const MediaSourceRef &ref,
-                                            bool matchMountFs,
-                                            bool autoMountedOnly=true);
-       virtual bool     isAutoMountedMedia(const AttachedMedia &media);
+                                            bool matchMountFs);
 
     protected:
 
@@ -329,11 +331,12 @@ class MediaHandler {
         * instance only, physically eject the media (i.e. CD-ROM).
         *
         * Asserted that media is attached.
+        * \param ejectDev Device to eject. None if empty.
         *
         * \throws MediaException
         *
         **/
-       virtual void releaseFrom( bool eject ) = 0;
+       virtual void releaseFrom( const std::string & ejectDev = "" ) = 0;
 
        /**
         * Call concrete handler to physically eject the media (i.e. CD-ROM)
@@ -341,7 +344,7 @@ class MediaHandler {
         *
         * Asserted that media is not attached.
         **/
-       virtual void forceEject() {}
+       virtual void forceEject( const std::string & device ) {}
 
        /**
         * Call concrete handler to provide file below attach point.
@@ -517,7 +520,7 @@ class MediaHandler {
        /**
         * True if media is attached.
         **/
-       virtual bool isAttached() const { return _mediaSource; }
+       virtual bool isAttached() const { return _mediaSource != nullptr; }
 
        /**
         * Return the local directory that corresponds to medias url,
@@ -553,12 +556,11 @@ class MediaHandler {
 
        /**
         * Use concrete handler to release the media.
-        * @param eject if true, physically eject the media * (i.e. CD-ROM)
+        * @param eject Device to physically eject. None if empty.
         *
         * \throws MediaException
-        *
         **/
-       void release( bool eject = false );
+       void release( const std::string & ejectDev = "" );
 
        /**
         * Use concrete handler to provide file denoted by path below
@@ -637,6 +639,16 @@ class MediaHandler {
         **/
        void releasePath( Pathname pathname ) const;
 
+        /*
+         * set a deltafile to be used in the next download
+         */
+       void setDeltafile( const Pathname &filename = Pathname()) const;
+
+       /*
+        * return the deltafile set with setDeltafile()
+        */
+       Pathname deltafile () const;
+
     public:
 
        /**
@@ -681,9 +693,21 @@ class MediaHandler {
         bool doesFileExist( const Pathname & filename ) const;
 
         /**
-         * Check if the media has one more device available for attach(true). 
+         * Check if the media has one more device available for attach(true).
          */
         virtual bool hasMoreDevices();
+
+        /**
+         * Fill in a vector of detected ejectable devices and the index of the
+         * currently attached device within the vector. The contents of the vector
+         * are the device names (/dev/cdrom and such).
+         *
+         * \param devices  vector to load with the device names
+         * \param index    index of the currently used device in the devices vector
+         */
+        virtual void
+        getDetectedDevices(std::vector<std::string> & devices,
+                           unsigned int & index) const;
 };
 
 ///////////////////////////////////////////////////////////////////