This is the chipi Reference Manual, version 0.4.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 04:35:25 2024 GMT+0.
chipi/chipi.asd
chipi/src/cron.lisp
chipi/src/cl-cron-overrides.lisp
chipi/src/timer.lisp
chipi/src/isys.lisp
chipi/src/env.lisp
chipi/src/binding-api.lisp
chipi/src/persistence-api.lisp
chipi/src/item.lisp
chipi/src/itemgroup.lisp
chipi/src/persistence-simple.lisp
chipi/src/persistence-influx.lisp
chipi/src/rule.lisp
chipi/src/persistence.lisp
chipi/src/bindings/base-binding.lisp
chipi/src/hab.lisp
The main system appears first, followed by any subsystem dependency.
chipi
Manfred Bergmann
Apache-2
0.4.0
alexandria
(system).
sento
(system)., at least version "3.3.0"
timer-wheel
(system).
cl-cron
(system).
yason
(system).
drakma
(system).
local-time
(system).
binding-arrows
(system).
parse-float
(system).
src
(module).
Modules are listed depth-first from the system components tree.
chipi/src
chipi
(system).
cron.lisp
(file).
cl-cron-overrides.lisp
(file).
timer.lisp
(file).
isys.lisp
(file).
env.lisp
(file).
binding-api.lisp
(file).
persistence-api.lisp
(file).
item.lisp
(file).
itemgroup.lisp
(file).
persistence-simple.lisp
(file).
persistence-influx.lisp
(file).
rule.lisp
(file).
persistence.lisp
(file).
bindings
(module).
hab.lisp
(file).
chipi/src/bindings
persistence.lisp
(file).
src
(module).
base-binding.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
chipi/chipi.asd
chipi/src/cron.lisp
chipi/src/cl-cron-overrides.lisp
chipi/src/timer.lisp
chipi/src/isys.lisp
chipi/src/env.lisp
chipi/src/binding-api.lisp
chipi/src/persistence-api.lisp
chipi/src/item.lisp
chipi/src/itemgroup.lisp
chipi/src/persistence-simple.lisp
chipi/src/persistence-influx.lisp
chipi/src/rule.lisp
chipi/src/persistence.lisp
chipi/src/bindings/base-binding.lisp
chipi/src/hab.lisp
chipi/src/cron.lisp
src
(module).
cancel-job
(function).
ensure-cron
(function).
make-cron-job
(function).
num-jobs
(function).
shutdown-cron
(function).
*cron*
(special variable).
chipi/src/timer.lisp
cl-cron-overrides.lisp
(file).
src
(module).
cancel
(function).
ensure-timer
(function).
schedule-once
(function).
schedule-recurring
(function).
shutdown-timer
(function).
*timer*
(special variable).
chipi/src/isys.lisp
timer.lisp
(file).
src
(module).
ensure-isys
(function).
shutdown-isys
(function).
*isys*
(special variable).
chipi/src/env.lisp
isys.lisp
(file).
src
(module).
ensure-env
(function).
ensure-runtime-dir
(function).
shutdown-env
(function).
*rel-runtime-dir*
(special variable).
chipi/src/binding-api.lisp
chipi/src/persistence-api.lisp
binding-api.lisp
(file).
src
(module).
days
(reader method).
(setf days)
(writer method).
hours
(reader method).
(setf hours)
(writer method).
initialize
(generic function).
make-persisted-item
(function).
minutes
(reader method).
(setf minutes)
(writer method).
persist
(generic function).
persisted-item
(structure).
persisted-item-timestamp
(reader).
(setf persisted-item-timestamp)
(writer).
persisted-item-value
(reader).
(setf persisted-item-value)
(writer).
persistence
(class).
range
(class).
relative-range
(class).
retrieve
(generic function).
retrieve-range
(generic function).
seconds
(reader method).
(setf seconds)
(writer method).
shutdown
(generic function).
copy-persisted-item
(function).
persisted-item-p
(function).
chipi/src/item.lisp
persistence-api.lisp
(file).
src
(module).
add-binding
(function).
add-persistence
(function).
destroy
(function).
false
(type).
false-p
(function).
get-item-stateq
(function).
get-value
(function).
item
(class).
item-changed-event
(structure).
item-changed-event-item
(reader).
(setf item-changed-event-item)
(writer).
item-state
(structure).
item-state-timestamp
(reader).
(setf item-state-timestamp)
(writer).
item-state-value
(reader).
(setf item-state-value)
(writer).
label
(reader method).
make-item
(function).
name
(function).
print-object
(method).
set-value
(function).
true
(type).
true-p
(function).
value-type-hint
(reader method).
%fetch-persisted-value
(function).
%filter-frequency
(function).
%item-receive
(function).
%parse-frequency
(function).
bindings
(reader method).
copy-item-changed-event
(function).
copy-item-persistence
(function).
copy-item-state
(function).
item-changed-event-p
(function).
item-persistence
(structure).
item-persistence-frequency
(reader).
(setf item-persistence-frequency)
(writer).
item-persistence-load-on-start
(reader).
(setf item-persistence-load-on-start)
(writer).
item-persistence-p
(function).
item-persistence-persp
(reader).
(setf item-persistence-persp)
(writer).
item-persistence-timer-sig
(reader).
(setf item-persistence-timer-sig)
(writer).
item-state-p
(function).
make-item-changed-event
(function).
make-item-persistence
(function).
make-item-state
(function).
persistences
(reader method).
chipi/src/itemgroup.lisp
item.lisp
(file).
src
(module).
add-item
(function).
get-item
(function).
get-items
(function).
get-value
(function).
itemgroup
(class).
label
(reader method).
make-itemgroup
(function).
name
(function).
remove-item
(function).
set-value
(function).
chipi/src/persistence-simple.lisp
itemgroup.lisp
(file).
src
(module).
initialize
(method).
make-simple-persistence
(function).
persist
(method).
retrieve
(method).
shutdown
(method).
simple-persistence
(class).
storage-root-path
(reader method).
chipi/src/persistence-influx.lisp
persistence-simple.lisp
(file).
src
(module).
influx-persistence
(class).
initialize
(method).
make-influx-persistence
(function).
persist
(method).
retrieve
(method).
retrieve-range
(method).
shutdown
(method).
%make-persisted-item
(function).
%make-query-request
(function).
%make-range-query-string
(function).
%make-single-query-string
(function).
%make-write-request
(function).
%parse-csv-to-time-value-pairs
(function).
%parsed-last-persisted-item
(function).
%parsed-range-persisted-item
(function).
%range-to-string
(function).
base-url
(reader method).
bucket
(reader method).
org
(reader method).
precision
(reader method).
token
(reader method).
chipi/src/rule.lisp
persistence-influx.lisp
(file).
src
(module).
%add-cron-hash
(function).
%receive-fun
(function).
chipi/src/persistence.lisp
rule.lisp
(file).
src
(module).
destroy
(function).
fetch
(function).
make-relative-range
(function).
store
(function).
make-persistence
(function).
chipi/src/bindings/base-binding.lisp
bindings
(module).
bind-item
(function).
binding
(class).
call-push-p
(reader method).
destroy
(function).
exec-pull
(function).
exec-push
(function).
make-function-binding
(function).
print-object
(method).
%add-timer
(function).
bound-items
(reader method).
pull-fun
(reader method).
(setf pull-fun)
(writer method).
push-fun
(reader method).
(setf push-fun)
(writer method).
chipi/src/hab.lisp
bindings
(module).
src
(module).
*itemgroups*
(special variable).
*items*
(special variable).
*persistences*
(special variable).
*rules*
(special variable).
add-to-shutdown
(function).
binding
(macro).
defconfig
(macro).
defitem
(macro).
defitemgroup
(macro).
defpersistence
(macro).
defrule
(macro).
get-item
(function).
get-itemgroup
(function).
get-items
(function).
get-items-on-group
(function).
get-persistence
(function).
get-rule
(function).
shutdown
(function).
*shutdown-hooks*
(special variable).
Packages are listed by definition order.
chipi.env
chipi.binding
chipi.persistence
chipi.rule
chipi.item
chipi.influx-persistence
chipi.timer
chipi.cron
chipi.isys
chipi.itemgroup
chipi.simple-persistence
chipi.hab
chipi.env
envi
common-lisp
.
ensure-env
(function).
ensure-runtime-dir
(function).
shutdown-env
(function).
*rel-runtime-dir*
(special variable).
chipi.binding
binding
common-lisp
.
bind-item
(function).
binding
(class).
call-push-p
(generic reader).
destroy
(function).
exec-pull
(function).
exec-push
(function).
make-function-binding
(function).
%add-timer
(function).
bound-items
(generic reader).
pull-fun
(generic reader).
(setf pull-fun)
(generic writer).
push-fun
(generic reader).
(setf push-fun)
(generic writer).
chipi.persistence
persp
common-lisp
.
days
(generic reader).
(setf days)
(generic writer).
destroy
(function).
fetch
(function).
hours
(generic reader).
(setf hours)
(generic writer).
initialize
(generic function).
make-persisted-item
(function).
make-relative-range
(function).
minutes
(generic reader).
(setf minutes)
(generic writer).
persist
(generic function).
persisted-item
(structure).
persisted-item-timestamp
(reader).
(setf persisted-item-timestamp)
(writer).
persisted-item-value
(reader).
(setf persisted-item-value)
(writer).
persistence
(class).
range
(class).
relative-range
(class).
retrieve
(generic function).
retrieve-range
(generic function).
seconds
(generic reader).
(setf seconds)
(generic writer).
shutdown
(generic function).
store
(function).
copy-persisted-item
(function).
make-persistence
(function).
persisted-item-p
(function).
chipi.rule
rule
common-lisp
.
%add-cron-hash
(function).
%receive-fun
(function).
chipi.item
item
common-lisp
.
add-binding
(function).
add-persistence
(function).
destroy
(function).
false
(type).
false-p
(function).
get-item-stateq
(function).
get-value
(function).
item
(class).
item-changed-event
(structure).
item-changed-event-item
(reader).
(setf item-changed-event-item)
(writer).
item-state
(structure).
item-state-timestamp
(reader).
(setf item-state-timestamp)
(writer).
item-state-value
(reader).
(setf item-state-value)
(writer).
label
(generic reader).
make-item
(function).
name
(function).
set-value
(function).
true
(type).
true-p
(function).
value-type-hint
(generic reader).
%fetch-persisted-value
(function).
%filter-frequency
(function).
%item-receive
(function).
%parse-frequency
(function).
bindings
(generic reader).
copy-item-changed-event
(function).
copy-item-persistence
(function).
copy-item-state
(function).
item-changed-event-p
(function).
item-persistence
(structure).
item-persistence-frequency
(reader).
(setf item-persistence-frequency)
(writer).
item-persistence-load-on-start
(reader).
(setf item-persistence-load-on-start)
(writer).
item-persistence-p
(function).
item-persistence-persp
(reader).
(setf item-persistence-persp)
(writer).
item-persistence-timer-sig
(reader).
(setf item-persistence-timer-sig)
(writer).
item-state-p
(function).
make-item-changed-event
(function).
make-item-persistence
(function).
make-item-state
(function).
persistences
(generic reader).
chipi.influx-persistence
influx-persistence
chipi.persistence
.
common-lisp
.
influx-persistence
(class).
make-influx-persistence
(function).
%make-persisted-item
(function).
%make-query-request
(function).
%make-range-query-string
(function).
%make-single-query-string
(function).
%make-write-request
(function).
%parse-csv-to-time-value-pairs
(function).
%parsed-last-persisted-item
(function).
%parsed-range-persisted-item
(function).
%range-to-string
(function).
base-url
(generic reader).
bucket
(generic reader).
org
(generic reader).
precision
(generic reader).
token
(generic reader).
chipi.timer
A simple timer package
This package provides a simple timer that can be used to schedule functions.
timer
common-lisp
.
cancel
(function).
ensure-timer
(function).
schedule-once
(function).
schedule-recurring
(function).
shutdown-timer
(function).
*timer*
(special variable).
chipi.cron
cr
common-lisp
.
cancel-job
(function).
ensure-cron
(function).
make-cron-job
(function).
num-jobs
(function).
shutdown-cron
(function).
*cron*
(special variable).
chipi.isys
isys
common-lisp
.
ensure-isys
(function).
shutdown-isys
(function).
*isys*
(special variable).
chipi.itemgroup
itemgroup
common-lisp
.
add-item
(function).
get-item
(function).
get-items
(function).
get-value
(function).
itemgroup
(class).
label
(generic reader).
make-itemgroup
(function).
name
(function).
remove-item
(function).
set-value
(function).
chipi.simple-persistence
simple-persistence
chipi.persistence
.
common-lisp
.
make-simple-persistence
(function).
simple-persistence
(class).
storage-root-path
(generic reader).
chipi.hab
hab
common-lisp
.
*itemgroups*
(special variable).
*items*
(special variable).
*persistences*
(special variable).
*rules*
(special variable).
add-to-shutdown
(function).
binding
(macro).
defconfig
(macro).
defitem
(macro).
defitemgroup
(macro).
defpersistence
(macro).
defrule
(macro).
get-item
(function).
get-itemgroup
(function).
get-items
(function).
get-items-on-group
(function).
get-persistence
(function).
get-rule
(function).
shutdown
(function).
*shutdown-hooks*
(special variable).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Creates a binding.
See ‘binding:make-function-binding’ for more information and arguments.
Defines a configuration for the environment.
It will start the environment if it is not already started.
It is re-entrant, so it can be called multiple times.
But if environment is already configured/started it does nothing.
It also will setup items, rules and persistences storages.
Defines an item.
It will create the item if it does not exist.
It will clean and re-create the item if it already exists.
Cleaning means all attached bindings are re-created and persistence are re-attached.
An ‘:initial-value’ can be used to specify the initial value of the item.
A ‘:group’ key can used to specify to which ‘itemgroup’ the ‘item’ should belong.
It will then be added to the group.
Bindings can be defined as a list of ‘binding’s.
The ‘binding’ arguments are passed to ‘binding:make-function-binding’.
Persistences are references via ‘:persistence’ key.
‘persistence’ key allows to define a plist of ‘:id’ and ‘:frequency’ configuration.
‘:id’ specifies the persistence id.
‘:frequency’ specifies the persistence frequency. Currently only ‘:every-change’ exists.
See ‘hab-test.lisp’ and ‘item’ for more examples.
Defines an itemgroup.
Itemgroups are containers for items.
Defines a persistence.
Persistence generally represents a storage that items use for persisting their values.
It will create the persistence if it does not exist.
It will clean and re-create the persistence if it already exists.
The factory function is called with the persistence id as argument and allows to create required persistence type.
See ‘hab-test.lisp’ and ‘persistence’ for more examples.
Defines a rule.
It will create the rule if it does not exist.
It will clean and re-create the rule if it already exists.
See ‘rule:make-rule’ for more information and arguments.
Adds persistence to item.
‘PERSISTENCE’ is a ‘persp:persistence’ object.
‘OTHER-ARGS’ are key arguments:
‘:frequency’: which by default is
‘:every-change’ denoting that every change to the iten should be stored.
‘:every-N<s|m|h>’ denoting a number N specified as ‘s’ (seconds), ‘m’ (minutes) or ‘h’ (hours)
when the item should be stored recurringly.
Cancel a timer
Destroys the persistence.
Destroy the given ‘RULE’.
Ensure that the runtime directory exists.
This is called as part of ‘ensure-env’ but can be called separately.
If DIR is not specified, the root runtime folder is ensured.
Otherwise, the relative path DIR is ensured.
Returns the absolute path to the ensured directory.
It is possible to override the relative root runtime directory by:
“‘
(let ((*rel-runtime-dir* "test-runtime/"))
(ensure-runtime-dir))
“‘
But note that the runtime dir will be computed on each call to ‘ensure-runtime-dir’.
Ensure that a timer is running.
Executes the ‘pull-fun’ as defined on the binding.
Beware that ‘pull-fun’ is executed by the thread that calls ‘exec-pull’. This may differ. I.e.when called from timer when ‘:initial-delay’ or ‘:delay’ is defined.
In order to not unwind/collapse a timer stack execution of ‘pull-fun’ is error checked (handler-case).
‘exec-pull’ will set pulled value to bound items, or if a ‘transform-fun’ is defined will call that first.
‘exec-push’ is called after an item value change. It executed ‘push-fun’ as defined on the binding. The caller of ‘exec-push’ is responsible for unwind protection. No error handling is done here. This is to have the higher-level module decide how to handle the error.
Triggers the ’fetch’ procedure of the persistence actor.
The actual persistence method called as a result is ‘persp:retrieve’.
Optionally specify a ‘range’ to retrieve a list of values that satisfy the ‘range’
See ‘item:range’ for more details of range. Currently only ‘relative-range’ is supported.
Returns a ‘persisted-item’ instance or a list of ‘persisten-item’s if range is specified.
Returns the item with the given id from the created items.
Returns the item state ‘item-state’.
Returns the itemgroup with ‘id’ if exists, ‘nil’ otherwise.
Returns the items of group as list
Returns the persistence with the given id from the created persistences.
Returns the rule with the given name from the created rules.
Returns ‘future:future’.
Collects values (as futures) from all added items.
item
.
‘fun’ is the function to execute by cl-cron. ‘args’ are all job args supported by cl-cron.
Creates a relative range with the given ‘seconds’, ‘minutes’, ‘hours’ and ‘days’. Specify only one.
Create a rule actor with the given NAME and KEYS.
KEYS can be: ‘:when-item-change’, ‘:when-cron’, ‘:do’.
‘:when-item-change’ is an item to subscribe to.
‘:when-cron’ is a cron expression. See ‘cl-cron’ for details.
Both ‘:when-item-change’ and ‘:when-cron’ can be specified multiple times.
‘:do’ is a function that will be called when the rule is triggered.
It will be called with a single argument, an alist with either
‘:item’ or ‘:cron’ as the key, depending on what triggered the rule.
‘:item’ will be the item that triggered the rule, and ‘:cron’ will
be the cron expression that triggered the rule.
Example:
(make-rule "my-rule"
:when-item-change ’my-item
:when-cron ’(:minute 0 :hour 0)
:do (lambda (trigger)
(case (car trigger)
(:item (log:info "Item changed: " (cdr trigger)))
(:cron (log:info "Cron triggered: " (cdr trigger))))))
This will create a rule that will be triggered when ‘my-item’ changes,
or when the cron expression (:minute 0 :hour 0) is triggered.
When triggered, the rule will log a message to the info log.
Schedule a function to be called after a delay in seconds Returns a timer signature to be used for ‘CANCEL’
Schedule a function to be called after a delay in seconds, recurring.
The function will be called with no arguments.
Returns a timer signature to be used for ‘CANCEL’
Updates item value with push to bindings.
If ‘PUSH’ is non-nil, bindings will be pushed regardsless of ‘CALL-PUSH-P’ on binding definition.
‘TIMESTAMP’: can be used to define a custom timestamp (universal-time). If ‘NIL’ a timestamp is created.
‘PERSIST’: if non-nil, persistences will be applied.
Sets ‘value’ to all added items.
Parameters mimick the ‘item:set-value’ interface.
Shuts down the environment, calls shutdown hooks and cleans all items rules and persistences.
Triggers the ’store’ procedure of the persistence actor.
The actual persistence method called as a result is ‘persp:persist’.
relative-range
)) ¶automatically generated reader method
days
.
relative-range
)) ¶automatically generated writer method
days
.
relative-range
)) ¶automatically generated reader method
relative-range
)) ¶automatically generated writer method
Initializes the persistence.
influx-persistence
)) ¶simple-persistence
)) ¶relative-range
)) ¶automatically generated reader method
relative-range
)) ¶automatically generated writer method
Stores the item to file.
The persistence is responsible to store all the data that is also expected to be retrieved later.
influx-persistence
) item) ¶simple-persistence
) item) ¶Fetches the last value of an item from the persistence as ‘persisted-item’.
The caller of this method is handling error conditions, so you don’t have to necessarily.
But you can return more specific ’(:error . error-message or condition).
influx-persistence
) item) ¶Output format of influxdb is csv, so we need to parse it.
simple-persistence
) item) ¶Fetches a range of values of an item from the persistence as a list of ‘persisted-item’s. The caller of this method is handling error conditions, so you don’t have to necessarily. But you can return more specific ’(:error . error-message or condition).
influx-persistence
) item range) ¶relative-range
)) ¶automatically generated reader method
relative-range
)) ¶automatically generated writer method
Shuts down the persistence.
influx-persistence
)) ¶simple-persistence
)) ¶structure-object
.
The bound items. On operation the value will be updated to each item.
(quote nil)
This slot is read-only.
0-arity function that retrieves the value.
The function must return a value representing the new item value.
The returned value can be wrapped in a ‘future‘, if the pull is performed asynchronously.
To allow control over the subsequent call chain it is possible to return ‘values’ with options indicating whether a subsequent ’push’ should be performed.
I.e. ‘(values <value> ’(:push [nil|t]))‘.
If ‘:push’ is ‘NIL’ then no push will be performed.
The default, if omitted and also when a single value is returned is to push.
:pull-fun
Function to push the item values to some receiver.
Beware that ‘pull’ will only call ‘push’ when ‘call-push-p’ is set.
Make sure you do the right thing in ‘pull-fun’.
:push-fun
A function transforming an input value to an output value.
The input value comes from ‘pull-fun’.
The output value will be set on the item, should an item be attached.
:transform-fun
defines whether setting a new value (‘item:set-value’) will be passed through to ’push’, after the transformation chain has been executed.
:call-push-p
This slot is read-only.
Initial delay in seconds where ‘PULL-FUN’ is executed. ‘NIL’ means disabled and ‘PULL-FUN’ is not called.
:initial-delay
Recurring delay in seconds. Calls ‘PULL-FUN’ repeatedly. ‘NIL’ means disabled.
:delay
The timers that are scheduled for this binding.
(make-hash-table :test (function eq))
Influx persistence implementation.
Influx persistence supports the following value types:
- string
- integer
- float
- boolean, for boolean values, use the symbols ’item:true and ’item:false.
Other value types are not supported.
Specify those types as ’type-hint’ in the item definition.
actor
.
A type hint for the item value.
This is in particular important for persistences that are type specific, like influxdb (within a measurement).
This slot is read-only.
The items bindings
(quote nil)
This slot is read-only.
The items persistences
(quote nil)
This slot is read-only.
This persistence is the base class of sub-persistences.
There may be different kinds of persistence with different storages.
actor
.
A relative range is a range that is relative to the current time.
actor
.
A list of cron hashes for this rule.
The root path where item values are stored.
#p""
:storage-root-path
This slot is read-only.
The relative path to the root runtime directory for chipi.
Add the given ‘HASH’ to the list of cron hashes for the given ‘RULE’.
‘TIMER’ is just a signature.
Creates a persistence actor with the given ‘id’ and ‘other-args’.
The type of the persistence actor can be specified with the
‘:type’ keyword.
‘other-args’ can be used by sub-classes to pass additional arguments to the underlying actor.
See ‘simple-persistence’ as example.
This constructor is not public, subclasses should provide their own constructor but call this one.
influx-persistence
)) ¶automatically generated reader method
influx-persistence
)) ¶automatically generated reader method
influx-persistence
)) ¶automatically generated reader method
org
.
influx-persistence
)) ¶automatically generated reader method
binding
)) ¶binding
)) ¶0-arity function that retrieves the value.
The function must return a value representing the new item value.
The returned value can be wrapped in a ‘future‘, if the pull is performed asynchronously.
To allow control over the subsequent call chain it is possible to return ‘values’ with options indicating whether a subsequent ’push’ should be performed.
I.e. ‘(values <value> ’(:push [nil|t]))‘.
If ‘:push’ is ‘NIL’ then no push will be performed.
The default, if omitted and also when a single value is returned is to push.
simple-persistence
)) ¶automatically generated reader method
influx-persistence
)) ¶automatically generated reader method
structure-object
.
(or null chipi.persistence:persistence)
:every-change
t
(gensym "item-persistence-timer-sig")
Jump to: | %
(
A B C D E F G H I L M N O P R S T V |
---|
Jump to: | %
(
A B C D E F G H I L M N O P R S T V |
---|
Jump to: | *
B C D F H I L M O P S T V |
---|
Jump to: | *
B C D F H I L M O P S T V |
---|
Jump to: | B C E F H I M P R S T |
---|
Jump to: | B C E F H I M P R S T |
---|