Multiple changes.
- Provide a method to reopen the database environment if closed. - Add #keys, which returns an array of keys for the current collection. - Finish collection/namespace implementation. - Add various aliases (collection->namespace, etc) - Add #clear, which destroys data for a the current collection. If called in the main db, destroys all. Don't close the environment after a #clear, just the dbi handle. - Various bugfixes. FossilOrigin-Name: 8b00d59e8c5269266f3c6c0d10056a1c0fe1bb583ffbe099a6ed0dac3baf3a66
This commit is contained in:
parent
d92ba7c5eb
commit
5ed44e52fa
6 changed files with 194 additions and 47 deletions
|
|
@ -9,7 +9,6 @@ require 'mdbx' unless defined?( MDBX )
|
|||
#
|
||||
class MDBX::Database
|
||||
|
||||
|
||||
### Open an existing (or create a new) mdbx database at filesystem
|
||||
### +path+. In block form, the database is automatically closed.
|
||||
###
|
||||
|
|
@ -40,6 +39,7 @@ class MDBX::Database
|
|||
# Only instantiate Database objects via #open.
|
||||
private_class_method :new
|
||||
|
||||
|
||||
# The options used to instantiate this database.
|
||||
attr_reader :options
|
||||
|
||||
|
|
@ -52,5 +52,17 @@ class MDBX::Database
|
|||
# A Proc for automatically deserializing values.
|
||||
attr_accessor :deserializer
|
||||
|
||||
|
||||
# Allow for some common nomenclature.
|
||||
alias_method :namespace, :collection
|
||||
alias_method :reopen, :open
|
||||
|
||||
|
||||
### Switch to the top-level collection.
|
||||
###
|
||||
def main
|
||||
return self.collection( nil )
|
||||
end
|
||||
|
||||
end # class MDBX::Database
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue