Example usage for org.eclipse.jgit.internal.storage.dfs DfsPackDescription getDeltaCount

List of usage examples for org.eclipse.jgit.internal.storage.dfs DfsPackDescription getDeltaCount

Introduction

In this page you can find the example usage for org.eclipse.jgit.internal.storage.dfs DfsPackDescription getDeltaCount.

Prototype

public long getDeltaCount() 

Source Link

Document

Get number of delta compressed objects in the pack.

Usage

From source file:com.benhumphreys.jgitcassandra.store.ObjStore.java

License:Apache License

/**
 * Inserts a Pack description into the store.
 * If a description for this "name" already exists it will be overwritten.
 *
 * @param desc  the pack description to insert
 * @throws IOException  if an exception occurs when communicating to the
 *                      database/*from  w  ww . jav  a 2 s .c  o  m*/
 */
public void insertDesc(Collection<DfsPackDescription> desc) throws IOException {

    try {
        for (DfsPackDescription pd : desc) {
            Statement stmt = QueryBuilder.insertInto(keyspace, DESC_TABLE_NAME).value("name", pd.toString())
                    .value("source", pd.getPackSource().ordinal()).value("last_modified", pd.getLastModified())
                    .value("size_map", DescMapper.getFileSizeMap(pd)).value("object_count", pd.getObjectCount())
                    .value("delta_count", pd.getDeltaCount()).value("extensions", DescMapper.getExtBits(pd))
                    .value("index_version", pd.getIndexVersion());
            session.execute(stmt);
        }
    } catch (RuntimeException e) {
        e.printStackTrace();
        throw new IOException(e);
    }
}

From source file:org.chodavarapu.jgitaws.repositories.PackDescriptionRepository.java

License:Eclipse Distribution License

private static String toJson(DfsPackDescription desc) {
    JSONObject json = new JSONObject().put("modified", desc.getLastModified())
            .put("objects", desc.getObjectCount()).put("deltas", desc.getDeltaCount())
            .put("ixVersion", desc.getIndexVersion());

    for (PackExt ext : PackExt.values()) {
        if (desc.hasFileExt(ext)) {
            json.put(ext.getExtension() + "Size", desc.getFileSize(ext));
        }/*from  ww w .ja v  a  2  s.c om*/
    }

    if (desc.getPackSource() != null) {
        json.put("source", desc.getPackSource().name());
    }

    return json.toString();
}