markmv - v1.26.2
    Preparing search index...

    Class TransactionManager

    Manages atomic file operations with full rollback capability.

    Provides transactional semantics for file system operations, ensuring that either all operations complete successfully or all changes are rolled back. Supports automatic backups and retry logic.

    Transactional file operations

    const transaction = new TransactionManager({
    createBackups: true,
    continueOnError: false
    });

    // Add operations to the transaction
    transaction.addFileMove('old.md', 'new.md');
    transaction.addContentUpdate('target.md', newContent);

    try {
    const result = await transaction.execute();
    if (result.success) {
    console.log('All operations completed successfully');
    } else {
    console.log('Transaction failed, all changes rolled back');
    }
    } catch (error) {
    console.error('Transaction error:', error);
    }
    Index

    Constructors

    Methods

    • Add a file move operation to the transaction

      Parameters

      • sourcePath: string
      • destinationPath: string
      • Optionaldescription: string

      Returns void

    • Add a content update operation to the transaction

      Parameters

      • filePath: string
      • newContent: string
      • Optionaldescription: string

      Returns void

    • Add a file creation operation to the transaction

      Parameters

      • filePath: string
      • content: string
      • Optionaldescription: string

      Returns void

    • Add a file deletion operation to the transaction

      Parameters

      • filePath: string
      • Optionaldescription: string

      Returns void

    • Execute all steps in the transaction

      Returns Promise<
          {
              success: boolean;
              completedSteps: number;
              errors: string[];
              changes: OperationChange[];
          },
      >

    • Get a preview of all planned operations

      Returns { description: string; type: string }[]