diff options
Diffstat (limited to 'odb.h')
| -rw-r--r-- | odb.h | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -92,6 +92,7 @@ struct odb_source { struct packed_git; struct cached_object_entry; +struct odb_transaction; /* * The object database encapsulates access to objects in a repository. It @@ -103,6 +104,13 @@ struct object_database { struct repository *repo; /* + * State of current current object database transaction. Only one + * transaction may be pending at a time. Is NULL when no transaction is + * configured. + */ + struct odb_transaction *transaction; + + /* * Set of all object directories; the main directory is first (and * cannot be NULL after initialization). Subsequent directories are * alternates. @@ -186,6 +194,19 @@ struct object_database *odb_new(struct repository *repo); void odb_clear(struct object_database *o); /* + * Starts an ODB transaction. Subsequent objects are written to the transaction + * and not committed until odb_transaction_commit() is invoked on the + * transaction. If the ODB already has a pending transaction, NULL is returned. + */ +struct odb_transaction *odb_transaction_begin(struct object_database *odb); + +/* + * Commits an ODB transaction making the written objects visible. If the + * specified transaction is NULL, the function is a no-op. + */ +void odb_transaction_commit(struct odb_transaction *transaction); + +/* * Find source by its object directory path. Returns a `NULL` pointer in case * the source could not be found. */ |
