Struct git_repository::EasyArcExclusive[][src]

pub struct EasyArcExclusive {
    pub repo: Arc<RwLock<Repository>>,
    pub state: State,
}
Expand description

A handle to a optionally mutable Repository for use in long-running applications that eventually need to update the Repository to adapt to changes they triggered or that were caused by other processes.

Using it incurs costs as each Repository access has to go through an indirection and involve an eventually fair RwLock. However, it’s vital to precisely updating the Repository instance as opposed to creating a new one while serving other requests on an old instance, which potentially duplicates the resource costs.

Limitation

  • It can take a long time to get a mutable repo….
    • Imagine a typical server operation where a pack is sent to a client. As it’s a fresh clone it takes 5 minutes. Right after the clone began somebody initiates a push. Everything goes well and as a new pack was created the server wants to tell the object database to update its packs, making the new one available. To do that, it needs mutable access to the repository instance, and obtaining it will take until the end of the ongoing clone as the latter has acquired read-access to the same repository instance. This is most certainly undesirable.
    • Workarounds would be to
      • acquire the read-lock each time the clone operation wants to access an object
      • set a flag that triggers the server to create a new Repository instance next time a connection comes in which is subsequently shared across additional connections.
      • Create a new Repository per connection.

Fields

repo: Arc<RwLock<Repository>>

The repository

state: State

The state with interior mutability

Trait Implementations

The type of a shared borrow to the Repository

The type of a mutable borrow to the Repository

Return a shared borrow to the repository. Read more

Returns a mutable borrow to the repository if possible. Read more

Return a shared borrow of the repository state, with support for interior mutability.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.