Skip to content

Prefix based router support#12

Open
tschellenbach wants to merge 10 commits into
disqus:masterfrom
tschellenbach:f98d64b6
Open

Prefix based router support#12
tschellenbach wants to merge 10 commits into
disqus:masterfrom
tschellenbach:f98d64b6

Conversation

@tschellenbach
Copy link
Copy Markdown

Routes based on the configured prefixes

Example config:

'redis': {
    'engine': 'nydus.db.backends.redis.Redis',
    'router': 'django_redis.nydus_router.PrefixPartitionRouter',
    'hosts': {
        'default': {'db': 0, 'host': 'default.redis.goteam.be', 'port': 6379},
        'user:loves:': {'db': 1, 'host': 'default.redis.goteam.be', 'port': 6379},
        'loves:': {'db': 2, 'host': 'default.redis.goteam.be', 'port': 6379},
        'hash:entity:': {'db': 0, 'host': 'entities.redis.goteam.be', 'port': 6379},
    }
}

We route to one and only one redis.
Use a seperate config if you want hashing based partitioning.

Comment thread nydus/db/routers/prefix_partition.py Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path needs updated, right?

@dcramer
Copy link
Copy Markdown
Collaborator

dcramer commented May 16, 2012

I wonder if this would be a good time to add some kind of router options to the configuration.

That could help a lot if we wanted to address #11 by not requiring the dict config approach

Comment thread nydus/db/routers/prefix_partition.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps I missed something, but is there a default host in your example docstring?

@Fluxx
Copy link
Copy Markdown
Contributor

Fluxx commented May 16, 2012

Nice work. Can you also add a couple more tests to test the code paths in PrefixPartitionRouter.route() that raise exceptions?

@tschellenbach
Copy link
Copy Markdown
Author

Awesome, thanks for the very thorough feedback. Good to see such traction behind the project.

We've forked Nydus for 2 reasons.

  • PrefixPartition support
  • Silent failures when using redis as a cache.

Both features are unit tested and included in the pull request.
Hope you guys like the suggestions.

@thedrow
Copy link
Copy Markdown

thedrow commented Mar 19, 2014

Why wasn't this merged?

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.

4 participants