Commit Graph

126 Commits

Author SHA1 Message Date
Brian Picciano
e1e52db208 refactor everything to use context's annotation system, making some significant changes to annotations themselves along the way 2019-02-24 15:36:07 -05:00
Brian Picciano
000a57689d mctx: implement beginnings of Annotations functionality 2019-02-08 18:44:20 -05:00
Brian Picciano
4b446a0efc mctx: refactor so that contexts no longer carry mutable data
This change required refactoring nearly every package in this project,
but it does a lot to simplify mctx and make other code using it easier
to think about.

Other code, such as mlog and mcfg, had to be slightly modified for this
change to work as well.
2019-02-07 19:42:12 -05:00
Brian Picciano
0c2c49501e mctx: refactor implementation of Context to not use a state stored as a value, but to just wrap a context.Context 2019-02-03 19:25:46 -05:00
Brian Picciano
5dc8d92987 mdb/mpubsub: refactor to use new mctx/mlog/mcfg stuff 2019-02-03 16:05:46 -05:00
Brian Picciano
8ddf1348db mdb/mdatastore: refactor to use new mctx/mlog/mcfg stuff 2019-02-03 16:05:33 -05:00
Brian Picciano
40794d83b8 mdb/mbigtable: refactor to use new mctx/mlog/merr stuff 2019-02-02 21:57:11 -05:00
Brian Picciano
a5446b0833 mdb/mbigquery: refactor to use new mctx/mlog/merr stuff 2019-02-02 21:56:54 -05:00
Brian Picciano
608eb90274 mdb: refactor to use new mctx stuff 2019-02-02 21:56:32 -05:00
Brian Picciano
f783b62f6f mtest: implement NewCtx and Run, and use them in mnet and mhttp's tests 2019-02-02 20:58:18 -05:00
Brian Picciano
c6e29715b0 merr: implement WithKV 2019-02-02 20:18:39 -05:00
Brian Picciano
526639041b mnet: make sure listen-addr param's usage starts with uppercase 2019-02-02 19:55:42 -05:00
Brian Picciano
f02f2904b0 mcfg: ensure all usages end in a period when printing help to cli 2019-02-02 19:35:30 -05:00
Brian Picciano
6adfbdbcfb m: implement NewServiceCtx, use it in totp-proxy 2019-02-02 19:27:28 -05:00
Brian Picciano
15b84cb173 mlog: implement LevelFromString 2019-02-02 19:27:10 -05:00
Brian Picciano
20c6f95091 mlog: refactor to use Clone/Set instead of With pattern, implement CtxSetAll 2019-01-30 16:06:24 -05:00
Brian Picciano
5bd0790f6e mctx: implement BreadthFirstVisit 2019-01-30 16:04:58 -05:00
Brian Picciano
8e2cffd65b mcfg: make ParamValue not embed Param, so that a Source which is []ParamValue makes sense, and can replace SourceMap 2019-01-25 17:33:36 -05:00
Brian Picciano
ddd26259b2 merr: make New take in optional key/value pairs for convenience 2019-01-25 17:32:53 -05:00
Brian Picciano
b33b157e15 mcfg: update docs to make running Populate more than once explicitly allowed 2019-01-25 16:46:39 -05:00
Brian Picciano
a24262f295 mlog: update function docs 2019-01-25 16:39:57 -05:00
Brian Picciano
e9416dbe2a mlog: update package doc example 2019-01-25 16:29:22 -05:00
Brian Picciano
79bf3d6f89 totp-proxy: update to use new mctx/mcfg/mrun framework 2019-01-24 22:05:17 -05:00
Brian Picciano
a00a268256 m: implement Run function, which glues together mcfg.Populate, mrun.Start, and mrun.Stop 2019-01-24 22:04:58 -05:00
Brian Picciano
05a69589bc mcfg: use merr for returned errors, and make help output prioritize required params towards the top 2019-01-24 22:02:04 -05:00
Brian Picciano
ef2e76de45 mhttp: implement MListenAndServe, using new mctx/mrun/mcfg framework 2019-01-24 19:23:04 -05:00
Brian Picciano
a0a531cdd2 mnet: add MListener.CloseOnStop, to allow for http.Server.Shutdown (and other entities) closing the listener instead 2019-01-24 19:19:57 -05:00
Brian Picciano
5f864c44f2 mrun: make Thread's callback not take in a context, it doesn't really help anything 2019-01-24 19:18:44 -05:00
Brian Picciano
bd4d7fc9e3 mnet: export MListener and add some debug logging 2019-01-24 16:54:38 -05:00
Brian Picciano
405120513f merr: move With/GetValue to kv.go, make nil error behavior be explicitly defined and tested 2019-01-24 16:45:38 -05:00
Brian Picciano
0e80e1fd3d mlog: remove ErrKV/ErrWithKV, merr.KV/merr.WithValue are used instead 2019-01-15 00:00:24 -05:00
Brian Picciano
56f3e71acd merr: initial implementation, designed to replace merry and work nicely with mlog, while allowing support for multi-errors and other niceties in the future 2019-01-15 00:00:24 -05:00
Brian Picciano
33a10a4ac7 mlog: make the map returned from a KVer be read-only and allowed to be nil 2019-01-14 23:58:58 -05:00
Brian Picciano
1562c4e8f6 mlog: redefine KVer to return a map[string]interface, not a KV, to allow other packages to implement KVer without importing mlog 2019-01-14 23:58:55 -05:00
Brian Picciano
fe07e1cfdc mnet: better logging for MListen 2019-01-12 21:01:16 -05:00
Brian Picciano
57db101c02 mlog: add Logger.WithKV, slightly change Message type to support it 2019-01-12 21:01:00 -05:00
Brian Picciano
448008cb7c mrun: move Hook code into hook.go 2019-01-12 20:14:02 -05:00
Brian Picciano
0fb0cb92a0 mnet: ListenerOnStart -> MListen, and have it close on mrun.Stop 2019-01-12 20:11:22 -05:00
Brian Picciano
0ef6997f40 mlog: fix bug which caused the DefaultHandler to not ever call Flush 2019-01-12 20:10:45 -05:00
Brian Picciano
ee77656f39 mrun: rename functions and add another trigger function which will run hooks in reverse, for use in OnStop 2019-01-12 19:55:41 -05:00
Brian Picciano
8a8cebd127 mnet: implement ListenerOnStart 2019-01-11 17:47:30 -05:00
Brian Picciano
96db88b7d0 mcfg: allow Source param to Populate to be nil 2019-01-11 17:44:53 -05:00
Brian Picciano
57c400a151 mrun: update docs a bit 2019-01-10 18:12:39 -05:00
Brian Picciano
48bb21668a mrun: implement rudimentary event system built on top of mctx 2019-01-10 18:06:34 -05:00
Brian Picciano
92ecb09707 mctx: make GetSetMutableValue lock on the key itself, not the entire map, to allow more throughput when being used on multiple keys at once 2019-01-10 17:22:58 -05:00
Brian Picciano
6e8338a5f8 mcfg: refactor to remove Child and Hook stuff, and use mctx instead 2019-01-08 14:21:55 -05:00
Brian Picciano
57bd022093 mrun: implement Thread and Wait 2018-12-05 23:40:46 -05:00
Brian Picciano
2f647017b9 mlog: add CtxSet and From functions 2018-11-30 18:50:23 -05:00
Brian Picciano
2e269bb6e7 mlog: refactor to use a Stringer for Message.Description 2018-11-30 18:50:08 -05:00
Brian Picciano
b5c676b5c8 mlog: complete refactor again, eliminating the go-routine, which allowed a lot of other things to fall into place nicely 2018-11-30 16:27:18 -05:00