Documentation
¶
Overview ¶
Package fn assembles and installs the nova-sprint Redis Function library.
Index ¶
- Constants
- Variables
- func FromList(libs []redis.Library) (string, bool)
- func Load(ctx context.Context, client *redis.Client) error
- func LoadMissing(ctx context.Context, client *redis.Client) error
- func Loaded(ctx context.Context, client *redis.Client) (string, bool, error)
- func Source() (string, error)
- func Spec() redisfn.Library
- func Sum(source string) string
Constants ¶
const Library = "nova_sprint"
const MaxLocals = 180
MaxLocals is the most active locals the library's main function may hold. Lua (and so Redis) refuses a function with more than 200; the headroom is for the next merge. TestLibraryLocalsUnderLimit enforces it.
const Prelude = "local NS = {}\n"
Prelude is the one chunk-level local of the assembled library: NS, the table through which a file hands helpers to a file that sorts after it (capacity.lua as NS.capacity, friend_roles.lua as NS.friend_roles).
Variables ¶
var ListQuery = redis.FunctionListQuery{LibraryNamePattern: Library, WithCode: true}
ListQuery is the FUNCTION LIST that Loaded sends: the nova_sprint library with its code. A reader that pipelines it with other reads passes the reply to FromList.
Functions ¶
func FromList ¶
FromList is the nova_sprint library's code in a FUNCTION LIST reply, and false when the reply holds none.
func Load ¶
Load installs the complete library atomically. REPLACE permits an updated binary to deploy its exact embedded version without a delete/load gap.
func LoadMissing ¶
LoadMissing installs the embedded library only when the server holds no nova_sprint library, and never replaces one it holds. A verb that loads on the way to its FCALL (card push, drain and release, the reconciler's calls and expire duty) runs whatever binary its host has; with Load, an older binary REPLACEd the deployed library with its own and every function added since can vanish from the store, leaving newer callers without the functions they need. Upgrading the library is the deploy's job (`nova-sprint fn load`, which uses redisfn.Ensure). A caller whose ACL refuses FUNCTION LIST is not the deployer: it loads nothing and its FCALL answers for the store.
func Loaded ¶
Loaded returns the code of the nova_sprint library the server holds, and false when it holds none.
func Source ¶
Source builds one library from all verb files. A verb is added by placing a Lua file in lua/; no central Lua registry needs to change. Each file is wrapped in its own do-block, so its top-level locals leave scope at its end: the main function holds len(Prelude locals) + the largest file's locals at once, not the sum over every file (Lua allows 200 active locals). A file shares nothing by bare local; what a later file needs goes through NS.
func Spec ¶
Spec is nova_sprint as pkg/redisfn describes a library: this package's files, glob and prelude, so a living tool loads and checks it with redisfn (nova-redis fn). Its Source is this package's Source, byte for byte, and so its digest is Sum's. Remedy is left for the tool to fill in its own words.
Types ¶
This section is empty.