Changeset a7ed2df4af73c424e86f7d049a4b2e76a629b2f2
- Timestamp:
- 05/04/09 04:18:14
(4 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1241410694 +0000
- git-parent:
[85630250d38266fa902fea78b996af7521d31ebc]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1241410694 +0000
- Message:
closes #117, this hooks the ops
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r6210da7 |
ra7ed2df |
|
| 31 | 31 | static char *config_insert = NULL; |
|---|
| 32 | 32 | static const char *config_insert_conf = "/stratcon/database/statements/config"; |
|---|
| | 33 | |
|---|
| | 34 | static struct datastore_onlooker_list { |
|---|
| | 35 | void (*dispatch)(stratcon_datastore_op_t, struct sockaddr *, void *); |
|---|
| | 36 | struct datastore_onlooker_list *next; |
|---|
| | 37 | } *onlookers = NULL; |
|---|
| 33 | 38 | |
|---|
| 34 | 39 | #define GET_QUERY(a) do { \ |
|---|
| … | … | |
| 577 | 582 | eventer_t e; |
|---|
| 578 | 583 | ds_job_detail *dsjd; |
|---|
| | 584 | struct datastore_onlooker_list *nnode; |
|---|
| | 585 | |
|---|
| | 586 | for(nnode = onlookers; nnode; nnode = nnode->next) |
|---|
| | 587 | nnode->dispatch(op,remote,operand); |
|---|
| 579 | 588 | |
|---|
| 580 | 589 | cq = __get_conn_q_for_remote(remote); |
|---|
| … | … | |
| 636 | 645 | return rv; |
|---|
| 637 | 646 | } |
|---|
| | 647 | |
|---|
| | 648 | void |
|---|
| | 649 | stratcon_datastore_register_onlooker(void (*f)(stratcon_datastore_op_t, |
|---|
| | 650 | struct sockaddr *, void *)) { |
|---|
| | 651 | struct datastore_onlooker_list *nnode; |
|---|
| | 652 | nnode = calloc(1, sizeof(*nnode)); |
|---|
| | 653 | nnode->dispatch = f; |
|---|
| | 654 | nnode->next = onlookers; |
|---|
| | 655 | while(noit_atomic_casptr((void **)&onlookers, nnode, nnode->next) != nnode->next) |
|---|
| | 656 | nnode->next = onlookers; |
|---|
| | 657 | } |
|---|
| r21b0c6c |
ra7ed2df |
|
| 25 | 25 | struct sockaddr *, void *); |
|---|
| 26 | 26 | |
|---|
| | 27 | API_EXPORT(void) |
|---|
| | 28 | stratcon_datastore_register_onlooker(void (*f)(stratcon_datastore_op_t, |
|---|
| | 29 | struct sockaddr *, void *)); |
|---|
| | 30 | |
|---|
| 27 | 31 | API_EXPORT(int) |
|---|
| 28 | 32 | stratcon_datastore_saveconfig(void *unused); |
|---|