MCPcopy Create free account
hub / github.com/apache/brpc / GenerateVersionIfNeeded

Method GenerateVersionIfNeeded

src/brpc/server.cpp:1795–1840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1793}
1794
1795void Server::GenerateVersionIfNeeded() {
1796 if (!_version.empty()) {
1797 return;
1798 }
1799 int extra_count = !!_options.nshead_service + !!_options.rtmp_service +
1800 !!_options.thrift_service + !!_options.redis_service;
1801 _version.reserve((extra_count + service_count()) * 20);
1802 for (ServiceMap::const_iterator it = _fullname_service_map.begin();
1803 it != _fullname_service_map.end(); ++it) {
1804 if (it->second.is_user_service()) {
1805 if (!_version.empty()) {
1806 _version.push_back('+');
1807 }
1808 _version.append(butil::class_name_str(*it->second.service));
1809 }
1810 }
1811 if (_options.nshead_service) {
1812 if (!_version.empty()) {
1813 _version.push_back('+');
1814 }
1815 _version.append(butil::class_name_str(*_options.nshead_service));
1816 }
1817
1818#ifdef ENABLE_THRIFT_FRAMED_PROTOCOL
1819 if (_options.thrift_service) {
1820 if (!_version.empty()) {
1821 _version.push_back('+');
1822 }
1823 _version.append(butil::class_name_str(*_options.thrift_service));
1824 }
1825#endif
1826
1827 if (_options.rtmp_service) {
1828 if (!_version.empty()) {
1829 _version.push_back('+');
1830 }
1831 _version.append(butil::class_name_str(*_options.rtmp_service));
1832 }
1833
1834 if (_options.redis_service) {
1835 if (!_version.empty()) {
1836 _version.push_back('+');
1837 }
1838 _version.append(butil::class_name_str(*_options.redis_service));
1839 }
1840}
1841
1842void Server::PutPidFileIfNeeded() {
1843 if (_options.pid_file.empty()) {

Callers

nothing calls this directly

Calls 8

class_name_strFunction · 0.85
is_user_serviceMethod · 0.80
emptyMethod · 0.45
reserveMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected