104 Commits

Author SHA1 Message Date
Ben Johnson
d1b21e619d Merge branch 'master' of https://github.com/boltdb/bolt into fix-deletion
Conflicts:
	node.go
2014-05-09 09:38:08 -06:00
Ben Johnson
a5cb717fc7 Fix deletion reclamation. 2014-05-09 09:26:34 -06:00
Martin Kobetic
d279ea44ce add asserts for detecting pgid high watermark overflow 2014-05-09 13:35:00 +00:00
Ben Johnson
d52d142275 Minor fixes. 2014-05-07 12:06:22 -06:00
Ben Johnson
e99a24eb44 Improve bucket code documentation. 2014-05-07 11:23:30 -06:00
Ben Johnson
0966dde0d4 Fix bucket free. 2014-05-07 10:37:50 -06:00
Ben Johnson
55e71b0902 Add inline bucket support.
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.
2014-05-05 16:39:55 -06:00
Ben Johnson
c3903d38a1 Consolidate code for clarity.
This commit consolidates some of the smaller files into some of the larger files.
The smaller files cluttered the file tree and made it harder to see the logical
groupings of structs.
2014-05-05 07:56:54 -06:00
Ben Johnson
25fea2fd9f Refactor split/spill. 2014-05-03 16:21:28 -06:00
Ben Johnson
e3ed193646 Copy key on Put() and CreateBucket().
This commit makes a copy of the key byte slice before inserting into the database.
This fixes the issue where users may reuse byte buffers which can corrupt the database.

Fixes #143.
2014-04-29 06:54:01 -06:00
Ben Johnson
0567eea5f5 Change to BucketStats and Bucket.Stats().
This commit pluralizes the BucketStat type to be BucketStats. This makes it
more consistent with the other Stats() calls. This commit also changes the
return type to a struct instead of a pointer.

Finally, this commit adds documentation to the fields of BucketStats.
2014-04-22 15:11:49 -06:00
Martin Kobetic
a02ddf402b rename MaxDepth to Depth 2014-04-22 20:32:09 +00:00
Martin Kobetic
4245fd9c4e allign naming with MemStats 2014-04-22 20:22:18 +00:00
Martin Kobetic
62592ec840 moar tweaks 2014-04-22 20:18:09 +00:00
Martin Kobetic
382ccc2746 add Used/Free Leaf/Branch bucket stats 2014-04-22 18:22:42 +00:00
Steven Normore
b178373351 build c/cursor and running tests 2014-04-16 13:29:52 +00:00
Ben Johnson
2505b9a7dc Return bucket from CreateBucket() functions.
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.
2014-04-15 23:45:06 -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
686b6a3341 Add performance counters.
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.
2014-04-02 16:03:03 -06:00
Ben Johnson
59fde2f664 Error refactoring.
Fixed up a few error issues and refactored out the Error type.
2014-03-24 08:31:15 -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
binz
540d94614d fix 32bit build fails: bucket.go#67 2014-03-23 13:54:51 +08:00
Ben Johnson
1c7b59a4c2 Merge pull request #65 from benbjohnson/fix-tx-buckets-sort-order
Fix Tx.Buckets() sort order.
2014-03-21 08:45:34 -06:00
Ben Johnson
26afa92faf Fix Bucket.ForEach() comment. 2014-03-15 09:14:20 -06:00
Ben Johnson
62cf02e21a Fix Tx.Buckets() sort order.
@tv42 reported an issue with bucket names returning incorrectly. Not sure if
this fixes the issue but it is necessary anyway.
2014-03-13 15:08:59 -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
a544249dd8 Refactor Bucket. 2014-02-23 08:32:53 -07:00
Ben Johnson
3b2fd8f2d3 Revert "Refactor Transaction/Bucket API."
This reverts commit 1ad2b99f281d587b767b36f886401e81d17915a9.
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
1028d571d8 Bucket stats. 2014-02-21 09:20:45 -07:00
Ben Johnson
7fb06feea4 Add parallel usage test and race detector. 2014-02-15 21:50:34 -07:00
Ben Johnson
e68bc0b453 Add bucket sequence. 2014-02-15 10:23:00 -07:00
Ben Johnson
8ad59edd02 API Documentation. 2014-02-13 10:58:27 -07:00
Ben Johnson
509e93dff4 Add freelist. 2014-02-10 14:04:01 -07:00
Ben Johnson
9ebfc171b3 Clean up. 2014-02-09 14:23:22 -07:00
Ben Johnson
84939c21f6 Refactor node lookup. 2014-02-07 15:03:29 -07:00
Ben Johnson
1a17a2cf1e Add RWTransaction.Put(). 2014-02-01 12:30:37 -05:00
Ben Johnson
a901cf6a25 Clean up API. 2014-01-31 12:22:58 -05:00
Ben Johnson
26f6fefead Add RWTransaction.write(). 2014-01-30 22:20:50 -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
4ad445aa85 Add freelist page type. 2014-01-29 22:50:29 -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
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