PureEdgeSim -datacentersmanager包-ComputingNode文件

ComputingNode接口汇总:

三种网络类型

    /**
     * An enum representing the orientation of a network link.
     *
     * UP_LINK: Represents an upward link from the device to the network. DOWN_LINK:
     * Represents a downward link from the network to the device. DEVICE_TO_DEVICE:
     * Represents a link between two devices.
     */
    
    public enum LinkOrientation {
        UP_LINK, DOWN_LINK, DEVICE_TO_DEVICE;
    }

空的节点,避免空指针报错

   
    /**
     * An attribute that implements the Null Object Design Pattern to avoid
     * NullPointerException when using the NULL_COMPUTING_NODE object instead of
     * attributing null to ComputingNode variables.
     * 
     */
    ComputingNode NULL = ComputingNodeNull.getInstance();

任务卸载到运算节点,任务会被添加到执行队列

    /**
     * Called when a task has been offloaded to this computing node. The task will
     * be added to the execution queue.
     *
     * @param task the task to execute.
     * @return
     * 任务卸载到运算节点,
     */
   
    void submitTask(Task task);

//返回计算节点类型 云节点,边缘节点,边缘设备

    /**
     * Gets the type of this computing node, e.g.
     * {@link SimulationParameters.TYPES#CLOUD},
     * {@link SimulationParameters.TYPES#EDGE_DATACENTER}, or
     * {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @return the type of this computing node.
     */
   
    SimulationParameters.TYPES getType();

设置结点的类型 云节点,边缘节点,边缘设备

    /**
     * Sets the type of this computing node, e.g.
     * {@link SimulationParameters.TYPES#CLOUD},
     * {@link SimulationParameters.TYPES#EDGE_DATACENTER}, or
     * {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @param type The type of this computing node.
     *
     */
    void setType(SimulationParameters.TYPES type);

//设置数据中心的名字
//设置名字是用来设置拓扑结构
//只有为边缘节点时名字才是有用的

    /**
     * Sets the name of this edge data center node. Called only if the type of this
     * node is {@link SimulationParameters.TYPES#EDGE_DATACENTER}. The name is given
     * by the user in the edge_datacenters.xml file. It is needed in order to create
     * the topology.
     *
     * @see DefaultTopologyCreator#getDataCenterByName(String name)
     *
     * @param name The name of this edge data center.
     *
     *
     */
    void setName(String name);

用来创建拓扑

    /**
     * Gets the name of this computing node (for now, the name is only given if this
     * computing node type is {@link SimulationParameters.TYPES#CLOUD}. It is needed
     * in order to create the topology.
     *
     * @return the name of this computing node.
     *
     * @see DefaultTopologyCreator#getDataCenterByName(String name)
     * @see #setName(String)
     *
     *
     */
    String getName();

查看该节点是否为编排器

    /**
     * Checks if this computing node is an orchestrator.
     *
     * @return true if this computing node is set as orchestrator.
     *
     * @see #setAsOrchestrator(boolean)
     */
 
    boolean isOrchestrator();

当设置为编排器,任务会被发送到这个节点去做卸载决策

    /**
     * When true, it sets this computing node as an orchestrator. By doing so, the
     * tasks will be sent to this node to make offloading/placement decisions.
     *
     * @param isOrchestrator whether this computing node is orchestrator or not.
     *
     * @see #isOrchestrator()
     */
   
    void setAsOrchestrator(boolean isOrchestrator);

将其他节点设为这个节点的编排器

    /**
     * Sets the node that orchestrates the tasks on behalf of this one. Used only
     * when the type of this node is {@link SimulationParameters.TYPES#EDGE_DEVICE}
     *
     * @param orchestrator the node that orchestrates the tasks of this device.
     *
     * @see #isOrchestrator()
     */
  
    void setOrchestrator(ComputingNode orchestrator);

得到当前节点的编排器

    /**
     * Gets the node that orchestrates the tasks on behalf of this one. Used only
     * when the type of this node is {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @return the orchestrator of this edge device.
     *
     * @see DefaultSimulationManager#sendTaskToOrchestrator(Task task)
     * @see #setAsOrchestrator(boolean)
     */
   
    ComputingNode getOrchestrator();

设置这个节点是否为产生任务

    /**
     * Sets whether this computing node generates tasks (e.g. an IoT sensor). Used
     * only when the type of this node is
     * {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @see ComputingNodesGenerator#generateEdgeDevices()
     * @see #isGeneratingTasks()
     *
     * @param generateTasks true when this edge device can generate tasks, false
     *                      otherwise.
     */

    
    void enableTaskGeneration(boolean generateTasks);

返回是否会产生任务


 /**
  * Gets whether this computing node generates tasks (e.g. an IoT sensor). Used
  * only when the type of this node is
  * {@link SimulationParameters.TYPES#EDGE_DEVICE}
  *
  * @return whether this computing node generates tasks (e.g. an IoT sensor), or
  *         not.
  *
  * @see ComputingNodesGenerator#generateEdgeDevices()
  * @see #enableTaskGeneration(boolean)
  */


 boolean isGeneratingTasks();

返回当前连接种类的网络连接

    /**
     * Returns the current network link of the specified type. For example, if the
     * type is {@link LinkOrientation#UP_LINK}, it returns the link that is used
     * currently to send data to the cloud or edge data centers. Used only when the
     * type of this node is {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @param linkType the type of the link to retrieve
     * @return the current network link of the specified type
     * @see #setCurrentLink(NetworkLink, LinkOrientation)
     */

   
    NetworkLink getCurrentLink(LinkOrientation linkType);

设置网络连接

    /**
     * Sets the network link that is used currently to send data to the cloud or
     * edge data centers.Used only when the type of this node is
     * {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @param currentUpLink the network link.
     * @see #getCurrentLink(LinkOrientation)
     */
 
    void setCurrentLink(NetworkLink link, LinkOrientation linkType);

看设备是否有电


    /**
     * Whether this device is out of battery. Used only when the type of this node
     * is {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @return true if this device is out of battery.
     */
   
    boolean isDead();

返回没有电的时间

    /**
     * Gets the time in seconds when this device was out of battery. Used only when
     * the type of this node is {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @return time when this device was out of battery.
     */
    
    double getDeathTime();

得到使用的能量模型

    /**
     * Gets the used energy model.
     *
     * @return the energy model.
     */
   
    EnergyModelComputingNode getEnergyModel();

设置能量模型

    /**
     * Sets the energy model.
     *
     * @param energyModel the energy model.
     */
   
    void setEnergyModel(EnergyModelComputingNode energyModel);

得到移动模型

    /**
     * Gets the used mobility model.
     *
     * @return the mobility model.
     */
   
    MobilityModel getMobilityModel();

设置移动模型

    /**
     * Sets the mobility model.
     *
     * @param mobilityModel the mobility model.
     */
    
    void setMobilityModel(MobilityModel mobilityModel);

节点是否可以直连边缘数据中心

    /**
     * Gets whether edge devices can connect to this edge data center directly (via
     * a single hop), or not. Used only when the type of this node is
     * {@link SimulationParameters.TYPES#EDGE_DATACENTER}.
     *
     * @return true if edge devices can connect to this edge data center directly.
     */
   
    boolean isPeripheral();

设置边界设备是否可以直连

    /**
     * Sets whether edge devices can connect to this edge data center directly (via
     * a single hop), or not. Used only when the type of this node is
     * {@link SimulationParameters.TYPES#EDGE_DATACENTER}.
     *
     * @param peripheral true to set the edge data center to peripheral, false
     *                   otherwise.
     * @see #isPeripheral()
     */
    
    void setPeriphery(boolean peripheral);

设置任务卸载的位置

    /**
     * Sets where the application of this edge device has been placed. Used only
     * when the type of this node is {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @param node the computing node that executes the tasks of this device.
     */
    
    void setApplicationPlacementLocation(ComputingNode node);

获得任务卸载的位置

    /**
     * Gets where the application of this edge device has been placed. Used only
     * when the type of this node is {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @return the computing node that executes the tasks of this device.
     */
 
    ComputingNode getApplicationPlacementLocation();

边缘设备上的任务是否被卸载

    /**
     * Gets if the application of this edge device has been placed. Used only when
     * the type of this node is {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @return true if the application of this edge device has been placed.
     * @see #setApplicationPlaced(boolean)
     */
   
    boolean isApplicationPlaced();

设置边缘设备的任务是否已被卸载

    /**
     * Sets if the application of this edge device has been placed. It is
     * automatically set to false when this device moves away from the node where
     * its application has been placed previously. Used only when the type of this
     * node is {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @see #setApplicationPlacementLocation(ComputingNode)
     * @param isApplicationPlaced true if the application of this edge device has
     *                            been placed.
     */
    void setApplicationPlaced(boolean isApplicationPlaced);

获取CPU核心数

 /**
     * Gets the number of CPU cores this computing node has.
     *
     * @return the number of cores.
     *
     * @see #getNumberOfCPUCores()
     * @see #getTotalMipsCapacity()
     * @see #setTotalMipsCapacity(double)
     * @see #getMipsPerCore()
     */
    double getNumberOfCPUCores(); 

设置CPU核数

    /**
     * Sets the number of CPU cores this computing node has.
     *
     * @param numberOfCPUCores the number of cores.
     *
     * @see #getNumberOfCPUCores()
     * @see #getTotalMipsCapacity()
     * @see #setTotalMipsCapacity(double)
     * @see #getMipsPerCore()
     */
    
    void setNumberOfCPUCores(int numberOfCPUCores);

获得任务类型

    /**
     * Gets the type of application this edge device is using. Used only when the
     * type of this node is {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @return the type of application.
     */
   
    int getApplicationType();

设置应用类型

 /**
     * Sets the type of application this edge device is using. Used only when the
     * type of this node is {@link SimulationParameters.TYPES#EDGE_DEVICE}.
     *
     * @param applicationType the type of application.
     */
    
    void setApplicationType(int applicationType);

计算节点的存储空间

    /**
     * Gets the amount storage (in Megabytes) that is available on this computing
     * node.
     *
     * @return the available storage.
     */
   
    double getAvailableStorage();

设置可用存储空间

    /**
     * Sets the amount storage (in Megabytes) that is available on this computing
     * node.
     *
     * @param availableStorage the available storage.
     */
    void setAvailableStorage(double availableStorage);

获得平均CPU使用

    /**
     * Gets the average CPU utilization of this computing node from the beginning of
     * the simulation.
     *
     * @return the average CPU utilization.
     */
    double getAvgCpuUtilization();

得到CPU使用率

    /**
     * Gets the CPU utilization of this computing node at this instant of the
     * simulation.
     *
     * @return the current CPU utilization percentage.
     */
    double getCurrentCpuUtilization();

获得是否空闲

    /**
     * Gets whether this computing node is idle or not.
     *
     * @return true if the CPU of this computing node is not used.
     */
    boolean isIdle();

设置是否空闲

    /**
     * Sets whether this computing node is idle or not.
     *
     * @param isIdle true if the CPU of this computing node is not used, false
     *               otherwise.
     */
    void setIdle(boolean isIdle);

传入任务增加CPU使用

    /**
     * Increments the CPU utilization when a new task is being executed.
     *
     * @see #submitTask(Task)
     * @see #getAvgCpuUtilization()
     *
     * @param task the task being executed.
     */
    void addCpuUtilization(Task task);

任务完成,减少CPU使用

    /**
     * Decreases the CPU utilization when a task finishes.
     *
     * @see #submitTask(Task)
     * @see #getAvgCpuUtilization()
     *
     * @param task the finished task.
     */
    void removeCpuUtilization(Task task);

是否是传感器(没有计算能力)

    /**
     * Gets whether this node is a sensor (no computing capabilities), or not.
     *
     * @return true if this device has no computing capabilities, false otherwise.
     *
     * @see #setAsSensor(boolean)
     */
  
    boolean isSensor();

设置为传感器

    /**
     * Sets whether this node is a sensor (no computing capabilities), or not.
     *
     * @param isSensor true if this device has no computing capabilities, false
     *                 otherwise.
     *
     * @see #isSensor()
     */
    void setAsSensor(boolean isSensor);

得到等待队列

    /**
     * Gets the list of tasks waiting for execution.
     *
     * @return the execution queue.
     *
     * @see #submitTask(Task)
     */
    
    List<Task> getTasksQueue();

得到全部存储空间

    /**
     * Gets the total amount of storage (in Megabytes) that this computing node has.
     *
     * @return the total amount of storage.
     *
     * @see #getAvailableStorage()
     * @see #setAvailableStorage(double)
     * @see #setStorage(double)
     */
    double getTotalStorage();

得到RAM空间

    /**
     * Gets the total amount of RAM (in Megabytes) that this computing node has.
     *
     * @return the total amount of RAM.
     *
     * @see #getAvailableRam()
     * @see #setAvailableRam(double)
     * @see #setRam(double)
     */
    double getRamCapacity();

得到可用RAM

    /**
     * Gets the amount of RAM (in Megabytes) that is available on this computing
     * node.
     *
     * @return the amount of available RAM.
     *
     * @see #getRamCapacity()
     * @see #setAvailableRam(double)
     * @see #setRam(double)
     */
    double getAvailableRam();

设置RAM容量

    /**
     * Sets the total amount of RAM (in Megabytes) that this computing node has.
     *
     * @param ram the total RAM on this computing node.
     *
     * @see #getAvailableRam()
     * @see #setAvailableRam(double)
     * @see #getRamCapacity()
     */
    void setRam(double ram);

设置可用RAM

    /**
     * Sets the amount of RAM (in Megabytes) that is available on this computing
     * node.
     *
     * @param ram the available RAM.
     *
     * @see #getAvailableRam()
     * @see #getRamCapacity()
     * @see #setRam(double)
     */
    void setAvailableRam(double ram);

设置全部的存储空间

    /**
     * Sets the total amount storage (in Megabytes) that this computing node has.
     *
     * @param storage the amount of storage.
     *
     * @see #getAvailableStorage()
     * @see #setAvailableStorage(double)
     * @see #getTotalStorage()
     */
    void setStorage(double storage);

得到计算速度

    /**
     * Gets the total computing capacity of this computing node in MIPS.
     *
     * @return total MIPS capacity.
     */
    double getTotalMipsCapacity();

设置计算速度

    /**
     * Sets the total computing capacity of this computing node in MIPS.
     *
     * @param totalMipsCapacity total MIPS capacity.
     */
    void setTotalMipsCapacity(double totalMipsCapacity);

设置每个核的计算速度

    /**
     * Gets the computing capacity of a each CPU Core in MIPS.
     *
     * @return the amount MIPS capacity per CPU core.
     *
     * @see #setNumberOfCPUCores(double)
     * @see #getNumberOfCPUCores()
     * @see #getTotalMipsCapacity()
     * @see #setTotalMipsCapacity(double)
     */
    double getMipsPerCore();

得到node的ID

    /**
     * Gets the Id of this computing node.
     *
     * @return the id of this computing node.
     */
    public int getId();

}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值