Lines Matching refs:group
93 // get remote watcher and group
99 auto group = AddWatcherGroup(keyPrefix);
100 WATCHER_CHECK(group != nullptr, return -1, "Failed to create group for %s", keyPrefix.c_str());
102 // add watcher to agent and group
103 bool newGroup = group->Empty();
104 AddParamWatcher(group, remoteWatcher);
107 SendMessage(group, MSG_ADD_WATCHER);
112 keyPrefix.c_str(), remoteWatcherId, group->GetGroupId());
120 auto group = GetWatcherGroup(keyPrefix);
121 WATCHER_CHECK(group != nullptr, return 0, "Can not find group %s", keyPrefix.c_str());
128 // remove watcher from agent and group
129 DelParamWatcher(group, remoteWatcher);
130 if (group->Empty()) { // no watcher, so delete it
131 SendMessage(group, MSG_DEL_WATCHER);
132 DelWatcherGroup(group);
148 auto group = GetWatcherGroup(keyPrefix);
149 WATCHER_CHECK(group != nullptr, return 0, "Can not find group %s", keyPrefix.c_str());
154 int WatcherManager::SendMessage(WatcherGroupPtr group, int type)
157 std::string key(group->GetKeyPrefix());
163 request->id.watcherId = group->GetGroupId();
176 WATCHER_CHECK(ret == 0, return ret, "SendMessage key: %s %d fail!", group->GetKeyPrefix().c_str(), type);
214 WATCHER_LOGV("Process watcher message name '%s' group id %u ", msg->key, msg->id.watcherId);
217 WatcherGroupPtr group = GetWatcherGroup(msg->id.watcherId);
218 WATCHER_CHECK(group != NULL, return, "Can not find group for %u %s", msg->id.watcherId, msg->key);
219 if (!FilterParam(msg->key, group->GetKeyPrefix())) {
220 WATCHER_LOGV("Invalid message name '%s' group '%s' ", msg->key, group->GetKeyPrefix().c_str());
223 group->ProcessParameterChange(this, msg->key, valueContent->content);
406 auto group = GetWatcherGroup(node->GetNodeId());
407 if (group == nullptr) {
410 // delete node from group and remote
411 DelParamWatcher(group, remoteWatcher);
412 if (group->Empty()) { // no watcher, so delete it
413 SendMessage(group, MSG_DEL_WATCHER);
414 DelWatcherGroup(group);
466 auto group = it->second;
467 dprintf(fd, "Watch prefix : %s \n", group->GetKeyPrefix().c_str());
468 dprintf(fd, "Watch group id : %u \n", group->GetGroupId());
469 dprintf(fd, "Watch count : %u \n", group->GetNodeCount());
470 group->TraversalNode(dumpHandle);
471 count += group->GetNodeCount();
485 WATCHER_CHECK(watcherGroups_ != 0, return -1, "Invalid watcher group");
512 auto group = GetWatcherGroup(params[1]);
513 if (group == NULL) {
518 group->TraversalNode(dumpParamWatcher);
532 auto group = ConvertTo<WatcherGroup>(node);
533 WATCHER_LOGV("Delete watcher group %u", group->GetGroupId());
534 delete group;
574 int WatcherManager::AddParamWatcher(WatcherGroupPtr group, RemoteWatcherPtr remoteWatcher)
576 WatcherNodePtr nodeGroup = new ParamWatcher(group->GetGroupId());
577 WATCHER_CHECK(nodeGroup != nullptr, return -1, "Failed to create watcher node for group");
581 group->AddNode(nodeRemote);
586 int WatcherManager::DelParamWatcher(WatcherGroupPtr group, RemoteWatcherPtr remoteWatcher)
588 WATCHER_LOGI("Delete param watcher remoteWatcherId %u group %u",
589 remoteWatcher->GetRemoteWatcherId(), group->GetGroupId());
590 WatcherNodePtr node = group->GetNode(remoteWatcher->GetRemoteWatcherId());
592 group->RemoveNode(node);
595 node = remoteWatcher->GetNode(group->GetGroupId());
609 // get group
614 // create group
617 WATCHER_CHECK(ret == 0, return nullptr, "Failed to get group id for %s", keyPrefix.c_str());
618 WatcherGroupPtr group = new WatcherGroup(groupId, keyPrefix);
619 WATCHER_CHECK(group != nullptr, return nullptr, "Failed to create group for %s", keyPrefix.c_str());
620 watcherGroups_->AddNode(ConvertTo<WatcherNode>(group));
621 groupMap_[keyPrefix] = group;
622 return group;
637 // get group
645 void WatcherManager::DelWatcherGroup(WatcherGroupPtr group)
648 WATCHER_LOGI("Delete watcher group %s %u", group->GetKeyPrefix().c_str(), group->GetGroupId());
649 watcherGroups_->RemoveNode(ConvertTo<WatcherNode>(group));
650 auto it = groupMap_.find(group->GetKeyPrefix());
654 delete group;
783 WATCHER_LOGV("delete watcher group %u", watcher->GetNodeId());