-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
The RESP3 spec allows attributes to be set on an object to convey auxiliary information about that object.
https://github.com/antirez/RESP3/blob/master/spec.md#attribute-type
The big question is in how this ought to be returned by the protocol reader. For example, suppose we get a mapping that looks like this dict:
{
"foo": "bar" <- attribute on "bar"
}
Then how do we associate the attribute to the string "bar"? Ideally, attributes should be easily ignored by those who don't need them, but easy to work with by those who do.
Brainstormed solutions:
- Subclass everything so that an "attributes" attribute can be added to the objects. Doesn't seem ideal. I'd rather return the builtins than "RedisStr", etc., everywhere.
- Just insert the attributes where they are. Use a subclass of dict to distinguish it from a regular mapping. This might work when the attribute is already part of a collection already, but what if it's added to a response that's just an
intor astr? We could just return it in a tuple like (attributes, object), but that would require adding type checks to check when an attribute was returned. Plus, it violates the ideal that attributes should be easily ignored.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels