Actors
The following actors are available globally.
-
An actor-based implementation of a B-Tree index for managing and organizing data.
BTreeIndexis a generic class that supports keys conforming to bothComparableandCodableprotocols. It provides thread-safe operations for indexing and retrieving data in a concurrent environment.See moreNote
This implementation leverages Swift’s
actormodel to ensure data consistency and thread safety.Declaration
Swift
public actor BTreeIndex<Key> where Key : Comparable, Key : Decodable, Key : EncodableParameters
KeyThe type of the keys used in the B-Tree. Keys must conform to
Comparablefor ordering andCodablefor serialization. -
An actor responsible for managing indices in a database system.
IndexManagerprovides functionality to handle the creation, storage, and metrics of indices for efficient data retrieval. It is generic over aKeytype that conforms to bothIndexKeyandComparableprotocols, ensuring that the keys used in the indices are suitable for indexing and comparison.Note
This actor is designed to be thread-safe, leveraging Swift’s actor model to protect its internal state from concurrent access.Properties:
indices: A dictionary mapping index names (String) to their correspondingBTreeIndexinstances, which store the actual index data.createdIndexes: A set of index names (String) that have been created, ensuring uniqueness and preventing duplication.metrics: A dictionary mapping index names (String) to their associatedIndexMetrics, which provide performance and usage statistics for each index.
Declaration
Swift
public actor IndexManager<Key> where Key : IndexKey, Key : Comparable -
An actor responsible for managing and processing statistical data within the database. The
See moreStatsEngineinteracts with the underlying storage engine to perform its operations.Declaration
Swift
public actor StatsEngine -
The
StorageEngineactor is responsible for managing the core storage functionality of the database. It handles the configuration, partitioning, and management of collections, shards, and indexes.Properties:
baseURL: The base URL where the storage engine operates.compressionMethod: The method used for compressing stored data.fileProtectionType: The type of file protection applied to stored data.collectionPartitionKeys: A dictionary mapping collection names to their partition keys.activeShardManagers: A dictionary of active shard managers, keyed by collection name.indexManagers: A dictionary of index managers, keyed by collection name.statsEngine: A lazily initialized instance ofStatsEnginefor gathering storage statistics.
Declaration
Swift
public actor StorageEngine
View on GitHub
Actors Reference