Compare commits
No commits in common. "8e784b59600c6f7a12c20a2cb19c1200e10ed6de" and "e816a13d41c0cb29a4f1c4e4e016cf4cce7898c2" have entirely different histories.
8e784b5960
...
e816a13d41
5 changed files with 10 additions and 62 deletions
|
|
@ -23,7 +23,7 @@
|
|||
(stage :accessor stage :initform :initial)
|
||||
(proc :accessor proc :initarg :proc :initform #'std-proc)
|
||||
(program :reader program :initarg :program :initform nil)
|
||||
(actions :accessor actions :initarg :actions :initform nil)
|
||||
(actions :reader actions :initarg :actions :initform nil)
|
||||
(syns :accessor syns :initform nil)
|
||||
(environ :reader environ :initarg :environ)))
|
||||
|
||||
|
|
@ -31,10 +31,7 @@
|
|||
(apply #'make-instance 'scope :program program args))
|
||||
|
||||
(defun reset-scope (scope &rest args)
|
||||
(apply #'scope (or (getf args :program) (program scope))
|
||||
:categ (or (getf args :categ) (categ scope))
|
||||
:environ (or (getf args :environ) (environ scope))
|
||||
args))
|
||||
(apply #'scope (program scope) :environ (environ scope) args))
|
||||
|
||||
;;;; neurons (= async tasks) and synapses (= connections)
|
||||
|
||||
|
|
@ -61,7 +58,8 @@
|
|||
(update nscope)))
|
||||
|
||||
(defun create (msg scope)
|
||||
(let ((new (neuron (apply #'reset scope (shape:data msg)))))
|
||||
;todo: use message data for modifying new scope
|
||||
(let ((new (neuron (reset scope))))
|
||||
(notify-created msg new scope)))
|
||||
|
||||
(defun do-log (msg scope)
|
||||
|
|
|
|||
|
|
@ -6,28 +6,15 @@
|
|||
(:csys :scopes/csys)
|
||||
(:message :scopes/core/message)
|
||||
)
|
||||
(:export #:forward #:forward-message)
|
||||
(:export #:send #:send-message)
|
||||
)
|
||||
|
||||
(in-package :scopes/csys/environ)
|
||||
|
||||
(defclass scope (csys:scope)
|
||||
(cells :reader cells :initarg :cells :initform (make-hash-table :test #'equal)))
|
||||
(defun send-message (head data &key customer)
|
||||
(send (message:create head :data data :customer customer)))
|
||||
|
||||
;;;; action handlers, public callables
|
||||
|
||||
(defun cell-created (msg scope))
|
||||
|
||||
(defun forward-message (head scope &key data customer)
|
||||
(forward (message:create head :data data :customer customer) scope))
|
||||
|
||||
(defun forward (msg scope)
|
||||
(dolist (cell (find-cells (cells scope) (message:addr msg)))
|
||||
(actor:send cell msg)))
|
||||
|
||||
;;;; helpers
|
||||
|
||||
(defun register-cell (reg addr cell))
|
||||
|
||||
(defun find-cells (reg addr))
|
||||
(defun send (msg)
|
||||
(dolist (sn (find-sensors msg))
|
||||
(actor:send sn msg)))
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
(:file "util/util")
|
||||
(:file "util/async" :depends-on ("util/util"))
|
||||
(:file "util/crypt" :depends-on ("util/util"))
|
||||
(:file "util/index")
|
||||
(:file "util/iter")
|
||||
(:file "testing" :depends-on ("util/util")))
|
||||
:long-description "scopes/core: The core packages of the scopes project."
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
(:config :scopes/config)
|
||||
(:core :scopes/core)
|
||||
(:crypt :scopes/util/crypt)
|
||||
(:index :scopes/util/index)
|
||||
(:iter :scopes/util/iter)
|
||||
(:logging :scopes/logging)
|
||||
(:message :scopes/core/message)
|
||||
|
|
@ -67,7 +66,6 @@
|
|||
(progn
|
||||
(test-util)
|
||||
(test-util-crypt)
|
||||
(test-util-index)
|
||||
(test-util-iter)
|
||||
(test-shape)
|
||||
(core:setup-services)
|
||||
|
|
@ -118,15 +116,6 @@
|
|||
(== (iter:next it) nil)
|
||||
(== (string (iter:value it)) "A")))
|
||||
|
||||
(deftest test-util-index ()
|
||||
(let ((idx (index:create)))
|
||||
(index:put idx "1-1" 42)
|
||||
(index:put idx "1-2" 46)
|
||||
(index:put idx "1-1" 43)
|
||||
(== (index:query idx "1-1") '(43 42))
|
||||
(== (index:query idx "1-2") '(46))
|
||||
))
|
||||
|
||||
(deftest test-shape ()
|
||||
(let ((rec (make-instance 'shape:record :head '(:t1))))
|
||||
(== (shape:head rec) '(:t1 nil))
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
;;;; cl-scopes/util/index
|
||||
|
||||
;;;; smart string-based indexes e.g. for queryable registries
|
||||
|
||||
(defpackage :scopes/util/index
|
||||
(:use :common-lisp)
|
||||
(:export #:create #:put #:query))
|
||||
|
||||
(in-package :scopes/util/index)
|
||||
|
||||
(defclass index ()
|
||||
((data :reader data :initform (make-hash-table :test #'equal))))
|
||||
|
||||
(defun create ()
|
||||
(make-instance 'index))
|
||||
|
||||
(defgeneric put (idx key value)
|
||||
(:method ((idx index) key value)
|
||||
(let* ((data (data idx))
|
||||
(cur (gethash key data)))
|
||||
(setf (gethash key data) (cons value cur)))))
|
||||
|
||||
(defgeneric query (idx key)
|
||||
(:method ((idx index) key)
|
||||
(gethash key (data idx))))
|
||||
Loading…
Add table
Reference in a new issue