unexport all data abstractions on Server (#618)

this patch has no behavior changes, changes are:

* server.Datastore() -> server.datastore
* server.MQ -> server.mq
* server.LogDB -> server.logstore
* server.Agent -> server.agent

these were at a minimum not uniform. further, it's probably better to force
configuration through initialization in `server.New` to ensure thread safety
of referencing if someone does want to modify these as well as forcing things
into our initialization path and reducing the surface area of the Server
abstraction.
This commit is contained in:
Reed Allman
2017-12-21 13:21:02 -06:00
committed by GitHub
parent 6d71f2acc2
commit a8a3e143c7
20 changed files with 57 additions and 54 deletions

View File

@@ -55,7 +55,7 @@ func parseParams(params gin.Params) agent.Params {
func (s *Server) serve(c *gin.Context, appName, path string) {
// GetCall can mod headers, assign an id, look up the route/app (cached),
// strip params, etc.
call, err := s.Agent.GetCall(
call, err := s.agent.GetCall(
agent.WithWriter(c.Writer), // XXX (reed): order matters [for now]
agent.FromRequest(appName, path, c.Request, parseParams(c.Params)),
)
@@ -85,7 +85,7 @@ func (s *Server) serve(c *gin.Context, appName, path string) {
model.Payload = buf.String()
// TODO idk where to put this, but agent is all runner really has...
err = s.Agent.Enqueue(c.Request.Context(), model)
err = s.agent.Enqueue(c.Request.Context(), model)
if err != nil {
handleErrorResponse(c, err)
return
@@ -95,7 +95,7 @@ func (s *Server) serve(c *gin.Context, appName, path string) {
return
}
err = s.Agent.Submit(call)
err = s.agent.Submit(call)
if err != nil {
// NOTE if they cancel the request then it will stop the call (kind of cool),
// we could filter that error out here too as right now it yells a little