MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / compareVersion

Function compareVersion

src/server.cpp:1866–1898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1864}
1865
1866VersionCompareResult compareVersion(SymVer *pver)
1867{
1868 SymVer symVerThis = parseVersion(KEYDB_REAL_VERSION);
1869 // Special case, 0.0.0 is equal to any version
1870 if ((symVerThis.major == 0 && symVerThis.minor == 0 && symVerThis.build == 0)
1871 || (pver->major == 0 && pver->minor == 0 && pver->build == 0))
1872 return VersionCompareResult::EqualVersion;
1873
1874 if (pver->major <= 6 && pver->minor <= 3 && pver->build <= 3)
1875 return VersionCompareResult::IncompatibleVersion;
1876
1877 for (int iver = 0; iver < 3; ++iver)
1878 {
1879 long verThis, verOther;
1880 switch (iver)
1881 {
1882 case 0:
1883 verThis = symVerThis.major; verOther = pver->major;
1884 break;
1885 case 1:
1886 verThis = symVerThis.minor; verOther = pver->minor;
1887 break;
1888 case 2:
1889 verThis = symVerThis.build; verOther = pver->build;
1890 }
1891
1892 if (verThis < verOther)
1893 return VersionCompareResult::NewerVersion;
1894 if (verThis > verOther)
1895 return VersionCompareResult::OlderVersion;
1896 }
1897 return VersionCompareResult::EqualVersion;
1898}
1899
1900/* This function is used in order to track clients using the biggest amount
1901 * of memory in the latest few seconds. This way we can provide such information

Callers 2

mainFunction · 0.85
RocksDBStorageFactoryMethod · 0.85

Calls 1

parseVersionFunction · 0.85

Tested by

no test coverage detected