206 Commits

Author SHA1 Message Date
Ben Johnson
3c1ecb925e Resolve remaining errcheck warnings. 2014-03-24 07:38:27 -06:00
Tommi Virtanen
e0a6f5b2af Check errors from file close in DB.CopyFile
Write errors are often delayed and reported only by the close.

The extra close in defer on success is harmless, (*os.File).Close
protects itself against multiple closes, and this way it's immediately
obvious there is no code path that would leak open files.
2014-03-23 13:27:37 -07: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
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
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
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
3a1b152562 Ignore multiple transaction commit/rollback/close. 2014-03-01 12:53:05 -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
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
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
9827df70e0 Add DB.Stat(). 2014-02-21 09:49:15 -07:00
Ben Johnson
459b8eb4ab Read-only transactional block. 2014-02-16 15:43:35 -07:00
Ben Johnson
b22480fd32 Add Transaction.ForEach(). 2014-02-16 13:59:07 -07:00
Ben Johnson
63e8e474d7 Add CreateBucketIfNotExists(). 2014-02-16 12:36:37 -07:00
Ben Johnson
149afc8c9b Rename errors. 2014-02-16 12:18:44 -07:00
Ben Johnson
6a7be8879b Add Stringer support. 2014-02-16 12:11:10 -07:00
Ben Johnson
d1952237ed Improve test coverage. 2014-02-15 23:45:17 -07:00
Ben Johnson
72b799480f Fix DB.opened flag. 2014-02-15 22:34:21 -07:00
Ben Johnson
7fb06feea4 Add parallel usage test and race detector. 2014-02-15 21:50:34 -07:00
Ben Johnson
56b825fb56 Add transactional blocks. 2014-02-15 14:54:45 -07:00
Ben Johnson
e68bc0b453 Add bucket sequence. 2014-02-15 10:23:00 -07:00
Ben Johnson
0ebef9c0bb Add examples. 2014-02-14 08:34:04 -07:00
Ben Johnson
8ad59edd02 API Documentation. 2014-02-13 10:58:27 -07:00
Ben Johnson
7bb878ff69 Mmap remap. 2014-02-12 11:49:57 -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
0ed3dc3071 Rename sys ☞ buckets. 2014-02-05 22:15:47 -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
4fc84daf2a Refactor meta.copy() and page.init(). 2014-01-29 22:35:58 -05:00
Ben Johnson
a942c1d168 Add tpage.put() test. 2014-01-28 15:16:22 -05:00
Ben Johnson
044d7b7893 Clean up test suite. 2014-01-28 14:52:09 -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
f1d7fe5b08 Finish open coverage. 2014-01-13 08:25:56 -07:00
Ben Johnson
47224c4387 Mock syscall. 2014-01-12 15:50:35 -07:00