1PMSEARCHSETUP(3) Library Functions Manual PMSEARCHSETUP(3)
2
3
4
6 pmSearchSetup, pmSearchSetSlots, pmSearchSetEventLoop, pmSearchSetCon‐
7 figuration, pmSearchSetMetricRegistry, pmSearchClose - fast, scalable
8 and fulltext capable search services
9
11 #include <pcp/pmwebapi.h>
12
13 int pmSearchSetup(pmSearchModule *module, void *arg);
14
15 int pmSearchSetSlots(pmSearchModule *module, void *slots);
16 int pmSearchSetEventLoop(pmSearchModule *module, void *events);
17 int pmSearchSetConfiguration(pmSearchModule *module, struct dict
18 *config);
19 int pmSearchSetMetricRegistry(pmSearchModule *module, struct
20 mmv_registry *registry);
21
22 int pmSearchClose(pmSearchModule *module);
23
24 cc ... -lpcp_web
25
27 The pmSearchSetup and related API functions prepare an application for
28 accessing the fast and scalable metric, instance and instance domain,
29 fulltext capable, searching functionality of the Performance Co-Pilot
30 (PCP).
31
32 This functionality is provided trough asynchronous APIs, which function
33 in event-driven fashion. The interface described here prepare a given
34 search module which associates callback routines with certain asynchro‐
35 nous events that occur as part of servicing search requests.
36
37 As a general pattern, all interfaces in these APIs that need to invoke
38 callbacks provided by the calling program will take an opaque (void *
39 pointer) arg parameter. This pointer will be passed through unchanged
40 and is typically used to access a data structure maintaining state
41 within the calling program.
42
43 Where asynchronous setup is required by pmSearchSetup its completion
44 will be indicated throught use of the on_setup callback, which is part
45 of the passed in pmSearchModule structure. This structure also provides
46 for custom diagnostics handling, through the on_info callback. These
47 are self-explanatory, see <pcp/pmwebapi.h> for exact calling conven‐
48 tions.
49
50 The callbacks registered by pmSearchSetup to handle events are as fol‐
51 lows:
52
53 pmSearchTextResultCallBack on_text_result
54 Callback is called once for each item of search result that match‐
55 es a given query passed by pmSearchTextInDom(3), pmSearchText‐
56 Query(3), pmSearchTextSuggest(3).
57
58 pmSearchMetricsCallBack on_metrics
59 Callback is called for results of a call to pmSearchInfo(3).
60
61 pmSearchDoneCallBack on_done
62 On completion of all asynchronous interfaces that return success
63 (zero return code), this callback will be called. It provides a
64 status code indicating overall success (zero) or failure (negative
65 PMAPI code) of the operation.
66
67 The helper functions pmSearchSetSlots (redis), pmSearchSetEventLoop
68 (libuv), pmSearchSetConfiguration (configuration file) and pmSearchSet‐
69 MetricRegistry (MMV instrumentation) interfaces provide a mechanism for
70 passing in state for each of the associated subsystems.
71
72 Finally, a call to pmSearchClose is used to end services available from
73 a search module previously enstablished through pmSearchSetup.
74
75 Within PCP, the pmproxy(1) and pmsearch(1) utilities are the primary
76 users of the interfaces, providing REST API and command line search
77 services respectively.
78
80 Where these functions return a status code, this is always zero on suc‐
81 cess. On failure a negative PMAPI error code is returned.
82
84 pmproxy(1), pmlogger(1), pmsearch(1), redis-server(1), mmv_stats_reg‐
85 istry(3), pmSearchInfo(3), pmSearchTextInDom(3), pmSearchTextQuery(3),
86 pmSearchTextSuggest(3), PMAPI(3) and PMWEBAPI(3).
87
88
89
90Performance Co-Pilot PCP PMSEARCHSETUP(3)