Archived

This forum has been archived. Please start a new discussion on GitHub.

Freeze-related questions

Hi,

I have some questions regarding Freeze:

1. It looks like there is a limitation on number of objects stored in Freeze::Map -
according to Freeze\Map.h source,
size_type max_size() const
    {
        return 0xffffffff; // TODO: is this the max?
    }
Why this number is used as a limit?
Does it mean that Freeze may be used as a limited persistent storage only?

2. How can we get the last member in Freeze::Map? The only way I can see is to iterate until end(); for map keeping millions objects it may take some time...

Comments

  • bernard
    bernard Jupiter, FL
    Hi Alex,

    The size of a Freeze map is only limited by the underlying Berkeley DB database, which can be very large: Database limits

    A better implementation of this size_max() function would return std::numeric_limits<std::size_t>::max() ... which is probably 0xFFFFFFFF on 32-bit platforms. I also suspect this function is very rarely used.
    2. How can we get the last member in Freeze::Map? The only way I can see is to iterate until end(); for map keeping millions objects it may take some time...

    Presumably you are defining your own sorting for your keys, otherwise "first" and "last" are not very meaningful.

    Currently, Freeze provides only forward iterators: you can reach the first element and iterate from there. You cannot "jump" to the last element, or iterate backwards. It is possible to add bi-directional iterators and reverse iterations to Freeze Maps; it's on our TODO list, just not very high priority at present.

    Best regards,
    Bernard
  • Bernard,

    Thanks for the reply.

    I do define my own sorting for keys => I'd like to have bidirectional/reverse iterators.
    For your estimation, when this feature may be added to Freeze::Map?
  • bernard
    bernard Jupiter, FL
    Hi Alex,

    I don't know when we'll add this feature. It depends on if/when a commercial customer needs it.

    All the best,
    Bernard