{"repo":"aergoio/litetree","free":true,"listed":false,"github":"https://github.com/aergoio/litetree","clone":"git clone https://github.com/aergoio/litetree.git","description":"SQLite with Branches","language":"C","stars":1637,"topics":["database","sqlite3","aergo"],"license":"MIT","category":"databases-storage","readme_excerpt":"LiteTree: SQLite with Branches Imagine being able to have many connections to the same database, each one reading a separate branch or commit at the same time. Or even writing to separate branches. This is possible with LiteTree . It is a modification of the SQLite engine to support branching, like git! Database branching is a very useful tool for blockchain implementations and LiteTree will be at the core of Aergo. This is how it works: Each database transaction is saved as a commit, and each commit has an incremental number. Let's consider an empty db in which we run this first SQL command: Now it will have the first commit (number 1) in the automatically created master branch: When we execute new transactions it will add new commits to the current branch: Now we have 3 commits: To include many SQL commands in a single commit we must enclose them in BEGIN and COMMIT commands. We create new branches informing the source branch and commit number: After this command is executed the new branch is created but without any new data added to it. The database connection also moves to this new branch, having it as the current branch. We can check the current branch with the command: In this case it will return: test If we execute a SQL command on this db connection the commit will be saved in the connection's current branch: Now the graph state will be: We can also read the database at this new branch: It will return these values: first from test branch We can move to the master bran","default_branch":null,"files":null,"tree":[],"storefront":"/r/aergoio","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/aergoio/litetree/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}