Skip to content

[ALL] A better implementation of rolling back in precommit function #16

@rotaki

Description

@rotaki

Implement rollback in the pre-commit phase using Resource Acquisition Is Initialization (RAII) might be better to avoid redundant code.

    struct Rollback {
        Rollback(MVTO<Index>* self) : self(self) {}

        ~Rollback() {
            if (succeeded) return;
            self->remove_already_inserted()
            self->unlock_write_set()
        }

        void set_unnecessary() {
            succeeded = true;
        }

        void set_position() {

        }

        MVTO<Index>* self;
        bool succeeded = false;
        
    };

Define this object in precommit to automatically roll back changes if necessary.

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