Actors
The following actors are available globally.
-
An actor-based implementation of a B-Tree index for managing and organizing data.
BTreeIndex
is a generic class that supports keys conforming to bothComparable
andCodable
protocols. It provides thread-safe operations for indexing and retrieving data in a concurrent environment.Note
This implementation leverages Swift’s
actor
model to ensure data consistency and thread safety.Declaration
Swift
public actor BTreeIndex<Key> where Key : Comparable, Key : Decodable, Key : Encodable
Parameters
Key
The type of the keys used in the B-Tree. Keys must conform to
Comparable
for ordering andCodable
for serialization. -
An actor responsible for managing indices in a database system.
IndexManager
provides functionality to handle the creation, storage, and metrics of indices for efficient data retrieval. It is generic over aKey
type that conforms to bothIndexKey
andComparable
protocols, 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 correspondingBTreeIndex
instances, 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 moreStatsEngine
interacts with the underlying storage engine to perform its operations.Declaration
Swift
public actor StatsEngine
-
The
StorageEngine
actor 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 ofStatsEngine
for gathering storage statistics.
Declaration
Swift
public actor StorageEngine