static ReftableConfig configureReftable(ReftableConfig cfg, DfsOutputStream out) { int bs = out.blockSize(); if (bs > 0) { cfg = new ReftableConfig(cfg); cfg.setRefBlockSize(bs); cfg.setAlignBlocks(true); } return cfg; }
@Override public ReftableConfig getReftableConfig() { ReftableConfig cfg = new ReftableConfig(); cfg.setAlignBlocks(false); cfg.setIndexObjects(false); cfg.fromConfig(getRepository().getConfig()); return cfg; }
/** * References to convert into a reftable * * @param refs * references to convert into a reftable; may be empty. * @return a reader for the supplied references. */ public static Reftable from(Collection<Ref> refs) { try { ReftableConfig cfg = new ReftableConfig(); cfg.setIndexObjects(false); cfg.setAlignBlocks(false); ByteArrayOutputStream buf = new ByteArrayOutputStream(); new ReftableWriter() .setConfig(cfg) .begin(buf) .sortAndWriteRefs(refs) .finish(); return new ReftableReader(BlockSource.from(buf.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); } }
static ReftableConfig configureReftable(ReftableConfig cfg, DfsOutputStream out) { int bs = out.blockSize(); if (bs > 0) { cfg = new ReftableConfig(cfg); cfg.setRefBlockSize(bs); cfg.setAlignBlocks(true); } return cfg; }
@Override public ReftableConfig getReftableConfig() { ReftableConfig cfg = new ReftableConfig(); cfg.setAlignBlocks(false); cfg.setIndexObjects(false); cfg.fromConfig(getRepository().getConfig()); return cfg; }
/** * References to convert into a reftable * * @param refs * references to convert into a reftable; may be empty. * @return a reader for the supplied references. */ public static Reftable from(Collection<Ref> refs) { try { ReftableConfig cfg = new ReftableConfig(); cfg.setIndexObjects(false); cfg.setAlignBlocks(false); ByteArrayOutputStream buf = new ByteArrayOutputStream(); new ReftableWriter() .setConfig(cfg) .begin(buf) .sortAndWriteRefs(refs) .finish(); return new ReftableReader(BlockSource.from(buf.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); } }