summaryrefslogtreecommitdiff
path: root/courses.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* {courses,wsc}.go: Atomic 64-bit alignmentRunxi Yu2024-10-091-3/+6
|
* *.go: Update commentsRunxi Yu2024-10-091-9/+4
|
* {courses,index}.go, student.html, style.css: Group by course groupRunxi Yu2024-10-091-9/+11
|
* *.go: Use sync.Map instead of map[int]*courseT for coursesRunxi Yu2024-10-091-35/+18
| | | | I'm not sure whether this is actually better than locking.
* {courses,wsc,wsp}.go: Usems should be sync.MapRunxi Yu2024-10-091-5/+2
| | | | | This is a classic few-reads, many-writes situation where a sync.Map would lead to substantially less lock contention.
* {courses,wsc,wsm}.go: map[courseGroupT](bool->struct{})Runxi Yu2024-10-081-3/+3
| | | | | This makes it use slightly less memory. Approximately courseGroupT bits per connection!
* *.go: Further wrap errorsRunxi Yu2024-10-081-8/+14
|
* err.go: Create, and unify some error definitionsRunxi Yu2024-10-081-7/+0
|
* {courses,wsm,wsp}.go: Make course.Selected atomicRunxi Yu2024-10-071-4/+5
|
* *.go: Limit to approximately 80 characters per lineRunxi Yu2024-10-061-12/+56
|
* {courses,wsc,wsm,wsp}.go: Send course number immediately on user interactionRunxi Yu2024-10-061-2/+9
|
* *: Overhaul structure again and embed everythingRunxi Yu2024-10-061-0/+229
| | | | | | | | - Remove sub-Makefiles; recursive make is annoying - Just use one top-level Makefile that builds everything - Embed templates and minified static resources into the binary - Embed all compiled documentation into the binary and serve - Embed all source into the binary and serve
* *.go: Move to backendRunxi Yu2024-10-051-229/+0
| | | | And adjust Makefiles, admin handbook, and lint.sh accordingly.
* {courses,wsm}.go: Use in-memory structure to fetch cgroup, not SQLRunxi Yu2024-10-051-17/+6
|
* {courses,sem,ws,wsm}.go: Second step towards an efficient state propagatorRunxi Yu2024-10-051-4/+6
| | | | References: https://todo.sr.ht/~runxiyu/cca/7
* {courses,sem,ws}.go: First step towards an efficient state propagatorRunxi Yu2024-10-051-1/+10
| | | | References: https://todo.sr.ht/~runxiyu/cca/7
* courses.go: ReformatRunxi Yu2024-10-051-1/+1
|
* {courses,wsm}.go: Add getCourseByIDRunxi Yu2024-10-051-0/+6
| | | | This also deduplicates some code.
* {courses,wsm}.go: Add (*courseT).decrementSelectedAndPropagateRunxi Yu2024-10-051-0/+11
| | | | This is being done quite a few times, so let's make it a function.
* {courses,ws,wsm}.go: Update userCourseGroups during choose/unchooseRunxi Yu2024-10-051-7/+18
|
* {courses,ws}.go: Populate userCourseGroups in a separate functionRunxi Yu2024-10-051-0/+34
|
* {courses,ws}.go: Populate userCourseGroups for each connectionRunxi Yu2024-10-041-5/+19
| | | | | | | | | | | | | | | | | | It is way too expensive to query the database every time we need to check whether a user has chosen a course in a group. Since we can (hopefully) guarantee that there is only one usable connection for any given moment and user, we could store this data along with the connection as a local variable in handleConn, which would be eligible for garbage collection when handleConn exits. Here we create the data structures that globally represent courseTypes and courseGroups, and during the initial stages of handleConn, perform database queries to populate userCourseGroups with the groups that the user has already chosen. Note that the HELLO command handler does similar database queries, and as per the TODO listed in the comments, should be moved up here for efficiency. (HELLO also serves as some sort of an initial connection check; this should probably be replaced with WebSocket's native pings.)
* courses.go, schema.sql: Validate course{Type,Group} in server, not SQLRunxi Yu2024-10-041-10/+44
|
* courses.go: Propagate course.Selected when setting up coursesRunxi Yu2024-10-011-2/+7
|
* *: Change license to AGPL-3.0-or-laterRunxi Yu2024-09-301-21/+11
|
* courses.go: courseT.{Lock->SelectedLock}Runxi Yu2024-09-291-12/+12
|
* courses.go: Add a RWMutex to courseTRunxi Yu2024-09-281-8/+15
|
* courses.go, etc: Make courses a map instead of a sliceRunxi Yu2024-09-261-3/+3
| | | | | We need to refer to courses by their ID, and a map makes significantly more sense than a slice.
* *.go, cca.scfg.example: Expose performance optionsRunxi Yu2024-09-261-1/+1
|
* *.go: Wrap errorsRunxi Yu2024-09-261-3/+4
|
* *.go: LintingRunxi Yu2024-09-241-11/+11
|
* courses.go: Comment out coursetype_t enum to make linter happy for nowRunxi Yu2024-09-241-5/+7
|
* *.go: Add more licensesRunxi Yu2024-09-091-0/+30
|
* *.go: Add commentsRunxi Yu2024-09-091-2/+18
|
* courses.go: Remove unused importsRunxi Yu2024-09-081-1/+0
|
* *: Display coursesRunxi Yu2024-09-081-0/+69