List of usage examples for org.apache.hadoop.hdfs.protocol CacheDirective getId
public long getId()
From source file:io.hops.metadata.adaptor.CacheDirectiveDALAdaptor.java
License:Apache License
@Override public io.hops.metadata.hdfs.entity.CacheDirective convertHDFStoDAL(CacheDirective cacheDirective) throws StorageException { return new io.hops.metadata.hdfs.entity.CacheDirective(cacheDirective.getId(), cacheDirective.getPath(), cacheDirective.getReplication(), cacheDirective.getExpiryTime(), cacheDirective.getBytesNeeded(), cacheDirective.getBytesCached(), cacheDirective.getFilesNeeded(), cacheDirective.getFilesCached(), cacheDirective.getPoolName()); }
From source file:io.hops.metadata.adaptor.CacheDirectiveDALAdaptor.java
License:Apache License
@Override public CacheDirective convertDALtoHDFS(io.hops.metadata.hdfs.entity.CacheDirective cacheDirective) { if (cacheDirective == null) { return null; }// w w w.j ava2 s. c o m return new CacheDirective(cacheDirective.getId(), cacheDirective.getPath(), cacheDirective.getReplication(), cacheDirective.getExpiryTime(), cacheDirective.getBytesNeeded(), cacheDirective.getBytesCached(), cacheDirective.getFilesNeeded(), cacheDirective.getFilesCached(), cacheDirective.getPool()); }
From source file:io.hops.transaction.context.CacheDirectiveContext.java
License:Apache License
private Collection<CacheDirective> findByIdPoolAndPath(CacheDirective.Finder hbFinder, Object[] params) throws StorageCallPreventedException, StorageException { long id = (long) params[0]; String poolName = (String) params[1]; String path = (String) params[2]; int maxNumResults = (int) params[3]; Collection<CacheDirective> results; if (fetchedCacheDirectivesById) { results = new ArrayList<>(); Set<Long> ids = new TreeSet<>(cacheDirectivesById.keySet()); for (long directiveId : ids) { CacheDirective directive = cacheDirectivesById.get(directiveId); if (poolName != null && !directive.getPoolName().equals(poolName)) { continue; }/*from w w w . jav a2s . c o m*/ if (path != null && !directive.getPath().equals(path)) { continue; } results.add(directive); if (results.size() >= maxNumResults) { break; } } hit(hbFinder, results, "id", id, "poolName", poolName, "path", path); } else { aboutToAccessStorage(hbFinder, params); results = dataAccess.findByIdAndPool(id, poolName); fetchedCacheDirectivesById = true; for (CacheDirective directive : results) { cacheDirectivesById.put(directive.getId(), directive); gotFromDB(directive); } miss(hbFinder, results, "id", id, "poolName", poolName, "path", path); } return results; }
From source file:io.hops.transaction.context.CacheDirectiveContext.java
License:Apache License
@Override Long getKey(CacheDirective cacheDirective) { return cacheDirective.getId(); }