Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / surf / workstation_interface.hpp
index 5045cec..c472d37 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2013. The SimGrid Team.
+/* Copyright (c) 2004-2014. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -25,6 +25,34 @@ typedef Workstation *WorkstationPtr;
 class WorkstationAction;
 typedef WorkstationAction *WorkstationActionPtr;
 
+/*************
+ * Callbacks *
+ *************/
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after Workstation creation *
+ * @details Callback functions have the following signature: `void(WorkstationPtr)`
+ */
+extern surf_callback(void, WorkstationPtr) workstationCreatedCallbacks;
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after Workstation destruction *
+ * @details Callback functions have the following signature: `void(WorkstationPtr)`
+ */
+extern surf_callback(void, WorkstationPtr) workstationDestructedCallbacks;
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after Workstation State changed *
+ * @details Callback functions have the following signature: `void(WorkstationActionPtr)`
+ */
+extern surf_callback(void, WorkstationPtr) workstationStateChangedCallbacks;
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after WorkstationAction State changed *
+ * @details Callback functions have the following signature: `void(WorkstationActionPtr)`
+ */
+extern surf_callback(void, WorkstationActionPtr) workstationActionStateChangedCallbacks;
+
 /*********
  * Tools *
  *********/
@@ -79,17 +107,6 @@ public:
                                         double *communication_amount,
                                         double rate)=0;
 
- /**
-  * @brief [brief description]
-  * @details [long description]
-  * 
-  * @param src [description]
-  * @param dst [description]
-  * 
-  * @return [description]
-  */
- virtual xbt_dynar_t getRoute(WorkstationPtr src, WorkstationPtr dst)=0;
-
  /**
   * @brief [brief description]
   * @details [long description]
@@ -116,9 +133,8 @@ class Workstation : public Resource {
 public:
   /**
    * @brief Workstation consrtuctor
-   * @details [long description]
    */
-  Workstation(){};
+  Workstation();
 
   /**
    * @brief Workstation constructor
@@ -147,6 +163,13 @@ public:
   Workstation(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
                      xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu);
 
+  /**
+   * @brief Workstation destructor
+   */
+  ~ Workstation();
+
+  void setState(e_surf_resource_state_t state);
+
   /**
    * @brief Get the properties of the currenrt Workstation
    *
@@ -223,17 +246,23 @@ public:
    * 
    * @return The xbt_dict_t of mount_point: Storage
    */
-  virtual xbt_dict_t getStorageList();
+  virtual xbt_dict_t getMountedStorageList();
+
+  /**
+   * @brief Get the xbt_dynar_t of storages attached to the workstation
+   *
+   * @return The xbt_dynar_t of Storage names
+   */
+  virtual xbt_dynar_t getAttachedStorageList();
 
   /**
    * @brief Open a file
    * 
-   * @param mount The mount point
-   * @param path The path to the file
+   * @param fullpath The full path to the file
    * 
    * @return The StorageAction corresponding to the opening
    */
-  virtual ActionPtr open(const char* mount, const char* path);
+  virtual ActionPtr open(const char* fullpath);
 
   /**
    * @brief Close a file
@@ -256,6 +285,7 @@ public:
    * @brief List directory contents of a path
    * @details [long description]
    * 
+   * @param mount [description]
    * @param path The path to the directory
    * @return The StorageAction corresponding to the ls action
    */
@@ -339,6 +369,28 @@ public:
    */
   virtual int fileSeek(surf_file_t fd, sg_size_t offset, int origin);
 
+  /**
+   * @brief Move a file to another location on the *same mount point*.
+   * @details [long description]
+   *
+   * @param fd The file descriptor
+   * @param fullpath The new full path
+   * @return MSG_OK if successful, MSG_TASK_CANCELED and a warning if the new
+   * full path is not on the same mount point
+   */
+  virtual int fileMove(surf_file_t fd, const char* fullpath);
+
+  /**
+   * @brief Copy a file to another location on a remote host.
+   * @details [long description]
+   *
+   * @param fd The file descriptor
+   * @param host_dest The worstation destination
+   * @param fullpath The new full path
+   * @return MSG_OK if successful, otherwise MSG_TASK_CANCELED
+   */
+  virtual int fileRcopy(surf_file_t fd, surf_resource_t host_dest, const char* fullpath);
+
   xbt_dynar_t p_storage;
   RoutingEdgePtr p_netElm;
   CpuPtr p_cpu;
@@ -373,6 +425,7 @@ public:
 /**********
  * Action *
  **********/
+
 /** @ingroup SURF_workstation_interface
  * @brief SURF workstation action interface class
  */
@@ -399,6 +452,7 @@ public:
   WorkstationAction(ModelPtr model, double cost, bool failed, lmm_variable_t var)
   : Action(model, cost, failed, var) {}
 
+  void setState(e_surf_action_state_t state);
 };