org.eclipse.jgit.storage.dht.spi
Interface ObjectIndexTable

All Known Implementing Classes:
CacheObjectIndexTable

public interface ObjectIndexTable

Associates an ObjectId to the ChunkKey its stored in.

This table provides a global index listing every single object within the repository, and which chunks the object can be found it. Readers use this table to find an object when they are forced to start from a bare SHA-1 that was input by a user, or supplied over the network from a client.


Method Summary
 void add(ObjectIndexKey objId, ObjectInfo info, WriteBuffer buffer)
          Record the fact that objId can be found by info.
 void get(Context options, java.util.Set<ObjectIndexKey> objects, AsyncCallback<java.util.Map<ObjectIndexKey,java.util.Collection<ObjectInfo>>> callback)
          Asynchronously locate one or more objects in the repository.
 void remove(ObjectIndexKey objId, ChunkKey chunk, WriteBuffer buffer)
          Remove a single chunk from an object.
 

Method Detail

get

void get(Context options,
         java.util.Set<ObjectIndexKey> objects,
         AsyncCallback<java.util.Map<ObjectIndexKey,java.util.Collection<ObjectInfo>>> callback)
Asynchronously locate one or more objects in the repository.

Callers are responsible for breaking up very large collections of objects into smaller units, based on the reader's batch size option. 1,000 to 10,000 is a reasonable range for the reader to batch on.

Parameters:
options - options to control reading.
objects - set of object names to locate the chunks of.
callback - receives the results when ready.

add

void add(ObjectIndexKey objId,
         ObjectInfo info,
         WriteBuffer buffer)
         throws DhtException
Record the fact that objId can be found by info.

If there is already data for objId in the table, this method should add the new chunk onto the existing data list.

This method should use batched asynchronous puts as much as possible. Initial imports of an existing repository may require millions of add operations to this table, one for each object being imported.

Parameters:
objId - the unique ObjectId.
info - a chunk that is known to store objId.
buffer - buffer to enqueue the put onto.
Throws:
DhtException - if the buffer flushed and an enqueued operation failed.

remove

void remove(ObjectIndexKey objId,
            ChunkKey chunk,
            WriteBuffer buffer)
            throws DhtException
Remove a single chunk from an object.

If this is the last remaining chunk for the object, the object should also be removed from the table. Removal can be deferred, or can occur immediately. That is, get() may return the object with an empty collection, but to prevent unlimited disk usage the database should eventually remove the object.

Parameters:
objId - the unique ObjectId.
chunk - the chunk that needs to be removed from this object.
buffer - buffer to enqueue the remove onto.
Throws:
DhtException - if the buffer flushed and an enqueued operation failed.


Copyright © 2011. All Rights Reserved.