Skip to content

Context Transactions #39

@Charles-Johnson

Description

@Charles-Johnson

Instead of calling Context::execute which requires exclusive access to a Context to evaluate the command and update the underlying snapshot, a new method, Context::transaction can be defined that initialises a ContextTransaction that stores its own ContextDelta, variable scope and an immutable reference to the Context. Like execute, Context::transaction will take a &str for the command but only require &self. It will also return a ContextDelta as well as the String containing the output of the command, dropping the ContextTransaction internally.

The method, Context::commit could then be changed to take a ContextDelta and apply this to the ContextSnapshot.

This will allow commands to be "simulated" without commiting changes and also commands to be executed in parallel and committed after all commands have finished (although need to think about changing the structure of ContextDelta to detect conflicting changes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions