2a1f111565
Verbatim port of Fastway-Server's TFWScheduler from fw_scheduler.pas
per feedback_copy_dont_reinterpret.md. Library named fpc-cron;
class TCron. Adjustments limited to:
- Type renames per family convention.
- uses clause: drop fw_consts/fw_log/fw_config/fw_database/
fw_plugin_*/dbapi_*; add log.types (fpc-log) + db.dialect/
schema/pool (fpc-db v0.3.0) + cron.types + cron.events.
fpc-cron does NOT depend on fpc-events.
- TDBPool injected on Create where canonical used global DB.
- Logging through optional log.types.TLogProc callback (the
canonical ecosystem-wide logger shape used by every other
fpc-* library). Category='cron'.
- Events: typed observer callbacks (cron.events) instead of
canonical's EventBus.Fire calls. OnTaskStart /
OnTaskComplete / OnTaskRegistered / OnPluginOrphaned /
OnThreadStart / OnThreadStop are assignable properties on
TCron. Same per-library typed-callback pattern as
fpc-binkp's bp.events and fpc-comet's cm.events.
- System-task dispatch: consumer-registered via
RegisterSystemTask (no Fastway-specific log_cleanup / etc.
baked in). Dispatcher shape preserved.
- DoWalCheckpointTruncate lifted out (Fastway-specific).
- No global Scheduler singleton.
- ParseCronField / MatchesCron promoted to class function for
test access; bodies byte-verbatim from canonical (verified
by normalised diff).
Schema: system_scheduler + scheduler_log table names + columns
preserved verbatim from canonical fw_schema.pas, so an existing
Fastway database is reusable as-is.
Behaviours preserved verbatim: cron grammar (5-field, *, */N,
a,b,c, a-b, a-b/N, literal), UTC math via LocalTimeToUniversal,
schedule-miss-on-long-task semantics, TThread + PRTLEvent +
1-second wake loop, suspended-Create + .Start, SyncPluginTasks
orphan cleanup, MatchesCron's DecodeDateFully call (cosmetic but
present in canonical), MatchesCron's pre-try-finally TBits
allocation (known leak inherited verbatim and documented).
Docs: README + docs/API.md + docs/architecture.md +
docs/DEVELOPER_GUIDE.md. fpc.cfg for multi-target builds.
Tests: 73 assertions across 23 scenarios (37 pure-cron + 36
SQLite-backed end-to-end) pass on x86_64-linux. Pre-tag -vh
audit on src/ reports zero hints/warnings on cron.* units.
54 lines
1.1 KiB
INI
54 lines
1.1 KiB
INI
# fpc-cron fpc.cfg — multi-target FPC build configuration.
|
|
#
|
|
# Pulls compiler-bundled RTL paths from /opt/fpcup, then adds the library
|
|
# source root + sibling fpc-* libraries so callers can build with
|
|
# `-Fucfg=fpc.cfg`.
|
|
|
|
#IFNDEF FPC_CROSSCOMPILING
|
|
#IFDEF LINUX
|
|
#INCLUDE /opt/fpcup/fpc/bin/x86_64-linux/fpc.cfg
|
|
#ENDIF LINUX
|
|
#IFDEF OS2
|
|
#INCLUDE P:\fpc\bin\os2\fpc.cfg
|
|
#ENDIF OS2
|
|
#IFDEF DOS
|
|
-Fuc:\pp/units/i386-$FPCTARGET/
|
|
-Fuc:\pp/units/i386-$FPCTARGET/*
|
|
-Fuc:\pp/units/i386-$FPCTARGET/rtl
|
|
#ENDIF DOS
|
|
#ELSE
|
|
-Fu/opt/fpcup/fpc/units/$FPCTARGET/rtl
|
|
-Fu/opt/fpcup/fpc/units/$FPCTARGET/*
|
|
#ENDIF
|
|
|
|
# Allow GOTO/LABEL, inline, C-operators
|
|
-Sgic
|
|
|
|
# Library source roots
|
|
-Fusrc
|
|
|
|
# Sibling fpc-* libraries we depend on
|
|
-Fu../fpc-log/src
|
|
-Fu../fpc-db/src
|
|
|
|
# Output trees
|
|
-FEbuild
|
|
-FUbuild
|
|
|
|
# Cross-compile binutils prefixes
|
|
#IFDEF FPC_CROSSCOMPILING
|
|
#IFDEF CPUI386
|
|
#IFDEF OS2
|
|
-FD/opt/fpcup/cross/i386-pc-os2-emx
|
|
-XPi386-emx-
|
|
-k-e
|
|
-k0x10000
|
|
#ELSE
|
|
-FD/opt/fpcup/cross/bin
|
|
-XP$FPCTARGET-
|
|
#ENDIF OS2
|
|
#ENDIF CPUI386
|
|
#ENDIF FPC_CROSSCOMPILING
|
|
|
|
-Xs
|