/** * Construct a reader for an existing reftable. * * @param desc * description of the reftable within the DFS. */ public DfsReftable(DfsPackDescription desc) { this(DfsBlockCache.getInstance(), desc); }
private PackList scanPacksImpl(PackList old) throws IOException { DfsBlockCache cache = DfsBlockCache.getInstance(); Map<DfsPackDescription, DfsPackFile> packs = packMap(old); Map<DfsPackDescription, DfsReftable> reftables = reftableMap(old);
private void beginPack() throws IOException { objectList = new BlockList<>(); objectMap = new ObjectIdOwnerMap<>(); cache = DfsBlockCache.getInstance(); rollback = true; packDsc = db.newPack(DfsObjDatabase.PackSource.INSERT); DfsOutputStream dfsOut = db.writeFile(packDsc, PACK); packDsc.setBlockSize(PACK, dfsOut.blockSize()); packOut = new PackStream(dfsOut); packKey = packDsc.getStreamKey(PACK); // Write the header as though it were a single object pack. byte[] buf = packOut.hdrBuf; System.arraycopy(Constants.PACK_SIGNATURE, 0, buf, 0, 4); NB.encodeInt32(buf, 4, 2); // Always use pack version 2. NB.encodeInt32(buf, 8, 1); // Always assume 1 object. packOut.write(buf, 0, 12); }
/** * Construct a reader for an existing reftable. * * @param desc * description of the reftable within the DFS. */ public DfsReftable(DfsPackDescription desc) { this(DfsBlockCache.getInstance(), desc); }
boolean rollback = true; try { blockCache = DfsBlockCache.getInstance(); super.parse(receiving, resolving); if (isEmptyPack)
private PackList scanPacksImpl(PackList old) throws IOException { DfsBlockCache cache = DfsBlockCache.getInstance(); Map<DfsPackDescription, DfsPackFile> forReuse = reuseMap(old); List<DfsPackDescription> scanned = listPacks(); Collections.sort(scanned); List<DfsPackFile> list = new ArrayList<DfsPackFile>(scanned.size()); boolean foundNew = false; for (DfsPackDescription dsc : scanned) { DfsPackFile oldPack = forReuse.remove(dsc); if (oldPack != null) { list.add(oldPack); } else { list.add(cache.getOrCreate(dsc, null)); foundNew = true; } } for (DfsPackFile p : forReuse.values()) p.close(); if (list.isEmpty()) return new PackListImpl(NO_PACKS.packs); if (!foundNew) { old.clearDirty(); return old; } return new PackListImpl(list.toArray(new DfsPackFile[list.size()])); }
private PackList scanPacksImpl(PackList old) throws IOException { DfsBlockCache cache = DfsBlockCache.getInstance(); Map<DfsPackDescription, DfsPackFile> packs = packMap(old); Map<DfsPackDescription, DfsReftable> reftables = reftableMap(old);
private void beginPack() throws IOException { objectList = new BlockList<PackedObjectInfo>(); objectMap = new ObjectIdOwnerMap<PackedObjectInfo>(); cache = DfsBlockCache.getInstance(); rollback = true; packDsc = db.newPack(DfsObjDatabase.PackSource.INSERT); packOut = new PackStream(db.writeFile(packDsc, PACK)); packKey = new DfsPackKey(); // Write the header as though it were a single object pack. byte[] buf = packOut.hdrBuf; System.arraycopy(Constants.PACK_SIGNATURE, 0, buf, 0, 4); NB.encodeInt32(buf, 4, 2); // Always use pack version 2. NB.encodeInt32(buf, 8, 1); // Always assume 1 object. packOut.write(buf, 0, 12); }
private void beginPack() throws IOException { objectList = new BlockList<>(); objectMap = new ObjectIdOwnerMap<>(); cache = DfsBlockCache.getInstance(); rollback = true; packDsc = db.newPack(DfsObjDatabase.PackSource.INSERT); DfsOutputStream dfsOut = db.writeFile(packDsc, PACK); packDsc.setBlockSize(PACK, dfsOut.blockSize()); packOut = new PackStream(dfsOut); packKey = packDsc.getStreamKey(PACK); // Write the header as though it were a single object pack. byte[] buf = packOut.hdrBuf; System.arraycopy(Constants.PACK_SIGNATURE, 0, buf, 0, 4); NB.encodeInt32(buf, 4, 2); // Always use pack version 2. NB.encodeInt32(buf, 8, 1); // Always assume 1 object. packOut.write(buf, 0, 12); }
boolean rollback = true; try { blockCache = DfsBlockCache.getInstance(); super.parse(receiving, resolving); if (isEmptyPack)
boolean rollback = true; try { blockCache = DfsBlockCache.getInstance(); super.parse(receiving, resolving); if (isEmptyPack)
newPackObj.add(pw.getObjectSet()); DfsBlockCache.getInstance().getOrCreate(pack, null); return pack;