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 both Comparable and Codable 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.

    See more

    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 and Codable 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 a Key type that conforms to both IndexKey and Comparable 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 corresponding BTreeIndex 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 associated IndexMetrics, which provide performance and usage statistics for each index.
    See more

    Declaration

    Swift

    public actor IndexManager<Key> where Key : IndexKey, Key : Comparable
  • An actor responsible for managing and processing statistical data within the database. The StatsEngine interacts with the underlying storage engine to perform its operations.

    See more

    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 of StatsEngine for gathering storage statistics.
    See more

    Declaration

    Swift

    public actor StorageEngine