パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.2.0

isolate_agents

エージェントはバックグラウンドのアイソレート上に存在する状態です。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
81
いいね数
73
Pub ポイント
160

パッケージをインストール

flutter pub add isolate_agents

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

IsolateAgents は、バックグラウンドの isolate で実行される状態を持つエージェントを作成できる Dart パッケージです。メインスレッドをブロッキングせずに共有データに安全かつ並行してアクセスできます。メッセージ送信を介した isolate 基盤の状態管理のための明確な抽象を提供しており、長時間実行または計算量の多いタスクに最適です。このパッケージは、状態と通信を明確に定義された API を通じて分離することでスレッドセーフを保証します。リアルタイムデータ処理や複雑な計算が必要なアプリケーションにおいて特に有用です。

用途

  • バックグラウンドデータ処理
  • リアルタイム分析
  • 長時間実行の計算
  • 隔離領域間の状態管理
  • クロス・イソレート通信

主な機能

  • バックグラウンドの隔離領域で状態を実行する
  • スレッドセーフな状態管理
  • メッセージ送信 API
  • すべての主要プラットフォームをサポートしています
  • シンプルなエージェントライフサイクル制御

適している対象

  • メインスレッド以外で重い計算を必要とするアプリ
  • 並行処理にイソレートを使用する開発者
  • 隔離された状態の永続化を必要とするプロジェクト
  • スケーラブルなバックグラウンドサービスを構築するチーム
  • リアルタイムデータが必要なFlutterアプリ

注意事項

  • Dart isolate の理解が必要です
  • 隔離の作成による潜在的なオーバーヘッド
  • 隔離用のデバッグツールが限られている
  • 単純な状態のニーズには適していません
  • 隔離間メッセージのシリアライズを処理する必要があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Isolate Agents

Description

Isolate Agents adds a new class, Agent, which is a proper implementation of the Actor model for Dart. Where Isolates have no mechanism for communication, Agents do. It is inspired by Clojure's agents.

Example usage

import 'package:isolate_agents/isolate_agents.dart';

void main() async {
  Agent<int> agent = await Agent.create(() => 1);
  // The following add operation is executed in the Agent's isolate.
  agent.update((int x) => x + 1);
  assert(2 == await agent.exit());
}

Why?

After writing Dart code for a couple of years I realized I was writing the same code over and over again in order to be able to use Isolates. Isolates don't fully implement the Actor model so a handshake of SendPort and a protocol needs to be devised for each non-trivial usage of Isolates. Agents factor all that logic into a reusable package, eliminating the SendPort handshake and standardizing the protocol.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。