FlyDB
FlyDB copied to clipboard
feat: Implement DataStructureManager and internal structures for vari…
This pull request introduces a unified data structure management system for the FlyDB project. It adds a DataStructureManager class to provide a single interface for managing multiple data structures, all sharing a single database instance. The changes also include the internal implementation of various data structure types that integrate with the shared database.
Unified Data Structure Management:
DataStructureManagerImplementation: Added a newDataStructureManagerclass instructure/manager.goto manage multiple data structures (e.g., strings, hashes, lists, sets, sorted sets, bitmaps, streams) through a single database instance. It supports operations like key deletion, expiration, TTL retrieval, and syncing data to disk.- Initialization of Data Structures: The
DataStructureManagerinitializes and provides access to internal implementations of supported data structures, ensuring they share the same database instance.
Internal Data Structure Implementations:
- Internal Structure Classes: Added internal implementations for
ListStructureInternal,SetStructureInternal,ZSetStructureInternal,BitmapStructureInternal,StreamStructureInternal, andExpiringKeyInternalinstructure/structures_internal.go. These classes are designed to work with the shared database instance. - Factory Methods: Each internal structure has a corresponding factory method (e.g.,
newListStructureInternal) to simplify their initialization with the shared database instance.