speedb-io / speedb

A RocksDB compliant high performance scalable embedded key-value store
https://www.speedb.io/
Apache License 2.0
898 stars 67 forks source link

Enable SpeeDB Feature: Constrain the interface of SharedOptions #740

Closed udi-speedb closed 10 months ago

udi-speedb commented 10 months ago

The SharedOptions class currently allows modifications that are not controlled, and may cause inconsistencies. It provides great flexibility, but is inherently unsafe. For example, a user may change the size of the cache without an associated required change in the pinning policy capacity.

Until we provide safe and consistent interfaces to allow that flexibility, we will constrain the interface of SharedOptions. The result will be an immutable SharedOptions but one that is safe and easy to use correctly.

mrambacher commented 10 months ago

The example of changing the cache size can be accomplished without using SharedOptions. Given a Cache, I can call SetCapacity() and change its size and the PinningPolicy will be none the wiser. That issue (of associating a PinningPolicy with the Cache) should be raised separately and is independent of SharedOptions (the same could be said of thread counts and Env).