-
Notifications
You must be signed in to change notification settings - Fork 23
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
Implement reminder provider #15
Conversation
Could this be done using a single SortedSet, queried by I think your approach is fine, too. Redis is not designed for scalability. |
@ReubenBond I updated it with using a single SortedSet to do this. $"{hashCode:X8}_{grainRef}_{reminderName}:{eTag}:{new {entry.StartAt, entry.Period}}" But this pattern is quite fragile since any ':' or '_' in reminder name or string-typed grain id will break it. I think using a json array for this may be a better idea, I'll try it later |
@suraciii, please let me know when you feel this is ready for final review |
Hi @ReubenBond , It's ready for review now |
This PR implemented reminder provider based on Redis.
As a reminder table implementation, it needs to support various queries for reminders:
In this implementation, all reminders are stored in a single
SortedSet
in Redis, and the data of reminder is formatted as serialized JSON array like this:["$grainHash","$grainRef.ToKeyString()","$reminderName","$eTag","$startAt.ToString("O")","$period.ToString()"]
So that reminders can be queried by following filters:
["$grainHash","$grainRef.ToKeyString()","$reminderName","
["$grainHash","$grainRef.ToKeyString()","
["$grainHashStart","
and["$grainHashEnd","
["$grainHash","$grainRef.ToKeyString()","$reminderName","$eTag","
Unfortunately, Redis doesn't support multi-indexes natively, so the data need to be stored in various places to support various queries:
1. in HashSet:
$"{serviceId}_{grainRef.ToKeyString()}_{reminderName}"
, it has two fieldsETag
andData
, one HashSet only has one reminder's data.2. in HashSet:
$"{serviceId}_{grainRef.ToKeyString()}"
, it stores all reminders of a grain, reminder names are set as field keys, so that we can query reminders by a grain.3. in SortedSet:$"{serviceId}_GrainHashIndex"
, it stores all reminders with grain hashes as scores, so that we can query reminders by a range of grain hash.