summaryrefslogtreecommitdiff
path: root/src/lib/exvar.go
AgeCommit message (Collapse)AuthorFilesLines
2009-05-05directory-per-package step 1: move files from lib/X.go to lib/X/X.goRob Pike1-202/+0
no substantive changes except: - new Makefiles, all auto-generated - go/src/lib/Makefile has been extensively edited R=rsc OCL=28310 CL=28310
2009-05-04Remake exvar package to be more Go-ish.David Symonds1-177/+146
It now exports a Var interface (anyone can export their own custom var types now), so users need to create and manage their own vars and mark them as exportable via the Publish function. They are exposed via /debug/vars. R=r,rsc APPROVED=r DELTA=605 (314 added, 186 deleted, 105 changed) OCL=28143 CL=28239
2009-04-28Add a HTTP handler to the exvar package.David Symonds1-0/+11
R=r APPROVED=r DELTA=20 (11 added, 6 deleted, 3 changed) OCL=27782 CL=27950
2009-04-26Add string-valued variables to exvar.David Symonds1-1/+40
R=r APPROVED=r DELTA=62 (58 added, 1 deleted, 3 changed) OCL=27756 CL=27877
2009-04-21Clean up some more code after bug143 was fixed.David Symonds1-6/+1
R=r APPROVED=r DELTA=6 (0 added, 5 deleted, 1 changed) OCL=27708 CL=27708
2009-04-21Bug 143 is fixed, so clean up some of exvar.David Symonds1-5/+7
R=r APPROVED=r DELTA=8 (3 added, 1 deleted, 4 changed) OCL=27699 CL=27701
2009-04-21Change exvar to use a goroutine channel worker instead of a mutex for ↵David Symonds1-61/+87
synchronisation. Also it should be more testable, as there's less global state. R=r APPROVED=r DELTA=113 (38 added, 12 deleted, 63 changed) OCL=27653 CL=27694
2009-04-20Refactor exvar to use interface types, and add mapVar.David Symonds1-20/+117
R=r APPROVED=r DELTA=170 (136 added, 6 deleted, 28 changed) OCL=27628 CL=27652
2009-04-20Use the mutex in exvar.Set since map access is not atomic.David Symonds1-0/+3
Imagine your var has a value of zero. If you have a goroutine calling Set(5), and another calling Increment(+1), then you only want one of these outcomes: - Set completes first, and then Increment occurs => 6 - Increment completes first, and then Set occurs => 5 However, you could get a sequence: - read (for Increment) 0 - set (for Set) 5 - write (for Increment) 1 This results in a value of 1, which is undesirable. Kudos to dnadasi for catching this. R=r APPROVED=r DELTA=3 (3 added, 0 deleted, 0 changed) OCL=27625 CL=27625
2009-04-19Initial cut at an "exported variables" (exvar) package.David Symonds1-0/+60
This handles integer-valued vars in a singleton struct, and exports functions for incrementing, setting and getting those vars, as well as rendering all the vars in a standard format. Demonstrate the use of the exvar package in the http/triv server. R=dcross,r APPROVED=r DELTA=122 (122 added, 0 deleted, 0 changed) OCL=27617 CL=27622