aboutsummaryrefslogtreecommitdiff
path: root/tx.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add strict mode.Ben Johnson2014-05-141-0/+92
|
* Refactor split/spill.Ben Johnson2014-05-031-2/+5
|
* Add Tx.Cursor().Ben Johnson2014-04-291-0/+8
| | | | | | | This commit adds the Cursor() function to Tx. This allows iteration on the root bucket in a similar way to iteration on other buckets. Fixes #141.
* Return bucket from CreateBucket() functions.Ben Johnson2014-04-151-2/+2
| | | | | | | | | | | This commit changes the API for: Tx.CreateBucket() Tx.CreateBucketIfNotExists() Bucket.CreateBucket() Bucket.CreateBucketIfNotExists() These functions now return the *Bucket and error instead of just the error.
* Add nested buckets.Ben Johnson2014-04-111-253/+41
| | | | | | | This commit adds the ability to create buckets inside of other buckets. It also replaces the buckets page with a root bucket. Fixes #56.
* Rename internal local Tx variables.Ben Johnson2014-04-041-144/+144
| | | | | | This commit changes the local Tx variables from "t" to "tx". This is partly for consistency with external documentation but also because it just annoys me for some reason.
* Add Tx.OnCommit() handler.Ben Johnson2014-04-041-12/+30
| | | | | This commit adds the ability to execute a function after a transaction has successfully committed.
* Add performance counters.Ben Johnson2014-04-021-1/+100
| | | | | | | | | | | | 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.
* Consolidate file and metafile descriptors.Ben Johnson2014-04-021-1/+4
| | | | | | | Previously, a two file descriptors were used for the database: file & metafile. The "file" file descriptor was used for async writes while the "metafile" file descriptor was used with O_SYNC writes. This commit changes that so that there's only one file descriptor and it uses fdatasync() to synchronize writes.
* Write freelist after each commit.Ben Johnson2014-03-311-0/+10
| | | | | 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-3/+4
| | | | | | | | 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.
* Error refactoring.Ben Johnson2014-03-241-0/+11
| | | | Fixed up a few error issues and refactored out the Error type.
* Re-add tests for write failuresTommi Virtanen2014-03-241-2/+2
| | | | | | | | | | | | | Commit d2173f5f0ecbf4ed93c768e975435b04df3186ec removed the complete os & syscall mocking layer as overly complex. This commit adds back the simplest possible thing: hooks to control the database file writes. Missing tests: TestDBOpenMetaFileError, TestDBMmapStatError. These are harder to test without more extensive mocking. Conflicts: db_test.go
* Check spill error in CommitTommi Virtanen2014-03-231-1/+3
|
* Check meta page write error in CommitTommi Virtanen2014-03-231-1/+3
|
* Add ErrTxClosed error.Ben Johnson2014-03-231-14/+20
| | | | | | | | 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.
* Mark Do()/With() transaction as managed.Ben Johnson2014-03-231-1/+7
| | | | | | | | Transaction created from Do() and With() are now considered "managed". Managed transactions cannot be manually committed or rolled back since the Do() and With() functions provide that functionally automatically. Previously, a Tx could be manually committed and then any changes after that would be lost.
* Call fdatasync/fsync after writing out non-meta pagesTommi Virtanen2014-03-221-0/+3
| | | | | | This avoids a case where writes can be reordered so meta page is written before a page it refers to, potentially causing a corrupt database after a power loss or kernel crash.
* Add 'bolt pages'.Ben Johnson2014-03-211-0/+27
|
* Fix Tx.Buckets() sort order.Ben Johnson2014-03-131-0/+1
| | | | | @tv42 reported an issue with bucket names returning incorrectly. Not sure if this fixes the issue but it is necessary anyway.
* Consolidate Tx and RWTx.Ben Johnson2014-03-081-0/+421