-
Notifications
You must be signed in to change notification settings - Fork 9
Views
Views are a way of interacting with a set of interfaces defined by a combination of metadata and characteristics of the URI.
There are many advantages to using views:
a) the set of resources contained in a view may span several namespaces and servers. b) the view will automatically update your subscriptions as members enter and leave the view. c) you can interact with interfaces without knowing how many they are or where they are
A view is defined by an immutable expression specified when it is created. This expression takes the form of:
{
"ns": namespace_list,
"meta": metadata_qualifiers,
"uri": uri_attributes,
}
There are a few other attributes as well, but they are not yet tested. The namespace_list is a list of namespaces that the view will be evaluated over. It is optional if there are uri_attributes that also contain the namespaces within the URIs. The metadata_qualifiers must match interfaces for them to be included in the view. At present this is only equality testing. The uri qualifiers may specify glob or regex testing.
{
"ns": ["scratch.ns"],
"meta": {
"key1":"value",
"key2":"value2"
}
"uri": {"$re":".*foobar.*"}
}
You can also combine expressions, for example
{
"$or": [
{"uri":{"$re":"pat1"}},
{"meta":{"key":"val"}}
]
}
There is also a query construct to determine if a metadata key exists:
{
"meta": {"$has": "keyname"},
}
To check if multiple keys exist, use the $and
construct:
{
"$and": [
{"$has": "key1"},
{"$has": "key2"},
],
}