Example usage for org.apache.hadoop.hdfs.protocol CacheDirective getPath

List of usage examples for org.apache.hadoop.hdfs.protocol CacheDirective getPath

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.protocol CacheDirective getPath.

Prototype

public String getPath() 

Source Link

Usage

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  a v  a 2s.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;
            }/*  w  w  w .  ja  v  a  2  s . c  om*/
            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;
}