aboutsummaryrefslogtreecommitdiff
path: root/db.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Rename internal local Tx variables.Ben Johnson2014-04-041-4/+4
| | | | | | 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.
* Add meta page checksums.Ben Johnson2014-04-021-1/+1
| | | | | | | | | | | | This commit adds checksums to the meta pages on every write. When the database loads, it verifies the checksums on the meta pages and returns an error if either one is corrupt. In the future, it should fallback to the previous meta page but for right now it just hard fails. This is at least preferable to opening the database and getting a random error or further corruption. Fixes #25.
* Add performance counters.Ben Johnson2014-04-021-44/+23
| | | | | | | | | | | | 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.
* Add advisory file locking.Ben Johnson2014-04-021-0/+12
| | | | | | | This commit adds advisory locking via flock() to the database file. This ensures that two separate processes cannot both open the same data file which would cause corruption. Fixes #110.
* Consolidate file and metafile descriptors.Ben Johnson2014-04-021-17/+6
| | | | | | | Previously, a two file descriptors were used for the database: file & metafile. The "file" file descriptor was used for async writes while the "metafile" file descriptor was used with O_SYNC writes. This commit changes that so that there's only one file descriptor and it uses fdatasync() to synchronize writes.
* Remove DB.Open() and only allow bolt.Open().Ben Johnson2014-03-311-25/+15
| | | | | | | Per @tv42's suggestion, this commit removes the ability to reopen an instance of DB. All open calls go through bolt.Open(). Fixes #103.
* Write freelist after each commit.Ben Johnson2014-03-311-2/+10
| | | | | 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".
* Add DB.Check().Ben Johnson2014-03-291-0/+57
|
* Fix DB.Copy() meta lock and partial write checks.Ben Johnson2014-03-261-1/+12
|
* Make DB/Tx API more consistent.Ben Johnson2014-03-241-18/+26
| | | | | | | | | | 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.
* Error refactoring.Ben Johnson2014-03-241-7/+18
| | | | Fixed up a few error issues and refactored out the Error type.
* Re-add tests for write failuresTommi Virtanen2014-03-241-1/+14
| | | | | | | | | | | | | Commit d2173f5f0ecbf4ed93c768e975435b04df3186ec removed the complete os & syscall mocking layer as overly complex. This commit adds back the simplest possible thing: hooks to control the database file writes. Missing tests: TestDBOpenMetaFileError, TestDBMmapStatError. These are harder to test without more extensive mocking. Conflicts: db_test.go
* Resolve remaining errcheck warnings.Ben Johnson2014-03-241-10/+23
|
* Check errors from file close in DB.CopyFileTommi Virtanen2014-03-231-1/+5
| | | | | | | | 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.
* Mark Do()/With() transaction as managed.Ben Johnson2014-03-231-4/+19
| | | | | | | | 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.
* Fix db.munmap() to return an error.Ben Johnson2014-03-211-26/+36
| | | | | | | 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.
* Remove ease-of-use functions from the DB type.Ben Johnson2014-03-211-129/+0
| | | | | | | | | 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.
* Consolidate Tx and RWTx.Ben Johnson2014-03-081-24/+22
|
* Rename Transaction to Tx.Ben Johnson2014-03-081-57/+57
| | | | | 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.
* Ignore multiple transaction commit/rollback/close.Ben Johnson2014-03-011-1/+1
|
* Allow reads of unflushed nodes.Ben Johnson2014-03-011-2/+3
| | | | | This commit allows cursors to read updated values from within the RWTransaction.
* Fix the mmap resize to use the correct size.Ben Johnson2014-02-271-1/+1
| | | | | | 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.
* Refactor Bucket.Ben Johnson2014-02-231-5/+40
|
* Revert "Refactor Transaction/Bucket API."Ben Johnson2014-02-221-74/+40
| | | | This reverts commit 1ad2b99f281d587b767b36f886401e81d17915a9.
* Refactor Transaction/Bucket API.Ben Johnson2014-02-211-40/+74
|
* Add DB.Stat().Ben Johnson2014-02-211-0/+51
|
* Read-only transactional block.Ben Johnson2014-02-161-4/+14
|
* Add Transaction.ForEach().Ben Johnson2014-02-161-0/+11
|
* Add CreateBucketIfNotExists().Ben Johnson2014-02-161-0/+8
|
* Rename errors.Ben Johnson2014-02-161-4/+4
|
* Add Stringer support.Ben Johnson2014-02-161-0/+11
|
* Improve test coverage.Ben Johnson2014-02-151-16/+1
|
* Fix DB.opened flag.Ben Johnson2014-02-151-0/+2
|
* Add parallel usage test and race detector.Ben Johnson2014-02-151-5/+1
|
* Add transactional blocks.Ben Johnson2014-02-151-50/+38
|
* Add bucket sequence.Ben Johnson2014-02-151-0/+19
|
* Add examples.Ben Johnson2014-02-141-7/+2
|
* API Documentation.Ben Johnson2014-02-131-16/+31
|
* Mmap remap.Ben Johnson2014-02-121-11/+79
|
* Add freelist.Ben Johnson2014-02-101-14/+77
|
* Clean up.Ben Johnson2014-02-091-25/+10
|
* Rename sys ☞ buckets.Ben Johnson2014-02-051-2/+11
|
* Add RWTransaction.Put().Ben Johnson2014-02-011-5/+41
|
* Clean up API.Ben Johnson2014-01-311-8/+88
|
* Add RWTransaction.write().Ben Johnson2014-01-301-5/+9
|
* gofmtBen Johnson2014-01-301-1/+1
|
* Fix leaf/branch deserialization.Ben Johnson2014-01-301-5/+8
|
* Add freelist page type.Ben Johnson2014-01-291-1/+17
|
* Refactor meta.copy() and page.init().Ben Johnson2014-01-291-7/+16
|
* Add tpage.put() test.Ben Johnson2014-01-281-1/+1
|