|
|
|
@ -34,6 +34,15 @@ import org.eclipse.jgit.util.RefList;
|
|
|
|
|
* is garbage collected. Closing the repository has no impact on its memory. |
|
|
|
|
*/ |
|
|
|
|
public class InMemoryRepository extends DfsRepository { |
|
|
|
|
/** Builder for in-memory repositories. */ |
|
|
|
|
public static class Builder |
|
|
|
|
extends DfsRepositoryBuilder<Builder, InMemoryRepository> { |
|
|
|
|
@Override |
|
|
|
|
public InMemoryRepository build() throws IOException { |
|
|
|
|
return new InMemoryRepository(this); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static final AtomicInteger packId = new AtomicInteger(); |
|
|
|
|
|
|
|
|
|
private final DfsObjDatabase objdb; |
|
|
|
@ -48,13 +57,11 @@ public class InMemoryRepository extends DfsRepository {
|
|
|
|
|
* @since 2.0 |
|
|
|
|
*/ |
|
|
|
|
public InMemoryRepository(DfsRepositoryDescription repoDesc) { |
|
|
|
|
super(new DfsRepositoryBuilder<DfsRepositoryBuilder, InMemoryRepository>() { |
|
|
|
|
@Override |
|
|
|
|
public InMemoryRepository build() throws IOException { |
|
|
|
|
throw new UnsupportedOperationException(); |
|
|
|
|
this(new Builder().setRepositoryDescription(repoDesc)); |
|
|
|
|
} |
|
|
|
|
}.setRepositoryDescription(repoDesc)); |
|
|
|
|
|
|
|
|
|
private InMemoryRepository(Builder builder) { |
|
|
|
|
super(builder); |
|
|
|
|
objdb = new MemObjDatabase(this); |
|
|
|
|
refdb = new MemRefDatabase(); |
|
|
|
|
} |
|
|
|
|