====================================================================================================
OptimiserFactory类:
abstract public class OptimiserFactory{……}
用以使得CE获得一个恰当的Optimiser的Object(根据数复制优化的选择项)
private static final int SIMPLE_OPTIMISER = 1;
private static final int LRU_OPTIMISER = 2;
private static final int LFU_OPTIMISER = 3;
private static final int ECO_MODEL_OPTIMISER = 4;
private static final int ECO_MODEL_OPTIMISER_ZIPF_BASED = 5
Optimisable getOptimisable( GridSite site) 被RB使用,根据在配置文件中制定的数据复制优化选项产生
====================================================================================================
LruOptimiser类:
LruOptimiser extends ReplicatingOptimiser{……}
LruOptimiser( GridSite site) { super(site);} 构造函数中指明了GridSite
List chooseFilesToDelete( DataFile file, StorageElement se){ return se.filesToDelete(file);}
====================================================================================================
ReplicatingOptimiser类:
abstract public class ReplicatingOptimiser extends SkelOptor{……}
ReplicatingOptimiser (GridSite site ) { super(site);}
DataFile[] getBestFile(String[] lfns, float[] fileFraction)
* Always tries to replicate all the files specified by lfns to
* the calling Computing Element's local Storage Element.
* Replication will fail if a null is returned by the subclass'
* chooseFileToDelete method.
List chooseFilesToDelete( DataFile file, StorageElement se)
* How to decide which files to delete in order to make space for DataFile file.
* All subclasses must implement this using their own optimiser specific algorithms.
====================================================================================================
SkelOptor类:
public class SkelOptor implements Optimisable{……}
protected SkelOptor( GridSite site) { _site = site; _networkClient = new NetworkClient(); }
protected GridSite _site;
protected NetworkClient _networkClient;
DataFile[] getBestFile{……}
*A "standard" implementation of getBestFile. It simply looks at
* the Replica Catalogue and current network status and returns the
* replicas that will take the shortest time to access.
float getAccessCost(String[] lfns,ComputingElement ce,float[] fileFraction)
* Calculate aggregated network costs for a single computing element.
* Uses network costs and the Replica Catalog to find the best replica
* of each file and sums the access costs.
====================================================================================================
Optimisable接口:
This interface must be implemented by all replica optimiser classes.
* Each optimiser should define its own implementation of {@link #getBestFile}.
* This is the method called whenever a file request is made. It determines
* where the best replica of a file is and most implementations may perform
* replication of files within this method.
float getAccessCost(String[] lfn,ComputingElement ce,float[] fileFraction)
根据lfn数组中指出的文件逻辑名字,返回由ce访问他们的cost
DataFile[] getBestFile(String[] lfn,float[] fileFraction);
*Returns a {@link DataFile} array, possibly after some
* replication has occurred. Computing Elements call this method
* to find the best replicas of each file to access.
******************************************************************************************************************
******************************************************************************************************************
******************************************************************************************************************
******************************************************************************************************************
===================================================================================================
ReplicaManager类:
public class ReplicaManager{……}
提供了File的处理方法,是CE和optimisers间交互的接口。也是ReplicaCatalogue外包类,任何ReplicaCatalogue
的改变都要通过这个类实现。
private ReplicaCatalogue _rc;
private final int ALL_OF_FILE=1;
void registerEntry( DataFile file) { _rc.addFile( file); }
注册一个File入口
unregisterEntry( DataFile file)
取消一个file入口注册
DataFile replicateFile( DataFile source, StorageElement toSE)
拷贝source到指定的toSE上,并在ReplicaCatalogue中注册
void copyFile( DataFile source, StorageElement toSE)
拷贝source到指定的toSE上,但是不再ReplicaCatalogue中注册
deleteFile( DataFile file)
删除一个文件,调用ReplicaCatalogue::removeFile(……)
同时在储存file的SE上删除file
===================================================================================================
ReplicaCatalogue类:
class ReplicaCatalogue{……}
* This class is a catalogue of files available on the Grid. Logical
* File Names (strings representing a unique file ) are mapped
* to the physical DataFiles (individual instances or replicas of each
* file) spread around the Grid using a Hashtable. The keys are the
* Logical File Names (string) and the values are Sets of DataFiles.
* The ReplicaCatalogue is not used directly but is accessed via the
* ReplicaManager which provides methods to for example copy a file
* around the Grid or remove a file from the Grid
private Hashtable _catalogue;
public String getNextFile(); 返回下一个应该被处理的文件,这依赖于在配置文件中做出的选择。
====================================================================================================
SequentialAccessGenerator类:
public class SequentialAccessGenerator implements AccessPatternGenerator{……}
private int _numFiles;
private GridJob _job;
private int _fileId=0;
private int _fileCounter=0; 标志当前Job中已经处理了几个File,利用这个计数值和Job中的File数比较
SequentialAccessGenerator(GridJob gridJob, float fileSetFraction) {_job = gridJob;_numFiles = (int)( _job.size() * fileSetFraction); }
String getNextFile() 返回下一个File的LFN
====================================================================================================
AccessPatternGeneratorFactory类:
abstract public class AccessPatternGeneratorFactory{……}
AccessPatternGenerator getAPGenerator(GridJob gridJob) {……}
返回正确的AccessPatternGenerator方式类对象
******************************************************************************************************************
********=*********************************************************************************************************
******************************************************************************************************************
******************************************************************************************************************
======================================================================================================
AccessHistoryStorageElement类:
public class AccessHistoryStorageElement extends SimpleStorageElement{…… }
* An extension of SimpleStorageElement which keeps a record of
* file accesses. This is implemented as a {@link TreeMap} mapping
* a {@link Date} to a {@link DataFile}. When a file is accessed on
* the SE a new entry is added to the access history. Optimisation
* algorithms in StorageElement classes that extend this class use
* the recent access history to evaluate the relative values of
* files stored on the SE.
public AccessHistoryStorageElement(GridSite site, long capacity) {super(site, capacity);}
当SE上的一个File被访问,在history中一个新的入口被增加了
private TreeMap _accessHistory = new TreeMap
OptorSim源代码简要分析
5星 · 超过95%的资源 需积分: 10 139 浏览量
2009-06-28
10:10:47
上传
评论 2
收藏 28KB RAR 举报
jd_wh
- 粉丝: 19
- 资源: 18