org.eclipse.jgit.storage.dht.spi.memory
Class MemoryDatabase

java.lang.Object
  extended by org.eclipse.jgit.storage.dht.spi.memory.MemoryDatabase
All Implemented Interfaces:
Database

public class MemoryDatabase
extends java.lang.Object
implements Database

Stores Git repositories in non-persistent JVM heap memory.

This database type is only suitable for unit testing, and other toy applications. All chunk data is held within the JVM heap as byte arrays, which is not the most efficient representation available.


Constructor Summary
MemoryDatabase()
          Initialize an empty database.
 
Method Summary
 ChunkTable chunk()
           
 WriteBuffer newWriteBuffer()
          Create a new WriteBuffer for the current thread.
 ObjectIndexTable objectIndex()
           
 DhtRepository open(java.lang.String name)
          Open a repository by name on this database.
 RefTable ref()
           
 RepositoryTable repository()
           
 RepositoryIndexTable repositoryIndex()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryDatabase

public MemoryDatabase()
Initialize an empty database.

Method Detail

open

public DhtRepository open(java.lang.String name)
                   throws java.io.IOException
Open a repository by name on this database.

Parameters:
name - the name of the repository.
Returns:
the repository instance. If the repository does not yet exist, the caller can use Repository.create(boolean) to create.
Throws:
java.io.IOException

repositoryIndex

public RepositoryIndexTable repositoryIndex()
Specified by:
repositoryIndex in interface Database
Returns:
a handle to the table listing known repositories.

repository

public RepositoryTable repository()
Specified by:
repository in interface Database
Returns:
a handle to the table storing repository metadata.

ref

public RefTable ref()
Specified by:
ref in interface Database
Returns:
a handle to the table listing references in a repository.

objectIndex

public ObjectIndexTable objectIndex()
Specified by:
objectIndex in interface Database
Returns:
a handle to the table listing known objects.

chunk

public ChunkTable chunk()
Specified by:
chunk in interface Database
Returns:
a handle to the table listing pack data chunks.

newWriteBuffer

public WriteBuffer newWriteBuffer()
Description copied from interface: Database
Create a new WriteBuffer for the current thread.

Unlike other methods on this interface, the returned buffer must be a new object on every invocation. Buffers do not need to be thread-safe.

Specified by:
newWriteBuffer in interface Database
Returns:
a new buffer to handle pending writes.


Copyright © 2011. All Rights Reserved.