aboutsummaryrefslogtreecommitdiff
path: root/tx_test.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Update cursor benchmark.Ben Johnson2014-04-041-15/+19
|
* Add Tx.OnCommit() handler.Ben Johnson2014-04-041-0/+28
| | | | | This commit adds the ability to execute a function after a transaction has successfully committed.
* Add performance counters.Ben Johnson2014-04-021-2/+0
| | | | | | | | | | | | This commit adds performance counters for each transaction which are rolled up to the database level on each commit/rollback. Counters are meant to be a very fast way to track what is going on in the database. A few timers are also added in areas where the time.Now() overhead is not noticible. The DB.Stat() function is now deprecated since the `bolt` CLI now performs similar functions. Fixes #108.
* Write freelist after each commit.Ben Johnson2014-03-311-1/+1
| | | | | Well, this is embarassing. Somehow the freelist was never getting written after each commit. This commit fixes that and fixes a small reporting issue with "bolt pages".
* Fix bucket reclamation.Ben Johnson2014-03-251-1/+1
| | | | | | | | The bucket page is allocated separately from the rest of the pages but the old bucket pages were not being added to the freelist. This change fixes that and adds a simple check for database consistency. More advanced consistency checks can be added in the future. Fixes #82.
* Make DB/Tx API more consistent.Ben Johnson2014-03-241-46/+46
| | | | | | | | | | I consolidated the DB.Tx() and DB.RWTx() calls into a single DB.Begin(writable bool) call. This is more consistent with the database/sql library. I also changed the DB.Do() and DB.With() call to DB.Update() and DB.View(), respectively. This is more intuitive and more inline with other database verbiage.
* Add ErrTxClosed error.Ben Johnson2014-03-231-0/+45
| | | | | | | | Commit/Rollback and mutable calls on Tx and Bucket now return ErrTxClosed if the transaction has already been committed or rolled back. Non-mutable calls have added an assertion to check if the transaction is closed which will cause a panic. I don't want to introduce an error return for accessor methods that are being used improperly so I think the panic is appropriate.
* Remove ease-of-use functions from the DB type.Ben Johnson2014-03-211-83/+138
| | | | | | | | | Functions such as DB.Put(), DB.Get(), and DB.Delete() were originally added to be easy to use, however, after implementing Bolt in multiple projects I have found these ease-of-use functions useless. Nearly every use case requires multiple calls in a single transaction. Using the DB ease of use functions turned out to be an antipattern.
* Skip long-running tests with go test -shortTommi Virtanen2014-03-131-0/+8
|
* Fix Cursor.Last() on empty buckets.Ben Johnson2014-03-131-6/+21
| | | | | | | | @tv42 reported that creating a cursor on an empty bucket and then calling Cursor.Last() causes an index out of range error and panics. This commit adds a check for the page's item count being greater than zero. Fixes #63.
* Consolidate Tx and RWTx.Ben Johnson2014-03-081-0/+437