963 Commits

Author SHA1 Message Date
Ben Johnson
42bc0f210a Merge pull request #81 from benbjohnson/tx-closed
Add ErrTxClosed error.
2014-03-23 12:24:32 -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
8303617b72 Merge pull request #78 from benbjohnson/tx-managed
Mark Do()/With() transaction as managed.
2014-03-23 11:52:10 -06:00
Ben Johnson
76f6ead6b0 Mark Do()/With() transaction as managed.
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.
2014-03-23 10:34:53 -06:00
Ben Johnson
1282a4aff7 Merge pull request #76 from benbjohnson/fsync
fdatasync
2014-03-23 10:01:58 -06:00
Ben Johnson
a10ce47f54 Consolidate syscall files. 2014-03-23 08:59:45 -07:00
Ben Johnson
fd8a13e837 Merge branch 'fdatasync' of https://github.com/tv42/bolt into fsync 2014-03-23 09:42:21 -06:00
Ben Johnson
f0e582d910 Merge pull request #75 from Slacken/32bit_build_fails_bucket_go_67
Fix 32bit build
2014-03-23 09:37:27 -06:00
binz
540d94614d fix 32bit build fails: bucket.go#67 2014-03-23 13:54:51 +08:00
Tommi Virtanen
5ce378b046 Call fdatasync/fsync after writing out non-meta pages
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.
2014-03-22 20:47:08 -07:00
Ben Johnson
6d6303a0a2 Merge pull request #74 from benbjohnson/cli
CLI
2014-03-22 14:12:00 -06:00
Ben Johnson
4f4e15e6dd Fix print. 2014-03-21 23:07:46 -06:00
Ben Johnson
845a4d47ce Add 'bolt buckets'. 2014-03-21 22:56:17 -06:00
Ben Johnson
64a52452d3 Add 'bolt set'. 2014-03-21 22:51:22 -06:00
Ben Johnson
0e4d77d424 Add 'bolt pages'. 2014-03-21 22:34:54 -06:00
Ben Johnson
8fa6531b1c Add 'bolt keys'. 2014-03-21 22:05:28 -06:00
Ben Johnson
e8d3ae6287 Add 'bolt get'. 2014-03-21 22:00:34 -06:00
Ben Johnson
e86296ede7 Merge pull request #71 from benbjohnson/munmap-fix
Fix db.munmap() to return an error.
2014-03-21 13:32:40 -06:00
Ben Johnson
d2173f5f0e Fix db.munmap() to return an error.
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.
2014-03-21 13:21:33 -06:00
Ben Johnson
2eea5766ae Merge pull request #68 from benbjohnson/remove-db-functions
Remove ease-of-use functions from the DB type.
2014-03-21 10:21:47 -06:00
Ben Johnson
3cc959fb1a Remove ease-of-use functions from the DB type.
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.
2014-03-21 09:52:01 -06: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
60fd6f6604 Merge pull request #66 from tv42/testing-short
Skip long-running tests with go test -short
2014-03-13 17:14:21 -07:00
Tommi Virtanen
ed909b43ea Skip long-running tests with go test -short 2014-03-13 17:10:33 -07: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
fdd7f2162e Merge pull request #64 from benbjohnson/fix-empty-cursor-last
Fix Cursor.Last() on empty buckets.
2014-03-13 13:51:43 -07: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
b9b69d867a README 2014-03-10 15:03:26 -07:00
Ben Johnson
4e252b8a7f Merge pull request #61 from benbjohnson/merge-tx
Consolidate Tx and RWTx
2014-03-08 19:45:56 -08:00
Ben Johnson
a32d0c5c5f Merge pull request #60 from benbjohnson/tx
Rename Transaction to Tx.
2014-03-08 19:44:10 -08: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
64fcacedfa Add benchmarks. 2014-03-04 13:23:46 -07:00
Ben Johnson
3a1b152562 Ignore multiple transaction commit/rollback/close. 2014-03-01 12:53:05 -07:00
Ben Johnson
7214e089c0 Merge pull request #57 from benbjohnson/node-aware-cursors
Allow reads of unflushed nodes.
2014-03-01 09:21:11 -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
1eb9e09028 Merge branch 'master' of https://github.com/boltdb/bolt 2014-03-01 07:51:45 -07:00
Ben Johnson
956453b69f Minor refactor. 2014-02-28 15:13:07 -07:00
Ben Johnson
9abba5dfa2 Merge pull request #55 from benbjohnson/fix-mmap-resize
Fix the mmap resize to use the correct size.
2014-02-27 14:37:11 -07:00
Ben Johnson
0477c1e0ce Fix the mmap resize to use the correct size.
Fixes #54. Previously the DB was calculating a minimum mmap size but
using the wrong variable after it calculated the size. This commit
changes the DB to use the correct variable.
2014-02-27 14:33:31 -07:00
Ben Johnson
9abced434f Add bucket reclamation.
After RWTransaction.DeleteBucket() is called, all pages related to the
bucket are moved to the freelist for that transaction.
2014-02-27 11:55:44 -07:00
Ben Johnson
0209ad2ed4 Merge pull request #53 from benbjohnson/open-api
Add bolt.Open()
2014-02-26 16:37:22 -07:00
Ben Johnson
a47c50295a Add bolt.Open().
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.
2014-02-26 16:32:40 -07:00
Ben Johnson
41fb285e37 Remove RWTransaction.Bucket().
Add an reference to the RWTransaction onto Transaction so that calls to
Transaction.Bucket() and Transaction.Buckets() return writable buckets
when attached to a writabe transaction.
2014-02-25 08:31:04 -07:00
Ben Johnson
488785df09 Merge pull request #51 from benbjohnson/bucket-refactor
Refactor Bucket
2014-02-23 11:10:48 -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
7f2fe0e1ed Merge pull request #50 from benbjohnson/api
Refactor Transaction/Bucket API
2014-02-21 23:09:24 -07:00
Ben Johnson
1ad2b99f28 Refactor Transaction/Bucket API. 2014-02-21 22:57:50 -07:00