
* [NOD-863] Write TestCursorNext. * [NOD-863] Write TestCursorFirst. * [NOD-863] Fix merge errors. * [NOD-863] Add TestCursorSeek. * [NOD-863] Add TestCursorCloseErrors. * [NOD-863] Add TestCursorCloseFirstAndNext. * [NOD-863] Add TestDataAccessorPut. * [NOD-863] Add TestDataAccessorGet. * [NOD-863] Add TestDataAccessorHas. * [NOD-863] Add TestDatabaseDelete. * [NOD-863] Add TestDatabaseAppendToStoreAndRetrieveFromStore. * [NOD-863] Add TestTransactionAppendToStoreAndRetrieveFromStore. * [NOD-863] Add TestTransactionDelete. * [NOD-863] Add TestTransactionHas. * [NOD-863] Add TestTransactionGet. * [NOD-863] Add TestTransactionPut. * [NOD-863] Move cursor tests to the bottom of interface_test.go. * [NOD-863] Move interface_test.go to a database_test package. * [NOD-863] Make each test in interface_test.go run for every database driver. Currently, only ffldb. * [NOD-863] Make each cursor test in interface_test.go run for every database driver. Currently, only ffldb. * [NOD-863] Split interface_test.go into separate files. * [NOD-863] Rename interface_test.go to common_test.go. * [NOD-863] Extract testForAllDatabaseTypes to a separate function. * [NOD-863] Reorganize how test data gets added to the database. * [NOD-863] Add explanations about testForAllDatabaseTypes. * [NOD-863] Add tests that make sure that database changes don't affect previously opened transactions. * [NOD-863] Extract databasePrepareFunc to a type alias. * [NOD-863] Fix comments. * [NOD-863] Add cursor exhaustion test to testCursorFirst. * [NOD-863] Add cursor Next clause to testCursorSeek. * [NOD-863] Add additional varification to testDatabasePut. * [NOD-863] Add an additional verification into to testTransactionGet. * [NOD-863] Add TestTransactionCommit. * [NOD-863] Add TestTransactionRollback. * [NOD-863] Add TestTransactionRollbackUnlessClosed. * [NOD-863] Remove equals sign from databasePrepareFunc declaration.
database
Package database provides a database for kaspad.
Overview
This package provides a database layer to store and retrieve data in a simple and efficient manner.
The current backend is ffldb, which makes use of leveldb, flat files, and strict checksums in key areas to ensure data integrity.
Implementors of additional backends are required to implement the following interfaces:
DataAccessor
This defines the common interface by which data gets accessed in a generic kaspad database. Both the Database and the Transaction interfaces (see below) implement it.
Database
This defines the interface of a database that can begin transactions and close itself.
Transaction
This defines the interface of a generic kaspad database transaction.
Note: Transactions provide data consistency over the state of the database as it was when the transaction started. There is NO guarantee that if one puts data into the transaction then it will be available to get within the same transaction.
Cursor
This iterates over database entries given some bucket.