Actors

The following actors are available globally.

  • The root entry point for the NyaruDB embedded document database.

    NyaruDB is an actor that serialises all file I/O through Swift’s concurrency model. It manages the lifecycle of collections, handles manifest I/O, and coordinates durability across all open collections.

    Opening a database. Provide a directory URL or filesystem path:

    let db = try await NyaruDB(path: "path/to/database")
    

    Opening collections. Use collection(_:of:options:) to open or create a typed collection:

    let users = try await db.collection("users", of: User.self)
    

    Lifecycle. Call sync() to flush pending index and shard I/O, and close() to shut down cleanly. After close(), the instance cannot be used again.

    Note

    A single NyaruDB instance corresponds to one directory on disk. Opening multiple instances pointing at the same directory is not supported.
    See more

    Declaration

    Swift

    public actor NyaruDB