@@ -3,7 +3,7 @@ use std::ptr;
3
3
4
4
use crate :: mdb:: error:: mdb_result;
5
5
use crate :: mdb:: ffi;
6
- use crate :: { Env , Result } ;
6
+ use crate :: { Database , Env , PolyDatabase , Result } ;
7
7
8
8
/// A read-only transaction.
9
9
pub struct RoTxn < ' e > {
@@ -30,6 +30,21 @@ impl<'e> RoTxn<'e> {
30
30
pub ( crate ) fn env_mut_ptr ( & self ) -> * mut ffi:: MDB_env {
31
31
self . env . env_mut_ptr ( )
32
32
}
33
+
34
+ pub fn open_database < ' t , KC , DC > (
35
+ & self ,
36
+ name : Option < & str > ,
37
+ ) -> Result < Option < Database < ' t , KC , DC > > >
38
+ where
39
+ KC : ' static ,
40
+ DC : ' static ,
41
+ {
42
+ todo ! ( "get the dbi from the env without any call to LMDB" )
43
+ }
44
+
45
+ pub fn open_poly_database < ' t > ( & self , name : Option < & str > ) -> Result < Option < PolyDatabase < ' t > > > {
46
+ todo ! ( "get the dbi from the env without any call to LMDB" )
47
+ }
33
48
}
34
49
35
50
impl Drop for RoTxn < ' _ > {
@@ -76,6 +91,33 @@ impl<'p> RwTxn<'p> {
76
91
self . txn . env . env_mut_ptr ( )
77
92
}
78
93
94
+ pub fn open_database < ' t , KC , DC > (
95
+ & self ,
96
+ name : Option < & str > ,
97
+ ) -> Result < Option < Database < ' t , KC , DC > > >
98
+ where
99
+ KC : ' static ,
100
+ DC : ' static ,
101
+ {
102
+ todo ! ( "call mdb_dbi_open and store the new type in the env" )
103
+ }
104
+
105
+ pub fn open_poly_database < ' t > ( & self , name : Option < & str > ) -> Result < Option < PolyDatabase < ' t > > > {
106
+ todo ! ( "call mdb_dbi_open and store the new type in the env" )
107
+ }
108
+
109
+ pub fn create_database < ' t , KC , DC > ( & self , name : Option < & str > ) -> Result < Database < ' t , KC , DC > >
110
+ where
111
+ KC : ' static ,
112
+ DC : ' static ,
113
+ {
114
+ todo ! ( "call mdb_dbi_open(create) and store the new type in the env" )
115
+ }
116
+
117
+ pub fn create_poly_database < ' t > ( & self , name : Option < & str > ) -> Result < PolyDatabase < ' t > > {
118
+ todo ! ( "call mdb_dbi_open(create) and store the new type in the env" )
119
+ }
120
+
79
121
pub fn commit ( mut self ) -> Result < ( ) > {
80
122
let result = unsafe { mdb_result ( ffi:: mdb_txn_commit ( self . txn . txn ) ) } ;
81
123
self . txn . txn = ptr:: null_mut ( ) ;
0 commit comments