Commit Graph

50 Commits (f0cf3bfd5b5fe259fea19d5d6a2f8805e9b419e2)

Author SHA1 Message Date
Luke Champine 852d3024fa skip empty pages during cursor seek
This commit fixes an issue where keys are skipped by cursors after
deletions occur in a bucket. This occurred because the cursor seeks
to the leaf page but does not check if it is empty.

Fixes #429, #450
2015-11-05 22:39:15 -07:00
Ben Johnson 112f143631 Document key/value safety.
This commit adds safety documentation to the data accessor functions
in Bolt as well as the README. This was documented once in the package
level godoc but it's important enough that it should be more clear.
2015-03-24 11:06:28 -06:00
Ben Johnson b4d00c394a Expand assertion statements.
This commit expands calls to _assert() that use variadic arguments. These calls require conversion to interface{} so there
was a large number of calls to Go's internal convT2E() function. In some profiling this was taking over 20% of total runtime.
I don't remember seeing this before Go 1.4 so perhaps something has changed.
2015-01-30 14:15:49 -05:00
Ben Johnson 74489c7516 Clarify cursor behavior after mutation. 2014-11-27 17:18:05 -07:00
Martin Kobetic a00a88baef add Cursor.Delete() 2014-06-11 21:46:19 +00:00
Ben Johnson 511ecba69b Refactor Cursor.Next() to use Cursor.next(). 2014-06-09 12:37:07 -06:00
Ben Johnson 6ddb056698 Fix last element seek.
This commit fixes a bug with seeks where seeking to a key between the end
of a page and the beginning of the next page causes it to return nil. This
was fixed by calling Cursor.next() when the cursor ends up between pages.

This also changes Cursor.Next() so that calling Next() at the end of a bucket
leaves the cursor at the end instead of zeroing out the stack.

Fixes #186.

/cc @PreetamJinka
2014-06-09 11:07:25 -06:00
Ben Johnson 782ead0dbf Fix freelist allocation direction.
This commit fixes the freelist so that it frees from the beginning of the data file
instead of the end. It also adds a fast path for pages which can be allocated from
the first free pages and it includes read transaction stats.
2014-05-19 12:08:33 -06:00
Ben Johnson 0966dde0d4 Fix bucket free. 2014-05-07 10:37:50 -06:00
Tommi Virtanen eaa47b6468 Document cursors seeing nested buckets 2014-05-04 18:32:59 -07:00
Tommi Virtanen 458400eb82 Cursor.Seek validity is indicated by key being nil 2014-05-04 18:30:30 -07:00
Ben Johnson 25fea2fd9f Refactor split/spill. 2014-05-03 16:21:28 -06:00
Ben Johnson 63a8cddd2b Add Cursor.Bucket() function.
This commit adds an accessor to the Cursor type to retrieve the Bucket that
it was created from.
2014-04-16 09:38:53 -04:00
Ben Johnson 698b07b074 Add nested buckets.
This commit adds the ability to create buckets inside of other buckets.
It also replaces the buckets page with a root bucket.

Fixes #56.
2014-04-11 12:36:54 -06:00
Ben Johnson 12204df0b5 Rename internal local Tx variables.
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.
2014-04-04 12:03:04 -06:00
Ben Johnson 482f00fdfc Add ErrTxClosed error.
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.
2014-03-23 12:20:16 -06:00
Ben Johnson 4132080333 Fix Cursor.Last() on empty buckets.
@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.
2014-03-13 14:39:28 -06:00
Ben Johnson c551e45a47 Consolidate Tx and RWTx. 2014-03-08 20:40:48 -07:00
Ben Johnson 57376f0905 Rename Transaction to Tx.
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.
2014-03-08 17:04:02 -07:00
Ben Johnson a1f43f4d60 Allow reads of unflushed nodes.
This commit allows cursors to read updated values from within the
RWTransaction.
2014-03-01 09:13:59 -07:00
Ben Johnson 956453b69f Minor refactor. 2014-02-28 15:13:07 -07:00
Ben Johnson 3b2fd8f2d3 Revert "Refactor Transaction/Bucket API."
This reverts commit 1ad2b99f28.
2014-02-22 22:54:54 -07:00
Ben Johnson 1ad2b99f28 Refactor Transaction/Bucket API. 2014-02-21 22:57:50 -07:00
Ben Johnson 15e0eae829 Bidirectional cursors. 2014-02-20 13:53:40 -07:00
Tommi Virtanen 8438c6ebc3 Cursor.Get is now Cursor.Seek, and returns the first possible key.
This makes range and prefix queries possible.

Closes: #44
2014-02-20 11:33:28 -08:00
Ben Johnson 2d1f21a40d Fix Cursor godoc for First(), Next(), and Get(). 2014-02-20 11:04:46 -07:00
Ben Johnson d1952237ed Improve test coverage. 2014-02-15 23:45:17 -07:00
Ben Johnson 8ad59edd02 API Documentation. 2014-02-13 10:58:27 -07:00
Ben Johnson b8122bf568 Cursor iteration. 2014-02-11 09:07:07 -07:00
Ben Johnson 509e93dff4 Add freelist. 2014-02-10 14:04:01 -07:00
Ben Johnson 3da04c52b9 Rebalance after deletion. 2014-02-08 23:13:54 -07:00
Ben Johnson 84939c21f6 Refactor node lookup. 2014-02-07 15:03:29 -07:00
Ben Johnson 8b3b81ef47 Fix quick tests. 2014-02-05 07:56:13 -07:00
Ben Johnson 1a17a2cf1e Add RWTransaction.Put(). 2014-02-01 12:30:37 -05:00
Ben Johnson 8d5757e9dd gofmt 2014-01-30 17:04:56 -05:00
Ben Johnson 149d48fb9e Fix leaf/branch deserialization. 2014-01-30 00:11:46 -05:00
Ben Johnson 4fc84daf2a Refactor meta.copy() and page.init(). 2014-01-29 22:35:58 -05:00
Ben Johnson ef590ecdfb lpage 2014-01-27 22:22:37 -05:00
Ben Johnson 192649f453 Intermediate. 2014-01-27 10:11:54 -05:00
Ben Johnson 1baa6d576a Initialize transaction/rwtransaction. 2014-01-26 15:29:06 -07:00
Ben Johnson 73ab1d420d TODO 2014-01-24 16:32:18 -07:00
Ben Johnson 20b26eac78 TODO 2014-01-24 12:51:56 -07:00
Ben Johnson bce3e667df Intermediate commit. 2014-01-21 15:00:48 -07:00
Ben Johnson 153372abd4 Refactoring to RWCursor, RWTxn, and branch/leaf nodes and pages. 2014-01-17 15:23:39 -07:00
Ben Johnson cec7b942e7 Add system buckets. 2014-01-14 13:01:02 -07:00
Ben Johnson 79d9b6bb5a Begin Transaction.Cursor(). 2014-01-13 10:35:04 -07:00
Ben Johnson ee24437bfc Initial db.open. 2014-01-11 22:51:01 -07:00
Ben Johnson df8333328f DB.Open(), pages, and meta. 2014-01-10 07:32:12 -07:00
Ben Johnson f922c1d2bc Move all C code into repo. 2014-01-09 09:07:10 -07:00
Ben Johnson ebc9f0da9e Basic types. 2014-01-08 08:06:17 -07:00