Example usage for org.apache.hadoop.hdfs.server.namenode DirectoryWithQuotaFeature getSpaceConsumed

List of usage examples for org.apache.hadoop.hdfs.server.namenode DirectoryWithQuotaFeature getSpaceConsumed

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.server.namenode DirectoryWithQuotaFeature getSpaceConsumed.

Prototype

public QuotaCounts getSpaceConsumed() 

Source Link

Usage

From source file:io.hops.transaction.context.DirectoryWithQuotaFeatureContext.java

License:Apache License

@Override
public void update(DirectoryWithQuotaFeature directoryWithQuotaFeature) throws TransactionContextException {
    if (directoryWithQuotaFeature.getInodeId() != null) {
        super.update(directoryWithQuotaFeature);
        if (isLogTraceEnabled()) {
            log("updated-attributes", "id", directoryWithQuotaFeature.getInodeId(), "quota",
                    directoryWithQuotaFeature.getQuota(), " usage",
                    directoryWithQuotaFeature.getSpaceConsumed());
        }//from w w w.j a va  2 s .c o  m
    } else {
        if (isLogTraceEnabled()) {
            log("updated-attributes -- IGNORED as id is not set");
        }
    }
}

From source file:io.hops.transaction.context.DirectoryWithQuotaFeatureContext.java

License:Apache License

private Collection<DirectoryWithQuotaFeature> findByPrimaryKeys(DirectoryWithQuotaFeature.Finder qfinder,
        Object[] params) throws StorageCallPreventedException, StorageException {
    final List<INodeCandidatePrimaryKey> inodePks = (List<INodeCandidatePrimaryKey>) params[0];
    Collection<DirectoryWithQuotaFeature> result = null;
    if (contains(inodePks)) {
        result = get(inodePks);//from w w  w  .ja v  a2  s. c o m
        hit(qfinder, result, "inodeids", inodePks);
    } else {
        aboutToAccessStorage(qfinder, inodePks);
        result = dataAccess.findAttributesByPkList(inodePks);
        gotFromDB(result);
        miss(qfinder, result, "inodeids", inodePks);
        if (result != null) {
            for (DirectoryWithQuotaFeature directoryWithQuotaFeature : result) {
                log("attributes", "id", directoryWithQuotaFeature.getInodeId(), "quota",
                        directoryWithQuotaFeature.getQuota(), " usage",
                        directoryWithQuotaFeature.getSpaceConsumed());
            }

        }
    }
    return result;
}

From source file:io.hops.transaction.context.DirectoryWithQuotaFeatureContext.java

License:Apache License

private DirectoryWithQuotaFeature clone(DirectoryWithQuotaFeature src, long inodeId) {
    return new DirectoryWithQuotaFeature.Builder(inodeId).nameSpaceQuota(src.getQuota().getNameSpace())
            .nameSpaceUsage(src.getSpaceConsumed().getNameSpace())
            .storageSpaceQuota(src.getQuota().getStorageSpace())
            .spaceUsage(src.getSpaceConsumed().getStorageSpace()).typeQuotas(src.getQuota().getTypeSpaces())
            .typeUsages(src.getSpaceConsumed().getTypeSpaces()).build();
}