aboutsummaryrefslogtreecommitdiff
path: root/db_test.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Add 'bolt bench'.Ben Johnson2014-04-181-36/+0
| | | | | | | | | | | | | | This commit adds a flexible benchmarking tool to the 'bolt' CLI. It allows the user to separately specify the write mode and read mode (e.g. sequential random, etc). It also allows the user to isolate profiling to either the read or the writes. Currently the bench tool only supports "seq" read and write modes. It also does not support streaming of Bolt counters yet. Fixes #95. /cc @snormore
* Return bucket from CreateBucket() functions.Ben Johnson2014-04-151-9/+16
| | | | | | | | | | | 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-54/+220
| | | | | | | This commit adds the ability to create buckets inside of other buckets. It also replaces the buckets page with a root bucket. Fixes #56.
* Add meta page checksums.Ben Johnson2014-04-021-1/+34
| | | | | | | | | | | | This commit adds checksums to the meta pages on every write. When the database loads, it verifies the checksums on the meta pages and returns an error if either one is corrupt. In the future, it should fallback to the previous meta page but for right now it just hard fails. This is at least preferable to opening the database and getting a random error or further corruption. Fixes #25.
* Add performance counters.Ben Johnson2014-04-021-49/+30
| | | | | | | | | | | | 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.
* Remove DB.Open() and only allow bolt.Open().Ben Johnson2014-03-311-71/+55
| | | | | | | Per @tv42's suggestion, this commit removes the ability to reopen an instance of DB. All open calls go through bolt.Open(). Fixes #103.
* Write freelist after each commit.Ben Johnson2014-03-311-6/+21
| | | | | 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".
* Add DB.Check().Ben Johnson2014-03-291-1/+22
|
* Fix bucket reclamation.Ben Johnson2014-03-251-5/+47
| | | | | | | | 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-21/+21
| | | | | | | | | | 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.
* Error refactoring.Ben Johnson2014-03-241-13/+14
| | | | Fixed up a few error issues and refactored out the Error type.
* Re-add tests for write failuresTommi Virtanen2014-03-241-0/+62
| | | | | | | | | | | | | 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
* Mark Do()/With() transaction as managed.Ben Johnson2014-03-231-0/+17
| | | | | | | | 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.
* Fix db.munmap() to return an error.Ben Johnson2014-03-211-114/+0
| | | | | | | Changes munmap to return an error and the DB now implements io.Closer. I also removed all the OS and Syscall mocking because it's causing issues. Corrupt file tests need to be recreated but directly using the file system instead.
* Remove ease-of-use functions from the DB type.Ben Johnson2014-03-211-76/+35
| | | | | | | | | 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.
* Consolidate Tx and RWTx.Ben Johnson2014-03-081-13/+33
|
* Rename Transaction to Tx.Ben Johnson2014-03-081-11/+11
| | | | | I changed the Transaction/RWTransaction types to Tx/RWTx, respectively. This makes the naming more consistent with other packages such as database/sql. The txnid is changed to txid as well.
* Add benchmarks.Ben Johnson2014-03-041-0/+25
|
* Minor refactor.Ben Johnson2014-02-281-0/+7
|
* Add bolt.Open().Ben Johnson2014-02-261-0/+21
| | | | | | Per the suggestion of @tv42 and @cespare, this commit adds a package level function to create and initialize a database at a given path. This is a common interface for database packages.
* Refactor Bucket.Ben Johnson2014-02-231-93/+14
|
* Revert "Refactor Transaction/Bucket API."Ben Johnson2014-02-221-31/+10
| | | | This reverts commit 1ad2b99f281d587b767b36f886401e81d17915a9.
* Refactor Transaction/Bucket API.Ben Johnson2014-02-211-10/+31
|
* Add DB.Stat().Ben Johnson2014-02-211-0/+46
|
* Add Transaction.ForEach().Ben Johnson2014-02-161-0/+67
|
* Rename errors.Ben Johnson2014-02-161-9/+9
|
* Improve test coverage.Ben Johnson2014-02-151-8/+59
|
* Add parallel usage test and race detector.Ben Johnson2014-02-151-0/+7
|
* Add transactional blocks.Ben Johnson2014-02-151-0/+18
|
* Add examples.Ben Johnson2014-02-141-4/+15
|
* API Documentation.Ben Johnson2014-02-131-1/+1
|
* Mmap remap.Ben Johnson2014-02-121-0/+12
|
* Add freelist.Ben Johnson2014-02-101-0/+20
|
* Fix quick tests.Ben Johnson2014-02-051-38/+0
|
* Add RWTransaction.Delete().Ben Johnson2014-02-031-0/+14
|
* Add RWTransaction.Put().Ben Johnson2014-02-011-23/+51
|
* Clean up API.Ben Johnson2014-01-311-3/+3
|
* Fix leaf/branch deserialization.Ben Johnson2014-01-301-1/+0
|
* Refactor meta.copy() and page.init().Ben Johnson2014-01-291-5/+11
|
* Add tpage.put() test.Ben Johnson2014-01-281-1/+0
|
* Clean up test suite.Ben Johnson2014-01-281-49/+14
|
* lpageBen Johnson2014-01-271-25/+4
|
* Begin Transaction.Cursor().Ben Johnson2014-01-131-0/+46
|
* Finish open coverage.Ben Johnson2014-01-131-15/+135
|
* Mock syscall.Ben Johnson2014-01-121-0/+14
|
* Mock OS and File.Ben Johnson2014-01-121-0/+41
|
* Initial db.open.Ben Johnson2014-01-111-0/+27