iondbproject / iondb

IonDB, a key-value datastore for resource constrained systems.
BSD 3-Clause "New" or "Revised" License
587 stars 48 forks source link

Cursor next record struct - refactor consideration #5

Closed iondbproject closed 8 years ago

iondbproject commented 8 years ago

Currently, cursor->next expects a record struct to be passed in, which it populates with a record retrieved from the dictionary. This is cumbersome to the user, as they are expected to manually malloc the members of the struct. This also requires knowledge of how to retrieve the key and value size from within the dictionary.

Example:

        ion_record_t record;
        record.key      = (ion_key_t) malloc(dict.instance->record.key_size);
        record.value    = (ion_value_t) malloc(dict.instance->record.value_size);

        while(cursor->next(cursor, &record) != cs_end_of_results);

Proposal: Possible remove the need for the record struct, or develop a helper method to build the record for the user, or any other idea that might be a better option.

Stickerpants commented 8 years ago

Issue moved to internal task tracker.