yung 1 nedēļu atpakaļ
vecāks
revīzija
02c5d0f703
2 mainītis faili ar 67 papildinājumiem un 1 dzēšanām
  1. 2 1
      .gitignore
  2. 65 0
      src/actorBase.ts

+ 2 - 1
.gitignore

@@ -1,4 +1,5 @@
 node_modules
 .dist
 *.js
-*.map.js
+*.map.js
+*.desktop.ini

+ 65 - 0
src/actorBase.ts

@@ -0,0 +1,65 @@
+import { Observer, Subject, Subscribable, Unsubscribable } from "rxjs"
+/* --------------------------------------------
+Fis actor to declare its own subscribable but extended from RXJS
+*/
+interface ActorService { 
+/*  Stateful actor service to be instantiated by concrete class.
+    To add in behaviour and model state repository */
+}
+
+interface ActorContext<T> { 
+/*  Environment within which actor operates. Provided by creator in 
+    constructor */
+    defaultSubscribers: FisActor<T>[]
+}
+
+interface ActorServiceContext { 
+/* environment within which the actor service operates */
+}
+
+// Please note members of an interface are ALWAYS PUBLIC.
+interface FisActor<T> extends Subscribable<T> {
+    subscribe(observer: Partial<Observer<T>>): Unsubscribable
+}
+
+export abstract class FisActorBaseImpl<T> implements FisActor<T> {
+    protected actorId!: String
+    /* autogenerate a GUID value upon creation */
+
+    protected actorName: String | null = null
+    protected incomingBus!: Subscribable<T>
+    protected outgoingBus!: Subscribable<T>
+    protected actorService!: ActorService
+    protected actorContext!: ActorContext<T>
+    protected actorServiceContext!: ActorServiceContext
+    
+
+    constructor(actorContext: ActorContext<T>) {
+        // logic here
+    }
+
+    public subscribe(observer: Partial<Observer<T>>): Unsubscribable {
+        /* to subscribe from output bus for now 
+        */
+
+        throw new Error("Method to be defined....")
+    }
+
+}
+
+interface Actor<T> extends Subscribable<T> {
+    actorId: String
+    actorName: String
+    actorStream: Subscribable<T>
+}
+
+abstract class Sample<T> implements Actor<T> {
+    actorId!: String
+    actorName!: String
+    actorStream!: Subscribable<T>
+
+    subscribe(observer: Partial<Observer<T>>): Unsubscribable {
+        throw new Error("Method not implemented.")
+    }
+
+}