Thanks to visit codestin.com
Credit goes to github.com

Skip to content

effect_performer idea #55

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

Closed
wants to merge 1 commit into from
Closed

effect_performer idea #55

wants to merge 1 commit into from

Conversation

manishtomar
Copy link
Contributor

A performer for intents that return effect. This is idea I had. Will add tests after initial review. For example, tenant scope performer can be written as:

@effect_performer
def perform_tenant_scope(
        authenticator, log, service_configs, throttler,
        dispatcher, tenant_scope,
        _concretize=concretize_service_request):
    """
    Perform a :obj:`TenantScope` by performing its :attr:`TenantScope.effect`,
    with a dispatcher extended with a performer for :obj:`ServiceRequest`
    intents. The performer will use the tenant provided by the
    :obj:`TenantScope`.
    """
    @sync_performer
    def scoped_performer(dispatcher, service_request):
        return _concretize(
            authenticator, log, service_configs, throttler,
            tenant_scope.tenant_id, service_request)
    new_disp = ComposedDispatcher([
        TypeDispatcher({ServiceRequest: scoped_performer}),
        dispatcher])
    return new_disp, tenant_scope.effect

@radix
Copy link
Contributor

radix commented May 27, 2015

This is nice.

I think the name and description is a bit confusing and not very precise: there are lots of performers that return effects. e.g. otter's perform_retry and concretize_service_request and these wouldn't benefit from this wrapper.

This decorator is specifically useful for wrapper effects that want to change the way nested effects are performed by extending or otherwise changing the dispatcher.

I won't suggest any better names/descriptions yet. we can think on it :)

@radix
Copy link
Contributor

radix commented Nov 24, 2019

I'm closing this because it's been sitting here for over four years, and I don't think I'm going to do anything with it any time soon (´。_。`)

@radix radix closed this Nov 24, 2019
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.

2 participants