aboutsummaryrefslogtreecommitdiff
path: root/tx_test.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Move code to src/ and tests/EuAndreh2024-10-251-716/+0
|
* use tx.meta during Tx.WriteTo()Ben Johnson2016-03-101-1/+1
| | | | | | | | | | This commit changes `Tx.WriteTo()` to use the transaction's in-memory meta page instead of copying from the disk. This is needed because the transaction uses the size from its meta page but writes the current meta page on disk which may have allocated additional pages since the transaction started. Fixes #513
* *: fix test print formatGyu-Ho Lee2016-01-081-2/+2
|
* test suite refactoringBen Johnson2016-01-021-236/+496
| | | | | | | | | This commit refactors the test suite to make it cleaner and to use the standard testing library better. The `assert()`, `equals()`, and `ok()` functions have been removed and some test names have been changed for clarity. No functionality has been changed.
* tx_test: add tests for two tx.ForEach casesMatt Layher2015-05-121-0/+32
|
* Remove testify.Ben Johnson2014-07-261-52/+51
|
* Move tests to a test package.Ben Johnson2014-07-261-58/+49
|
* Remove wrapping test closures.Ben Johnson2014-07-261-213/+215
|
* Add Open() options, flock timeout.Ben Johnson2014-06-211-4/+4
| | | | | | | | This commit changes Open() to provide an additional Options argument. The options argument currently only has a Timeout which will cause the Open() to return ErrTimeout if a file lock cannot be obtained in time. Fixes #207.
* Add freelist assertion on every free().Ben Johnson2014-05-291-25/+0
| | | | This commit performs a check on the freelist pages to ensure that a double free can never happen.
* Do not attempt manual transaction rollback in Tx.CopyTommi Virtanen2014-05-281-0/+51
| | | | | | | The typical use these days is with a managed transaction, via db.View. The first case (error when re-opening database file) is not tested; it is harder to instrument, and I have other plans for it.
* Add streaming check.Ben Johnson2014-05-281-1/+1
| | | | | This commit changes Tx.Check() to return a channel through which check errors are returned. This allows errors to be found before checking the entire data file.
* Merge pull request #169 from benbjohnson/allocationBen Johnson2014-05-211-1/+1
|\ | | | | Fix freelist allocation direction.
| * Fix freelist allocate().Ben Johnson2014-05-191-1/+1
| |
* | move Copy and CopyFile from DB to TxMartin Kobetic2014-05-211-0/+58
|/
* Add strict mode.Ben Johnson2014-05-141-0/+25
|
* Add inline bucket support.Ben Johnson2014-05-051-1/+1
| | | | | | | | | | | | | | | This commit adds support for writing small buckets directly inline to their value in their parent's leaf node. Previously, subbuckets would simply have a bucket header stored in their parent bucket which pointed to the root page. This required that every bucket use at least a single page. This has a high overhead for buckets with only one or two small items. Inline buckets checks subbuckets to see if they only have a small amount of data (about 1kb) and no subbuckets. If these conditions are met then the bucket's root node is written to a fake page which is simply a pointer to the end of the bucket's header. Fixes #124.
* Add Tx.Cursor().Ben Johnson2014-04-291-0/+25
| | | | | | | 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.
* Printf's %s and %q do the right thing with []byte; removed string conversion.Kevin Gillette2014-04-251-1/+1
|
* Add 'bolt bench'.Ben Johnson2014-04-181-208/+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
* move bench package to bench/cmd/bolt/benchSteven Normore2014-04-181-96/+96
|
* add bench sub-packageSteven Normore2014-04-181-46/+35
|
* add benchmarks using Benchmark frameworkSteven Normore2014-04-181-41/+117
|
* moar bench packageSteven Normore2014-04-181-0/+41
|
* Return bucket from CreateBucket() functions.Ben Johnson2014-04-151-15/+44
| | | | | | | | | | | 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.
* Merge branch 'master' into nested-keysBen Johnson2014-04-111-15/+35
|\ | | | | | | | | | | Conflicts: db_test.go tx_test.go
| * make all benchmarks constant size and add multiple sizesMartin Kobetic2014-04-081-15/+35
| |
* | Add nested buckets.Ben Johnson2014-04-111-326/+87
|/ | | | | | | This commit adds the ability to create buckets inside of other buckets. It also replaces the buckets page with a root bucket. Fixes #56.
* 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