|
struct | _ds5_namespace_s |
| Definition of the interface that you should implement if you require custom subject matching logic. More...
|
|
A namespace is used to determine whether a subject is of interest to either a ds5_dataprovider_t or to a ds5_subscription_t. A subject name is defined within a particular DataSource namespace. For example, if the DataSource namespace is the prefix "/FX" the subject name "/FX/EURUSD" is within that namespace, but the subject name "/FY/EURUSD" is not. The interface that represents a DataSource namespace is ds5_namespace_t.
A ds5_namespace_t is used to construct a ds5_publisher_t and to ensure that the associated ds5_dataprovider_t only receives requests for subjects that it can supply.
DataSource for C provides implementations of prefix based, regex (with inclusions and exclusions) and "filename" globbing implementation ofs the ds5_namespace_t interface. These will generally cover most usecase, however if you wish to implement more custom algorithms, then you can write your open implementaton of ds5_namespace_t.
#define ds5_namespace_free |
( |
|
nspace | ) |
nspace->free(nspace) |
A convenience macro for invoking the ds5_namespace_t::delete() function on a namespace.
- Parameters
-
nspace | - The namespace to be deleted. |
#define ds5_namespace_match |
( |
|
nspace, |
|
|
|
subject |
|
) |
| nspace->match(nspace, subject) |
A convenience macro for invoking the ds5_namespace_t::match() function on a namespace.
- Parameters
-
nspace | - The namespace. |
subject | - The subject to match. |
- Return values
-
0 | - The subject matches. |
!0 | - The subject does not match. |
Typedef to the definition of the interface for defining DataSource namespaces.
Creates a DataSource namespace which will match subject names using globbing.
- Parameters
-
globbed | - The glob pattern to match against. |
- Returns
- A new DataSource namespace that will match subject names against the supplied pattern.
Creates a DataSource namespace which will match subject names based on their prefix.
- Parameters
-
prefix | - The prefix to test subject names against. |
- Returns
- A new DataSource namespace that will match subject names against the supplied prefix.
Creates a DataSource namespace which will match subject names using a regular expression.
- Parameters
-
- Returns
- A new DataSource namespace that will match subject names against the supplied expr.
- Note
- If expr == NULL, then you need to call ds5_regex_namespace_add_expr() to add regular expressions.
int ds5_regex_namespace_add_expr |
( |
ds5_namespace_t * |
nspace, |
|
|
const char * |
expr, |
|
|
int |
exclude |
|
) |
| |
Adds a regular expression to a namespace.
- Parameters
-
nspace | - The Regex namespace to add the regular expression to |
expr | - The regular expression to add |
exclude | - Zero if expr should be a match, non-zero if not |
- Return values
-
0 | - Successfully added |
-1 | - Invalid expression |
-2 | - nspace is not a regular expression namespace |
The namespace operates using a first match rule. Thus the first match will be the result, thus exclusions should be added before inclusions