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

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

Introduction

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

Prototype

@Override
public String toString() 

Source Link

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 w w .j av a2 s  .co  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:com.benhumphreys.jgitcassandra.store.ObjStore.java

License:Apache License

/**
 * Removes the list of pack descriptions from the store.
 * If one of the descriptions is not present in the store it will be silently
 * ignored.//from  w w w  .  j a va  2  s.c  o m
 *
 * A pack description is removed based on matching the "name" field; ie the
 * string returned by DfsPackDescrption.toString()
 *
 * @param desc
 * @throws IOException  if an exception occurs when communicating to the
 *                      database
 */
public void removeDesc(Collection<DfsPackDescription> desc) throws IOException {
    for (DfsPackDescription pd : desc) {
        try {
            Statement stmt = QueryBuilder.delete().from(keyspace, DESC_TABLE_NAME)
                    .where(QueryBuilder.eq("name", pd.toString()));
            session.execute(stmt);
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw new IOException(e);
        }
    }
}