csm(3) | AFNIX Module | csm(3) |
NAME¶
csm - standard cloud session management moduleSTANDARD CLOUD SESSION MANAGEMENT MODULE¶
The Standard Cloud Session Management module is an original implementation of various objects dedicated to the management of events eventually associated with a session controller. In its classical way, the objects can be used to manage an agenda, schedule events and perform associated actions. In a more elaborated way, a session group can be used to manage different group of objects bound to one or several users or groups. General concepts# allocate a 1 hour slot const slot (appt:get-slot 3600)
# allocate a 1 hour slot starting at 2AM const slot (appt:get-slot 7200 3600)
# create a reference appointer const appt (afnix:csm:Appointer) # add a saturday and sunday blocked day rule appt:set-blocked-day 6 appt:set-blocked-day 0 # set the special days appt:set-special-day 1 1 appt:set-special-day 12 25
# set a valid block time between 8AM to 12AM const ambt (* 3600 8) const amet (* 3600 12) const pmbt (* 3600 14) # set a valid block time between 2PM to 6PM const pmet (* 3600 18) appt:set-valid-block-time ambt amet appt:set-valid-block-time pmbt pmet
# create an assistant const name "Mr Smith" const info "The super assistant" const asst (afnix:csm:Assistant name info) # create a reference appointer const appt (afnix:csm:Appointer) # add 2 appointers by cloning asst:add-appointer (appt:clone) asst:add-appointer (appt:clone)
STANDARD CLOUD SESSION MANAGEMENT REFERENCE¶
Slotslot-p
Inheritance
Object
Constructors
Slot (none)
The Slot constructor creates an empty slot initialized at time 0 with duration
0.
Slot (Integer Integer)
The Slot constructor creates a slot with a time and duration. The first argument
is the slot time. The second argument is the slot duration.
Methods
reset -> none (none)
The reset method reset the slot to time 0 with duration 0.
set-time -> none (Integer)
The set-time method sets the slot time.
get-time -> Integer (none)
The get-time method returns the slot time.
set-duration -> none (Integer)
The set-duration method sets the slot duration.
get-duration -> Integer (none)
The get-duration method returns the slot duration.
set-slot -> none (Integer Integer)
The set-slot method sets the slot time and duration at once. The first argument
is the slot time. The second argument is the slot duration.
Appointer
appointer-p
Inheritance
Object
Constructors
Appointer (none)
The Appointer constructor creates a default appointer initialized at time 0.
There is no rule installed by the constructor.
Appointer (Integer)
The Appointer constructor creates an appointer with an initial time. The time is
set as he starting time to allocate slots. There is no rule installed by the
constructor.
Methods
reset -> none (none)
The reset method reset the appointer slot number and daily slot counter. The
rules are not touched by this method.
set-time -> none (Integer)
The set-time method set the appointer time. During the next operation, the newly
allocated slots have their time starting at least at this time.
get-time -> Integer (none)
The get-time method returns the current appointer time.
set-date -> none (Date)
The set-date method set the appointer time by converting the date argument to a
time.
get-date -> Integer (none)
The get-date method returns the current appointer date.
get-slot -> Slot (Integer|Integer
Integer)
The get-slot method returns a new slot allocated by the appointer. with one
argument the argument is taken as the slot duration. With 2 arguments, the
first arguments is the requested slot time and the second argument is the slot
duration. The slot allocation algorithm operates by finding the appropriate
day and time which satisfies the appointer rules. If the slot cannot be found
within one week, the allocation is assumed to have failed.
get-slot-number -> Integer (none)
The get-slot-number method returns the total number of slots allocated by the
appointer.
set-blocked-day -> none (Integer)
The set-blocked-day method sets a regular weekly block day. The method uses the
week day index as its argument. Sunday has index 0 and Saturday has index 6.
No slot is allocated in a blocked day.
set-special-day -> none (Integer
Integer)
The set-special-day method sets a special year day. The method uses the year
month and the month day index as its arguments. The first argument is the year
month which must be in the range of 1 to 12. The second argument is the month
day which must be in the range of 1 to 31. No slot is allocated in a special
day.
set-maximum-slots -> none (Integer)
The set-maximum-slots method sets a daily maximum slots number. When the daily
maximum slot number is reached, the slot allocation proceed to the next
day.
set-valid-block-time -> none (Integer
Integer)
The set-valid-block-time method sets a valid block time in which the slot can be
allocated. By default, a slot can be allocated anytime during the day. When
this rule is set, at least once, the slot is allocated in this block. Multiple
valid block time can be defined. The first argument is the valid block time
lower bound expressed in seconds from 12PM. The second argument is the valid
block time upper bound. All time are expressed in seconds and rounded to a day
second which is 84600 seconds in 24 hours. For example, a valid block time is
from 8AM to 12AM. Another would be from 2PM to 6PM.
Assistant
assistant-p
Inheritance
Object
Constructors
Assistant (none)
The Assistant constructor creates a default assistant.
Assistant (String)
The Assistant constructor creates a default assistant by name.
Assistant (String String)
The Assistant constructor creates a default assistant by name and information.
The first argument is the assistant name. the second argument is the assistant
information string.
Methods
reset -> none (none)
The reset method reset the assistant by. All objects attached to the assistant
are reset by this method.
get-name -> String (none)
The get-name method returns the assistant name.
get-info -> String (none)
The get-info method returns the assistant information string.
pushback -> none (Slot)
The pushback method pushbaks a slot in the appointer list. The assistant manages
internally an index which is used to select the appointer where the slot is
pushed-back.
get-slot -> Slot (Integer|Integer
Integer)
The get-slot method returns he next available slot from the appointer list. The
assistant manages internally an index which is used to select the appointer
from which the slot is obtained. With one argument, the method operates with a
slot duration. with 2 arguments, the method operates by time and duration. The
time is the minimum time for which the slot is allocated. If the slot cannot
be allocated, an exception is raised.
add-appointer -> none (Appointer)
The add-appointer method adds an appointer object to the assistant.
get-appointer -> Appointer (Integer)
The get-appointer method returns an appointer object by index. If the appointer
object cannot be found, an exception is raised.
length-appointer -> Integer (none)
The length-appointer method returns the number of appointers attached to the
assistant.
get-slot-number -> Integer (none)
The get-slot-number method returns the total number of slot allocated by the
assistant at the time of the call. The number is computed by summing all slot
numbers for each appointers. attached to the assistant.
get-appointer-time -> Integer (none)
The get-appointer-time method returns the average appointer time for the
attached appointers. At the time of the call, each appointer has a time which
corresponds to the next slot available time. The average time for all
appointers is the result of this method which corresponds to the average time
of the next available slot.
2012-03-26 | AFNIX |