Class ObjectDatabase
An object database stores the objects (commit, trees, blobs, tags, etc) for a repository.
Inherited Members
Namespace: Dogged
Assembly: Dogged.dll
Syntax
public class ObjectDatabase : NativeDisposable
Constructors
| Improve this Doc View SourceObjectDatabase()
Declaration
public ObjectDatabase()
Methods
| Improve this Doc View SourceAddBackend(ObjectDatabaseBackend, Int32)
Add a custom backend to an existing object database.
The backends are checked in relative ordering, based on the value of the `priority` parameter.
Declaration
public void AddBackend(ObjectDatabaseBackend backend, int priority)
Parameters
Type | Name | Description |
---|---|---|
ObjectDatabaseBackend | backend | The object database backend to add |
System.Int32 | priority | Value for ordering the backends queue |
ForEachObject(Func<ObjectId, Boolean>)
Iterate over each object in the database, calling the given action for each. Return true from the action to continue iterating; return false to stop.
Declaration
public void ForEachObject(Func<ObjectId, bool> action)
Parameters
Type | Name | Description |
---|---|---|
Func<ObjectId, System.Boolean> | action | The action to invoke |
Read(ObjectId)
Read a git object directly from the database.
Declaration
public ObjectDatabaseObject Read(ObjectId id)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | id | The object ID to read |
Returns
Type | Description |
---|---|
ObjectDatabaseObject |
ReadHeader(ObjectId)
Read the metadata describing a git object. If the actual object contents are not needed this may be more performant than reading the entire object, depending on the object database backend.
Declaration
public (long size, ObjectType type) ReadHeader(ObjectId id)
Parameters
Type | Name | Description |
---|---|---|
ObjectId | id | The object ID to lookup |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Int64, ObjectType> | An OdbObjectHeader on success |
Exceptions
Type | Condition |
---|---|
NotFoundException | Thrown when the object is not found in the database |
Write(Byte[], ObjectType)
Write an object directly into the object database.
Declaration
public ObjectId Write(byte[] data, ObjectType type)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | |
ObjectType | type | The type of object to write |
Returns
Type | Description |
---|---|
ObjectId | The id of the object written to the database |