Skip to content

We can't write the entries of one database into another #189

Open
@Kerollmops

Description

@Kerollmops

Currently, heed is too restrictive on the write transactions and do not permit certain basic operations like writing the content of one database into another as the example shows below.

According to the documentation, write transactions were designed to support this kind of operations on the same database too.
Which means that the following example could even work with the same database.

It would, therefore, be possible for heed replace the places where we use &mut RwTxn with, a less restrictive, &RwTxn.

let mut wtxn = env.write_txn()?;
for result in database1.iter(&wtxn)? {
    let (k, v) = result?;
    database2.put(&mut wtxn, k, v)?; // can't compile &mut and & of the same RwTxn used at the same time
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeedbackA feedback from a user

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions