Skip to content

labteral/txlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

txlog

Crash-resistant Python code made easy

Usage

from txlog import TxLog, Call
self.txlog = TxLog('./txlog')

Script

def secure_function(a, b):
    print(f'{a}, {b}')
    
txlog.begin()
txlog.add(Call('secure_function', ['input1', 'input2']))
txlog.commit()

txlog.exec_uncommitted_calls()

Instance

class Instance:
  
  def __init__(self):
    txlog.begin()
    txlog.add(Call('secure_method', ['input1', 'input2']))
    txlog.commit()
    instance.txlog.exec_uncommitted_calls(self)

  def secure_method(self, a, b):
      print(f'{a}, {b}')

instance = Instance()