Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[proxy] new proxy interface v0.1 #233

Merged
merged 5 commits into from
Jan 24, 2017
Merged

[proxy] new proxy interface v0.1 #233

merged 5 commits into from
Jan 24, 2017

Conversation

mikz
Copy link
Contributor

@mikz mikz commented Jan 19, 2017

This is one of the series of PRs trying to get rid of the global configuration store.
That would allow us to implement multi-tenancy, configuration lazy loading (per host),
proper expiration and just better unit testing the whole thing.

  • start moving from class methods to instance methods
  • allow object local configuration
  • rename provider to proxy
  • introduce module instances

The idea behind this is paving path forward the
per request configuration store (#224).

Then every proxy object could have own configuration loaded from somewhere else.

Changes to the interface are not final and likely will be changed in further PRs.

/cc @davidor

@mikz mikz force-pushed the proxy-interface branch 4 times, most recently from 5b7c836 to 2ca17c7 Compare January 20, 2017 09:49
mikz added 4 commits January 24, 2017 07:31
* rename provider to proxy
* try to use instance over class methods
module gets instantiated in rewrite phase
and then reused and called with self in each other phase

that allows modules to have internal state across the request

example:

```lua
local _M = { }
local mt = { __index = _M }

function _M.new()
  return setmetatable({ id = 42 }, mt)
end

function _M:rewrite()
  local id = self.id
  ngx.say(id) -- prints 42
end
```
using context for everything is not performant as having local state
also it is easier to test and reason about when everything
is encapsulated in one object
@mikz mikz self-assigned this Jan 24, 2017
@mikz mikz merged commit 244c468 into master Jan 24, 2017
@mikz mikz deleted the proxy-interface branch January 24, 2017 06:50
@mikz mikz removed the in progress label Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant