/usr/share/doc/swift-doc/html/object.html is in swift-doc 2.7.0-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Object — swift 2.7.0 documentation</title>
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/tweaks.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '2.7.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="swift 2.7.0 documentation" href="index.html" />
<link rel="next" title="Misc" href="misc.html" />
<link rel="prev" title="Account DB and Container DB" href="db.html" />
</head>
<body role="document">
<div id="header">
<h1 id="logo"><a href="http://www.openstack.org/">OpenStack</a></h1>
<ul id="navigation">
<li><a href="http://www.openstack.org/" title="Go to the Home page" class="link">Home</a></li>
<li><a href="http://www.openstack.org/projects/" title="Go to the OpenStack Projects page">Projects</a></li>
<li><a href="http://www.openstack.org/user-stories/" title="Go to the User Stories page" class="link">User Stories</a></li>
<li><a href="http://www.openstack.org/community/" title="Go to the Community page" class="link">Community</a></li>
<li><a href="http://www.openstack.org/blog/" title="Go to the OpenStack Blog">Blog</a></li>
<li><a href="http://wiki.openstack.org/" title="Go to the OpenStack Wiki">Wiki</a></li>
<li><a href="http://docs.openstack.org/" title="Go to OpenStack Documentation" class="current">Documentation</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="object">
<span id="id1"></span><h1>Object<a class="headerlink" href="#object" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-swift.obj.auditor">
<span id="id2"></span><span id="object-auditor"></span><h2>Object Auditor<a class="headerlink" href="#module-swift.obj.auditor" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="swift.obj.auditor.AuditorWorker">
<em class="property">class </em><code class="descclassname">swift.obj.auditor.</code><code class="descname">AuditorWorker</code><span class="sig-paren">(</span><em>conf</em>, <em>logger</em>, <em>rcache</em>, <em>devices</em>, <em>zero_byte_only_at_fps=0</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.AuditorWorker" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Walk through file system to audit objects</p>
<dl class="method">
<dt id="swift.obj.auditor.AuditorWorker.audit_all_objects">
<code class="descname">audit_all_objects</code><span class="sig-paren">(</span><em>mode='once'</em>, <em>device_dirs=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.AuditorWorker.audit_all_objects" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.auditor.AuditorWorker.create_recon_nested_dict">
<code class="descname">create_recon_nested_dict</code><span class="sig-paren">(</span><em>top_level_key</em>, <em>device_list</em>, <em>item</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.AuditorWorker.create_recon_nested_dict" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.auditor.AuditorWorker.failsafe_object_audit">
<code class="descname">failsafe_object_audit</code><span class="sig-paren">(</span><em>location</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.AuditorWorker.failsafe_object_audit" title="Permalink to this definition">¶</a></dt>
<dd><p>Entrypoint to object_audit, with a failsafe generic exception handler.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.auditor.AuditorWorker.object_audit">
<code class="descname">object_audit</code><span class="sig-paren">(</span><em>location</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.AuditorWorker.object_audit" title="Permalink to this definition">¶</a></dt>
<dd><p>Audits the given object location.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>location</strong> – an audit location
(from diskfile.object_audit_location_generator)</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.auditor.AuditorWorker.record_stats">
<code class="descname">record_stats</code><span class="sig-paren">(</span><em>obj_size</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.AuditorWorker.record_stats" title="Permalink to this definition">¶</a></dt>
<dd><p>Based on config’s object_size_stats will keep track of how many objects
fall into the specified ranges. For example with the following:</p>
<p>object_size_stats = 10, 100, 1024</p>
<p>and your system has 3 objects of sizes: 5, 20, and 10000 bytes the log
will look like: {“10”: 1, “100”: 1, “1024”: 0, “OVER”: 1}</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.auditor.ObjectAuditor">
<em class="property">class </em><code class="descclassname">swift.obj.auditor.</code><code class="descname">ObjectAuditor</code><span class="sig-paren">(</span><em>conf</em>, <em>**options</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.ObjectAuditor" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">swift.common.daemon.Daemon</span></code></p>
<p>Audit objects.</p>
<dl class="method">
<dt id="swift.obj.auditor.ObjectAuditor.audit_loop">
<code class="descname">audit_loop</code><span class="sig-paren">(</span><em>parent</em>, <em>zbo_fps</em>, <em>override_devices=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.ObjectAuditor.audit_loop" title="Permalink to this definition">¶</a></dt>
<dd><p>Parallel audit loop</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.auditor.ObjectAuditor.clear_recon_cache">
<code class="descname">clear_recon_cache</code><span class="sig-paren">(</span><em>auditor_type</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.ObjectAuditor.clear_recon_cache" title="Permalink to this definition">¶</a></dt>
<dd><p>Clear recon cache entries</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.auditor.ObjectAuditor.fork_child">
<code class="descname">fork_child</code><span class="sig-paren">(</span><em>zero_byte_fps=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.ObjectAuditor.fork_child" title="Permalink to this definition">¶</a></dt>
<dd><p>Child execution</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.auditor.ObjectAuditor.run_audit">
<code class="descname">run_audit</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.ObjectAuditor.run_audit" title="Permalink to this definition">¶</a></dt>
<dd><p>Run the object audit</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.auditor.ObjectAuditor.run_forever">
<code class="descname">run_forever</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.ObjectAuditor.run_forever" title="Permalink to this definition">¶</a></dt>
<dd><p>Run the object audit until stopped.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.auditor.ObjectAuditor.run_once">
<code class="descname">run_once</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.auditor.ObjectAuditor.run_once" title="Permalink to this definition">¶</a></dt>
<dd><p>Run the object audit once</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-swift.obj.diskfile">
<span id="object-backend"></span><span id="object-diskfile"></span><h2>Object Backend<a class="headerlink" href="#module-swift.obj.diskfile" title="Permalink to this headline">¶</a></h2>
<p>Disk File Interface for the Swift Object Server</p>
<p>The <cite>DiskFile</cite>, <cite>DiskFileWriter</cite> and <cite>DiskFileReader</cite> classes combined define
the on-disk abstraction layer for supporting the object server REST API
interfaces (excluding <cite>REPLICATE</cite>). Other implementations wishing to provide
an alternative backend for the object server must implement the three
classes. An example alternative implementation can be found in the
<cite>mem_server.py</cite> and <cite>mem_diskfile.py</cite> modules along size this one.</p>
<p>The <cite>DiskFileManager</cite> is a reference implemenation specific class and is not
part of the backend API.</p>
<p>The remaining methods in this module are considered implementation specific and
are also not considered part of the backend API.</p>
<dl class="class">
<dt id="swift.obj.diskfile.AuditLocation">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">AuditLocation</code><span class="sig-paren">(</span><em>path</em>, <em>device</em>, <em>partition</em>, <em>policy</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.AuditLocation" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Represents an object location to be audited.</p>
<p>Other than being a bucket of data, the only useful thing this does is
stringify to a filesystem path so the auditor’s logs look okay.</p>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.BaseDiskFile">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">BaseDiskFile</code><span class="sig-paren">(</span><em>mgr</em>, <em>device_path</em>, <em>threadpool</em>, <em>partition</em>, <em>account=None</em>, <em>container=None</em>, <em>obj=None</em>, <em>_datadir=None</em>, <em>policy=None</em>, <em>use_splice=False</em>, <em>pipe_size=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Manage object files.</p>
<p>This specific implementation manages object files on a disk formatted with
a POSIX-compliant file system that supports extended attributes as
metadata on a file or directory.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>The arguments to the constructor are considered implementation
specific. The API does not define the constructor arguments.</p>
<p class="last">The following path format is used for data file locations:
<devices_path/<device_dir>/<datadir>/<partdir>/<suffixdir>/<hashdir>/
<datafile>.<ext></p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>mgr</strong> – associated DiskFileManager instance</li>
<li><strong>device_path</strong> – path to the target device or drive</li>
<li><strong>threadpool</strong> – thread pool to use for blocking operations</li>
<li><strong>partition</strong> – partition on the device in which the object lives</li>
<li><strong>account</strong> – account name for the object</li>
<li><strong>container</strong> – container name for the object</li>
<li><strong>obj</strong> – object name for the object</li>
<li><strong>_datadir</strong> – override the full datadir otherwise constructed here</li>
<li><strong>policy</strong> – the StoragePolicy instance</li>
<li><strong>use_splice</strong> – if true, use zero-copy splice() to send data</li>
<li><strong>pipe_size</strong> – size of pipe buffer used in zero-copy operations</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.account">
<code class="descname">account</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.account" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.container">
<code class="descname">container</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.container" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.content_length">
<code class="descname">content_length</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.content_length" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.content_type">
<code class="descname">content_type</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.content_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.content_type_timestamp">
<code class="descname">content_type_timestamp</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.content_type_timestamp" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFile.create">
<code class="descname">create</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwds</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.create" title="Permalink to this definition">¶</a></dt>
<dd><p>Context manager to create a file. We create a temporary file first, and
then return a DiskFileWriter object to encapsulate the state.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">An implementation is not required to perform on-disk
preallocations even if the parameter is specified. But if it does
and it fails, it must raise a <cite>DiskFileNoSpace</cite> exception.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>size</strong> – optional initial size of file to explicitly allocate on
disk</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileNoSpace</strong> – if a size is specified and allocation fails</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.data_timestamp">
<code class="descname">data_timestamp</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.data_timestamp" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFile.delete">
<code class="descname">delete</code><span class="sig-paren">(</span><em>timestamp</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.delete" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete the object.</p>
<p>This implementation creates a tombstone file using the given
timestamp, and removes any older versions of the object file. Any
file that has an older timestamp than timestamp will be deleted.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">An implementation is free to use or ignore the timestamp
parameter.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timestamp</strong> – timestamp to compare with each file</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileError</strong> – this implementation will raise the same
errors as the <cite>create()</cite> method.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.durable_timestamp">
<code class="descname">durable_timestamp</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.durable_timestamp" title="Permalink to this definition">¶</a></dt>
<dd><p>Provides the timestamp of the newest data file found in the object
directory.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A Timestamp instance, or None if no data file was found.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileNotOpen</strong> – if the open() method has not been previously
called on this instance.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.fragments">
<code class="descname">fragments</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.fragments" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="classmethod">
<dt id="swift.obj.diskfile.BaseDiskFile.from_hash_dir">
<em class="property">classmethod </em><code class="descname">from_hash_dir</code><span class="sig-paren">(</span><em>mgr</em>, <em>hash_dir_path</em>, <em>device_path</em>, <em>partition</em>, <em>policy</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.from_hash_dir" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFile.get_datafile_metadata">
<code class="descname">get_datafile_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.get_datafile_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Provide the datafile metadata for a previously opened object as a
dictionary. This is metadata that was included when the object was
first PUT, and does not include metadata set by any subsequent POST.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">object’s datafile metadata dictionary</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileNotOpen</strong> – if the
<code class="xref py py-func docutils literal"><span class="pre">swift.obj.diskfile.DiskFile.open()</span></code> method was not previously
invoked</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFile.get_metadata">
<code class="descname">get_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.get_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Provide the metadata for a previously opened object as a dictionary.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">object’s metadata dictionary</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileNotOpen</strong> – if the
<code class="xref py py-func docutils literal"><span class="pre">swift.obj.diskfile.DiskFile.open()</span></code> method was not previously
invoked</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFile.get_metafile_metadata">
<code class="descname">get_metafile_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.get_metafile_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Provide the metafile metadata for a previously opened object as a
dictionary. This is metadata that was written by a POST and does not
include any persistent metadata that was set by the original PUT.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">object’s .meta file metadata dictionary, or None if there is
no .meta file</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileNotOpen</strong> – if the
<code class="xref py py-func docutils literal"><span class="pre">swift.obj.diskfile.DiskFile.open()</span></code> method was not previously
invoked</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.manager">
<code class="descname">manager</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.manager" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.obj">
<code class="descname">obj</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.obj" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFile.open">
<code class="descname">open</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.open" title="Permalink to this definition">¶</a></dt>
<dd><p>Open the object.</p>
<p>This implementation opens the data file representing the object, reads
the associated metadata in the extended attributes, additionally
combining metadata from fast-POST <cite>.meta</cite> files.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">An implementation is allowed to raise any of the following
exceptions, but is only required to raise <cite>DiskFileNotExist</cite> when
the object representation does not exist.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first simple">
<li><strong>DiskFileCollision</strong> – on name mis-match with metadata</li>
<li><strong>DiskFileNotExist</strong> – if the object does not exist</li>
<li><strong>DiskFileDeleted</strong> – if the object was previously deleted</li>
<li><strong>DiskFileQuarantined</strong> – if while reading metadata of the file
some data did pass cross checks</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">itself for use as a context manager</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFile.read_metadata">
<code class="descname">read_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.read_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the metadata for an object without requiring the caller to open
the object first.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">metadata dictionary for an object</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileError</strong> – this implementation will raise the same
errors as the <cite>open()</cite> method.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFile.reader">
<code class="descname">reader</code><span class="sig-paren">(</span><em>keep_cache=False</em>, <em>_quarantine_hook=<function <lambda>></em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.reader" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a <a class="reference internal" href="misc.html#swift.common.swob.Response" title="swift.common.swob.Response"><code class="xref py py-class docutils literal"><span class="pre">swift.common.swob.Response</span></code></a> class compatible
“<cite>app_iter</cite>” object as defined by
<a class="reference internal" href="#swift.obj.diskfile.DiskFileReader" title="swift.obj.diskfile.DiskFileReader"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.DiskFileReader</span></code></a>.</p>
<p>For this implementation, the responsibility of closing the open file
is passed to the <a class="reference internal" href="#swift.obj.diskfile.DiskFileReader" title="swift.obj.diskfile.DiskFileReader"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.DiskFileReader</span></code></a> object.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>keep_cache</strong> – caller’s preference for keeping data read in the
OS buffer cache</li>
<li><strong>_quarantine_hook</strong> – 1-arg callable called when obj quarantined;
the arg is the reason for quarantine.
Default is to ignore it.
Not needed by the REST layer.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a <a class="reference internal" href="#swift.obj.diskfile.DiskFileReader" title="swift.obj.diskfile.DiskFileReader"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.DiskFileReader</span></code></a> object</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.reader_cls">
<code class="descname">reader_cls</code><em class="property"> = None</em><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.reader_cls" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.timestamp">
<code class="descname">timestamp</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.timestamp" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFile.write_metadata">
<code class="descname">write_metadata</code><span class="sig-paren">(</span><em>metadata</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.write_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a block of metadata to an object without requiring the caller to
create the object first. Supports fast-POST behavior semantics.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>metadata</strong> – dictionary of metadata to be associated with the
object</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileError</strong> – this implementation will raise the same
errors as the <cite>create()</cite> method.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFile.writer_cls">
<code class="descname">writer_cls</code><em class="property"> = None</em><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFile.writer_cls" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.BaseDiskFileManager">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">BaseDiskFileManager</code><span class="sig-paren">(</span><em>conf</em>, <em>logger</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Management class for devices, providing common place for shared parameters
and methods not provided by the DiskFile class (which primarily services
the object server REST API layer).</p>
<p>The <cite>get_diskfile()</cite> method is how this implementation creates a <cite>DiskFile</cite>
object.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This class is reference implementation specific and not part of the
pluggable on-disk backend API.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">TODO(portante): Not sure what the right name to recommend here, as
“manager” seemed generic enough, though suggestions are welcome.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>conf</strong> – caller provided configuration object</li>
<li><strong>logger</strong> – caller provided logger</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.cleanup_ondisk_files">
<code class="descname">cleanup_ondisk_files</code><span class="sig-paren">(</span><em>hsh_path</em>, <em>reclaim_age=604800</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.cleanup_ondisk_files" title="Permalink to this definition">¶</a></dt>
<dd><p>Clean up on-disk files that are obsolete and gather the set of valid
on-disk files for an object.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>hsh_path</strong> – object hash path</li>
<li><strong>reclaim_age</strong> – age in seconds at which to remove tombstones</li>
<li><strong>frag_index</strong> – if set, search for a specific fragment index .data
file, otherwise accept the first valid .data file</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a dict that may contain: valid on disk files keyed by their
filename extension; a list of obsolete files stored under the
key ‘obsolete’; a list of files remaining in the directory,
reverse sorted, stored under the key ‘files’.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.consolidate_hashes">
<code class="descname">consolidate_hashes</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.consolidate_hashes" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.construct_dev_path">
<code class="descname">construct_dev_path</code><span class="sig-paren">(</span><em>device</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.construct_dev_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct the path to a device without checking if it is mounted.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>device</strong> – name of target device</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">full path to the device</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFileManager.diskfile_cls">
<code class="descname">diskfile_cls</code><em class="property"> = None</em><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.diskfile_cls" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.get_dev_path">
<code class="descname">get_dev_path</code><span class="sig-paren">(</span><em>device</em>, <em>mount_check=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.get_dev_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the path to a device, first checking to see if either it
is a proper mount point, or at least a directory depending on
the mount_check configuration option.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>device</strong> – name of target device</li>
<li><strong>mount_check</strong> – whether or not to check mountedness of device.
Defaults to bool(self.mount_check).</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">full path to the device, None if the path to the device is
not a proper mount point or directory.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.get_diskfile">
<code class="descname">get_diskfile</code><span class="sig-paren">(</span><em>device</em>, <em>partition</em>, <em>account</em>, <em>container</em>, <em>obj</em>, <em>policy</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.get_diskfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a BaseDiskFile instance for an object based on the object’s
partition, path parts and policy.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>device</strong> – name of target device</li>
<li><strong>partition</strong> – partition on device in which the object lives</li>
<li><strong>account</strong> – account name for the object</li>
<li><strong>container</strong> – container name for the object</li>
<li><strong>obj</strong> – object name for the object</li>
<li><strong>policy</strong> – the StoragePolicy instance</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.get_diskfile_from_audit_location">
<code class="descname">get_diskfile_from_audit_location</code><span class="sig-paren">(</span><em>audit_location</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.get_diskfile_from_audit_location" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a BaseDiskFile instance for an object at the given
AuditLocation.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>audit_location</strong> – object location to be audited</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.get_diskfile_from_hash">
<code class="descname">get_diskfile_from_hash</code><span class="sig-paren">(</span><em>device</em>, <em>partition</em>, <em>object_hash</em>, <em>policy</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.get_diskfile_from_hash" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a DiskFile instance for an object at the given
object_hash. Just in case someone thinks of refactoring, be
sure DiskFileDeleted is <em>not</em> raised, but the DiskFile
instance representing the tombstoned object is returned
instead.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>device</strong> – name of target device</li>
<li><strong>partition</strong> – partition on the device in which the object lives</li>
<li><strong>object_hash</strong> – the hash of an object path</li>
<li><strong>policy</strong> – the StoragePolicy instance</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first"><strong>DiskFileNotExist</strong> – if the object does not exist</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">an instance of BaseDiskFile</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.get_hashes">
<code class="descname">get_hashes</code><span class="sig-paren">(</span><em>device</em>, <em>partition</em>, <em>suffixes</em>, <em>policy</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.get_hashes" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>device</strong> – name of target device</li>
<li><strong>partition</strong> – partition name</li>
<li><strong>suffixes</strong> – a list of suffix directories to be recalculated</li>
<li><strong>policy</strong> – the StoragePolicy instance</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a dictionary that maps suffix directories</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.get_ondisk_files">
<code class="descname">get_ondisk_files</code><span class="sig-paren">(</span><em>files</em>, <em>datadir</em>, <em>verify=True</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.get_ondisk_files" title="Permalink to this definition">¶</a></dt>
<dd><p>Given a simple list of files names, determine the files that constitute
a valid fileset i.e. a set of files that defines the state of an
object, and determine the files that are obsolete and could be deleted.
Note that some files may fall into neither category.</p>
<p>If a file is considered part of a valid fileset then its info dict will
be added to the results dict, keyed by <extension>_info. Any files that
are no longer required will have their info dicts added to a list
stored under the key ‘obsolete’.</p>
<p>The results dict will always contain entries with keys ‘ts_file’,
‘data_file’ and ‘meta_file’. Their values will be the fully qualified
path to a file of the corresponding type if there is such a file in the
valid fileset, or None.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>files</strong> – a list of file names.</li>
<li><strong>datadir</strong> – directory name files are from.</li>
<li><strong>verify</strong> – if True verify that the ondisk file contract has not
been violated, otherwise do not verify.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><dl class="docutils">
<dt>a dict that will contain keys:</dt>
<dd><p class="first last">ts_file -> path to a .ts file or None
data_file -> path to a .data file or None
meta_file -> path to a .meta file or None</p>
</dd>
<dt>and may contain keys:</dt>
<dd><p class="first last">ts_info -> a file info dict for a .ts file
data_info -> a file info dict for a .data file
meta_info -> a file info dict for a .meta file
obsolete -> a list of file info dicts for obsolete files</p>
</dd>
</dl>
</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.invalidate_hash">
<code class="descname">invalidate_hash</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.invalidate_hash" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.make_on_disk_filename">
<code class="descname">make_on_disk_filename</code><span class="sig-paren">(</span><em>timestamp</em>, <em>ext=None</em>, <em>ctype_timestamp=None</em>, <em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.make_on_disk_filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns filename for given timestamp.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>timestamp</strong> – the object timestamp, an instance of
<a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a></li>
<li><strong>ext</strong> – an optional string representing a file extension to be
appended to the returned file name</li>
<li><strong>ctype_timestamp</strong> – an optional content-type timestamp, an instance
of <a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a file name</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.object_audit_location_generator">
<code class="descname">object_audit_location_generator</code><span class="sig-paren">(</span><em>device_dirs=None</em>, <em>auditor_type='ALL'</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.object_audit_location_generator" title="Permalink to this definition">¶</a></dt>
<dd><p>Yield an AuditLocation for all objects stored under device_dirs.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>device_dirs</strong> – directory of target device</li>
<li><strong>auditor_type</strong> – either ALL or ZBF</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.parse_on_disk_filename">
<code class="descname">parse_on_disk_filename</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.parse_on_disk_filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse an on disk file name.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> – the file name including extension</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a dict, with keys for timestamp, ext and ctype_timestamp:<ul class="simple">
<li>timestamp is a <a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a></li>
<li>ctype_timestamp is a <a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a> or
None for .meta files, otherwise None</li>
<li>ext is a string, the file extension including the leading dot or
the empty string if the filename has no extension.</li>
</ul>
<p>Subclasses may override this method to add further keys to the
returned dict.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileError</strong> – if any part of the filename is not able to be
validated.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.pickle_async_update">
<code class="descname">pickle_async_update</code><span class="sig-paren">(</span><em>device</em>, <em>account</em>, <em>container</em>, <em>obj</em>, <em>data</em>, <em>timestamp</em>, <em>policy</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.pickle_async_update" title="Permalink to this definition">¶</a></dt>
<dd><p>Write data describing a container update notification to a pickle file
in the async_pending directory.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>device</strong> – name of target device</li>
<li><strong>account</strong> – account name for the object</li>
<li><strong>container</strong> – container name for the object</li>
<li><strong>obj</strong> – object name for the object</li>
<li><strong>data</strong> – update data to be written to pickle file</li>
<li><strong>timestamp</strong> – a Timestamp</li>
<li><strong>policy</strong> – the StoragePolicy instance</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.quarantine_renamer">
<code class="descname">quarantine_renamer</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.quarantine_renamer" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.replication_lock">
<code class="descname">replication_lock</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwds</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.replication_lock" title="Permalink to this definition">¶</a></dt>
<dd><p>A context manager that will lock on the device given, if
configured to do so.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>device</strong> – name of target device</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>ReplicationLockTimeout</strong> – If the lock on the device
cannot be granted within the configured timeout.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.yield_hashes">
<code class="descname">yield_hashes</code><span class="sig-paren">(</span><em>device</em>, <em>partition</em>, <em>policy</em>, <em>suffixes=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.yield_hashes" title="Permalink to this definition">¶</a></dt>
<dd><p>Yields tuples of (full_path, hash_only, timestamps) for object
information stored for the given device, partition, and
(optionally) suffixes. If suffixes is None, all stored
suffixes will be searched for object hashes. Note that if
suffixes is not None but empty, such as [], then nothing will
be yielded.</p>
<p>timestamps is a dict which may contain items mapping:</p>
<blockquote>
<div><p>ts_data -> timestamp of data or tombstone file,
ts_meta -> timestamp of meta file, if one exists
ts_ctype -> timestamp of meta file containing most recent</p>
<blockquote>
<div>content-type value, if one exists</div></blockquote>
</div></blockquote>
<p>where timestamps are instances of
<a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>device</strong> – name of target device</li>
<li><strong>partition</strong> – partition name</li>
<li><strong>policy</strong> – the StoragePolicy instance</li>
<li><strong>suffixes</strong> – optional list of suffix directories to be searched</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileManager.yield_suffixes">
<code class="descname">yield_suffixes</code><span class="sig-paren">(</span><em>device</em>, <em>partition</em>, <em>policy</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileManager.yield_suffixes" title="Permalink to this definition">¶</a></dt>
<dd><p>Yields tuples of (full_path, suffix_only) for suffixes stored
on the given device and partition.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>device</strong> – name of target device</li>
<li><strong>partition</strong> – partition name</li>
<li><strong>policy</strong> – the StoragePolicy instance</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.BaseDiskFileReader">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">BaseDiskFileReader</code><span class="sig-paren">(</span><em>fp</em>, <em>data_file</em>, <em>obj_size</em>, <em>etag</em>, <em>threadpool</em>, <em>disk_chunk_size</em>, <em>keep_cache_size</em>, <em>device_path</em>, <em>logger</em>, <em>quarantine_hook</em>, <em>use_splice</em>, <em>pipe_size</em>, <em>diskfile</em>, <em>keep_cache=False</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileReader" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Encapsulation of the WSGI read context for servicing GET REST API
requests. Serves as the context manager object for the
<a class="reference internal" href="#swift.obj.diskfile.DiskFile" title="swift.obj.diskfile.DiskFile"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.DiskFile</span></code></a> class’s
<code class="xref py py-func docutils literal"><span class="pre">swift.obj.diskfile.DiskFile.reader()</span></code> method.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The quarantining behavior of this method is considered implementation
specific, and is not required of the API.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The arguments to the constructor are considered implementation
specific. The API does not define the constructor arguments.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>fp</strong> – open file object pointer reference</li>
<li><strong>data_file</strong> – on-disk data file name for the object</li>
<li><strong>obj_size</strong> – verified on-disk size of the object</li>
<li><strong>etag</strong> – expected metadata etag value for entire file</li>
<li><strong>threadpool</strong> – thread pool to use for read operations</li>
<li><strong>disk_chunk_size</strong> – size of reads from disk in bytes</li>
<li><strong>keep_cache_size</strong> – maximum object size that will be kept in cache</li>
<li><strong>device_path</strong> – on-disk device path, used when quarantining an obj</li>
<li><strong>logger</strong> – logger caller wants this object to use</li>
<li><strong>quarantine_hook</strong> – 1-arg callable called w/reason when quarantined</li>
<li><strong>use_splice</strong> – if true, use zero-copy splice() to send data</li>
<li><strong>pipe_size</strong> – size of pipe buffer used in zero-copy operations</li>
<li><strong>diskfile</strong> – the diskfile creating this DiskFileReader instance</li>
<li><strong>keep_cache</strong> – should resulting reads be kept in the buffer cache</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileReader.app_iter_range">
<code class="descname">app_iter_range</code><span class="sig-paren">(</span><em>start</em>, <em>stop</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileReader.app_iter_range" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns an iterator over the data file for range (start, stop)</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileReader.app_iter_ranges">
<code class="descname">app_iter_ranges</code><span class="sig-paren">(</span><em>ranges</em>, <em>content_type</em>, <em>boundary</em>, <em>size</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileReader.app_iter_ranges" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns an iterator over the data file for a set of ranges</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileReader.can_zero_copy_send">
<code class="descname">can_zero_copy_send</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileReader.can_zero_copy_send" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileReader.close">
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileReader.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Close the open file handle if present.</p>
<p>For this specific implementation, this method will handle quarantining
the file if necessary.</p>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFileReader.manager">
<code class="descname">manager</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileReader.manager" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileReader.zero_copy_send">
<code class="descname">zero_copy_send</code><span class="sig-paren">(</span><em>wsockfd</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileReader.zero_copy_send" title="Permalink to this definition">¶</a></dt>
<dd><p>Does some magic with splice() and tee() to move stuff from disk to
network without ever touching userspace.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>wsockfd</strong> – file descriptor (integer) of the socket out which to
send data</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.BaseDiskFileWriter">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">BaseDiskFileWriter</code><span class="sig-paren">(</span><em>name</em>, <em>datadir</em>, <em>fd</em>, <em>tmppath</em>, <em>bytes_per_sync</em>, <em>threadpool</em>, <em>diskfile</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileWriter" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Encapsulation of the write context for servicing PUT REST API
requests. Serves as the context manager object for the
<a class="reference internal" href="#swift.obj.diskfile.DiskFile" title="swift.obj.diskfile.DiskFile"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.DiskFile</span></code></a> class’s
<code class="xref py py-func docutils literal"><span class="pre">swift.obj.diskfile.DiskFile.create()</span></code> method.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">It is the responsibility of the
<code class="xref py py-func docutils literal"><span class="pre">swift.obj.diskfile.DiskFile.create()</span></code> method context manager to
close the open file descriptor.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The arguments to the constructor are considered implementation
specific. The API does not define the constructor arguments.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> – name of object from REST API</li>
<li><strong>datadir</strong> – on-disk directory object will end up in on
<a class="reference internal" href="#swift.obj.diskfile.DiskFileWriter.put" title="swift.obj.diskfile.DiskFileWriter.put"><code class="xref py py-func docutils literal"><span class="pre">swift.obj.diskfile.DiskFileWriter.put()</span></code></a></li>
<li><strong>fd</strong> – open file descriptor of temporary file to receive data</li>
<li><strong>tmppath</strong> – full path name of the opened file descriptor</li>
<li><strong>bytes_per_sync</strong> – number bytes written between sync calls</li>
<li><strong>threadpool</strong> – internal thread pool to use for disk operations</li>
<li><strong>diskfile</strong> – the diskfile creating this DiskFileWriter instance</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileWriter.commit">
<code class="descname">commit</code><span class="sig-paren">(</span><em>timestamp</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileWriter.commit" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform any operations necessary to mark the object as durable. For
replication policy type this is a no-op.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timestamp</strong> – object put timestamp, an instance of
<a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFileWriter.manager">
<code class="descname">manager</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileWriter.manager" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileWriter.put">
<code class="descname">put</code><span class="sig-paren">(</span><em>metadata</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileWriter.put" title="Permalink to this definition">¶</a></dt>
<dd><p>Finalize writing the file on disk.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>metadata</strong> – dictionary of metadata to be associated with the
object</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.BaseDiskFileWriter.put_succeeded">
<code class="descname">put_succeeded</code><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileWriter.put_succeeded" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.BaseDiskFileWriter.write">
<code class="descname">write</code><span class="sig-paren">(</span><em>chunk</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.BaseDiskFileWriter.write" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a chunk of data to disk. All invocations of this method must
come before invoking the :func:</p>
<p>For this implementation, the data is written into a temporary file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>chunk</strong> – the chunk of data to write as a string object</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">the total number of bytes written to an object</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.DiskFile">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">DiskFile</code><span class="sig-paren">(</span><em>mgr</em>, <em>device_path</em>, <em>threadpool</em>, <em>partition</em>, <em>account=None</em>, <em>container=None</em>, <em>obj=None</em>, <em>_datadir=None</em>, <em>policy=None</em>, <em>use_splice=False</em>, <em>pipe_size=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.DiskFile" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#swift.obj.diskfile.BaseDiskFile" title="swift.obj.diskfile.BaseDiskFile"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.BaseDiskFile</span></code></a></p>
<dl class="attribute">
<dt id="swift.obj.diskfile.DiskFile.reader_cls">
<code class="descname">reader_cls</code><a class="headerlink" href="#swift.obj.diskfile.DiskFile.reader_cls" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#swift.obj.diskfile.DiskFileReader" title="swift.obj.diskfile.DiskFileReader"><code class="xref py py-class docutils literal"><span class="pre">DiskFileReader</span></code></a></p>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.DiskFile.writer_cls">
<code class="descname">writer_cls</code><a class="headerlink" href="#swift.obj.diskfile.DiskFile.writer_cls" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#swift.obj.diskfile.DiskFileWriter" title="swift.obj.diskfile.DiskFileWriter"><code class="xref py py-class docutils literal"><span class="pre">DiskFileWriter</span></code></a></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.DiskFileManager">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">DiskFileManager</code><span class="sig-paren">(</span><em>conf</em>, <em>logger</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.DiskFileManager" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#swift.obj.diskfile.BaseDiskFileManager" title="swift.obj.diskfile.BaseDiskFileManager"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.BaseDiskFileManager</span></code></a></p>
<dl class="attribute">
<dt id="swift.obj.diskfile.DiskFileManager.diskfile_cls">
<code class="descname">diskfile_cls</code><a class="headerlink" href="#swift.obj.diskfile.DiskFileManager.diskfile_cls" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#swift.obj.diskfile.DiskFile" title="swift.obj.diskfile.DiskFile"><code class="xref py py-class docutils literal"><span class="pre">DiskFile</span></code></a></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.DiskFileReader">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">DiskFileReader</code><span class="sig-paren">(</span><em>fp</em>, <em>data_file</em>, <em>obj_size</em>, <em>etag</em>, <em>threadpool</em>, <em>disk_chunk_size</em>, <em>keep_cache_size</em>, <em>device_path</em>, <em>logger</em>, <em>quarantine_hook</em>, <em>use_splice</em>, <em>pipe_size</em>, <em>diskfile</em>, <em>keep_cache=False</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.DiskFileReader" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#swift.obj.diskfile.BaseDiskFileReader" title="swift.obj.diskfile.BaseDiskFileReader"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.BaseDiskFileReader</span></code></a></p>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.DiskFileRouter">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">DiskFileRouter</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.DiskFileRouter" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<dl class="attribute">
<dt id="swift.obj.diskfile.DiskFileRouter.policy_type_to_manager_cls">
<code class="descname">policy_type_to_manager_cls</code><em class="property"> = {'replication': <class 'swift.obj.diskfile.DiskFileManager'>, 'erasure_coding': <class 'swift.obj.diskfile.ECDiskFileManager'>}</em><a class="headerlink" href="#swift.obj.diskfile.DiskFileRouter.policy_type_to_manager_cls" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="classmethod">
<dt id="swift.obj.diskfile.DiskFileRouter.register">
<em class="property">classmethod </em><code class="descname">register</code><span class="sig-paren">(</span><em>policy_type</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.DiskFileRouter.register" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator for Storage Policy implementations to register
their DiskFile implementation.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.DiskFileWriter">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">DiskFileWriter</code><span class="sig-paren">(</span><em>name</em>, <em>datadir</em>, <em>fd</em>, <em>tmppath</em>, <em>bytes_per_sync</em>, <em>threadpool</em>, <em>diskfile</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.DiskFileWriter" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#swift.obj.diskfile.BaseDiskFileWriter" title="swift.obj.diskfile.BaseDiskFileWriter"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.BaseDiskFileWriter</span></code></a></p>
<dl class="method">
<dt id="swift.obj.diskfile.DiskFileWriter.put">
<code class="descname">put</code><span class="sig-paren">(</span><em>metadata</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.DiskFileWriter.put" title="Permalink to this definition">¶</a></dt>
<dd><p>Finalize writing the file on disk.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>metadata</strong> – dictionary of metadata to be associated with the
object</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.ECDiskFile">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">ECDiskFile</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.ECDiskFile" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#swift.obj.diskfile.BaseDiskFile" title="swift.obj.diskfile.BaseDiskFile"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.BaseDiskFile</span></code></a></p>
<dl class="attribute">
<dt id="swift.obj.diskfile.ECDiskFile.durable_timestamp">
<code class="descname">durable_timestamp</code><a class="headerlink" href="#swift.obj.diskfile.ECDiskFile.durable_timestamp" title="Permalink to this definition">¶</a></dt>
<dd><p>Provides the timestamp of the newest durable file found in the object
directory.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A Timestamp instance, or None if no durable file was found.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileNotOpen</strong> – if the open() method has not been previously
called on this instance.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.ECDiskFile.fragments">
<code class="descname">fragments</code><a class="headerlink" href="#swift.obj.diskfile.ECDiskFile.fragments" title="Permalink to this definition">¶</a></dt>
<dd><p>Provides information about all fragments that were found in the object
directory, including fragments without a matching durable file, and
including any fragment chosen to construct the opened diskfile.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A dict mapping <Timestamp instance> -> <list of frag indexes>,
or None if the diskfile has not been opened or no fragments
were found.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.ECDiskFile.purge">
<code class="descname">purge</code><span class="sig-paren">(</span><em>timestamp</em>, <em>frag_index</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.ECDiskFile.purge" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove a tombstone file matching the specified timestamp or
datafile matching the specified timestamp and fragment index
from the object directory.</p>
<p>This provides the EC reconstructor/ssync process with a way to
remove a tombstone or fragment from a handoff node after
reverting it to its primary node.</p>
<p>The hash will be invalidated, and if empty or invalid the
hsh_path will be removed on next hash_cleanup_listdir.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>timestamp</strong> – the object timestamp, an instance of
<a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a></li>
<li><strong>frag_index</strong> – fragment archive index, must be
a whole number or None.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.ECDiskFile.reader_cls">
<code class="descname">reader_cls</code><a class="headerlink" href="#swift.obj.diskfile.ECDiskFile.reader_cls" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#swift.obj.diskfile.ECDiskFileReader" title="swift.obj.diskfile.ECDiskFileReader"><code class="xref py py-class docutils literal"><span class="pre">ECDiskFileReader</span></code></a></p>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.diskfile.ECDiskFile.writer_cls">
<code class="descname">writer_cls</code><a class="headerlink" href="#swift.obj.diskfile.ECDiskFile.writer_cls" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#swift.obj.diskfile.ECDiskFileWriter" title="swift.obj.diskfile.ECDiskFileWriter"><code class="xref py py-class docutils literal"><span class="pre">ECDiskFileWriter</span></code></a></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.ECDiskFileManager">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">ECDiskFileManager</code><span class="sig-paren">(</span><em>conf</em>, <em>logger</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.ECDiskFileManager" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#swift.obj.diskfile.BaseDiskFileManager" title="swift.obj.diskfile.BaseDiskFileManager"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.BaseDiskFileManager</span></code></a></p>
<dl class="attribute">
<dt id="swift.obj.diskfile.ECDiskFileManager.diskfile_cls">
<code class="descname">diskfile_cls</code><a class="headerlink" href="#swift.obj.diskfile.ECDiskFileManager.diskfile_cls" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <a class="reference internal" href="#swift.obj.diskfile.ECDiskFile" title="swift.obj.diskfile.ECDiskFile"><code class="xref py py-class docutils literal"><span class="pre">ECDiskFile</span></code></a></p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.ECDiskFileManager.make_on_disk_filename">
<code class="descname">make_on_disk_filename</code><span class="sig-paren">(</span><em>timestamp</em>, <em>ext=None</em>, <em>frag_index=None</em>, <em>ctype_timestamp=None</em>, <em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.ECDiskFileManager.make_on_disk_filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the EC specific filename for given timestamp.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>timestamp</strong> – the object timestamp, an instance of
<a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a></li>
<li><strong>ext</strong> – an optional string representing a file extension to be
appended to the returned file name</li>
<li><strong>frag_index</strong> – a fragment archive index, used with .data extension
only, must be a whole number.</li>
<li><strong>ctype_timestamp</strong> – an optional content-type timestamp, an instance
of <a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a file name</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><strong>DiskFileError</strong> – if ext==’.data’ and the kwarg frag_index is not
a whole number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.ECDiskFileManager.parse_on_disk_filename">
<code class="descname">parse_on_disk_filename</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.ECDiskFileManager.parse_on_disk_filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns timestamp(s) and other info extracted from a policy specific
file name. For EC policy the data file name includes a fragment index
which must be stripped off to retrieve the timestamp.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> – the file name including extension</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><dl class="docutils">
<dt>a dict, with keys for timestamp, frag_index, ext and</dt>
<dd>ctype_timestamp:</dd>
</dl>
<ul class="simple">
<li>timestamp is a <a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a></li>
<li>frag_index is an int or None</li>
<li>ctype_timestamp is a <a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a> or
None for .meta files, otherwise None</li>
<li>ext is a string, the file extension including the leading dot or
the empty string if the filename has no extension.</li>
</ul>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><strong>DiskFileError</strong> – if any part of the filename is not able to be
validated.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.ECDiskFileManager.validate_fragment_index">
<code class="descname">validate_fragment_index</code><span class="sig-paren">(</span><em>frag_index</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.ECDiskFileManager.validate_fragment_index" title="Permalink to this definition">¶</a></dt>
<dd><p>Return int representation of frag_index, or raise a DiskFileError if
frag_index is not a whole number.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>frag_index</strong> – a fragment archive index</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.ECDiskFileReader">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">ECDiskFileReader</code><span class="sig-paren">(</span><em>fp</em>, <em>data_file</em>, <em>obj_size</em>, <em>etag</em>, <em>threadpool</em>, <em>disk_chunk_size</em>, <em>keep_cache_size</em>, <em>device_path</em>, <em>logger</em>, <em>quarantine_hook</em>, <em>use_splice</em>, <em>pipe_size</em>, <em>diskfile</em>, <em>keep_cache=False</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.ECDiskFileReader" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#swift.obj.diskfile.BaseDiskFileReader" title="swift.obj.diskfile.BaseDiskFileReader"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.BaseDiskFileReader</span></code></a></p>
</dd></dl>
<dl class="class">
<dt id="swift.obj.diskfile.ECDiskFileWriter">
<em class="property">class </em><code class="descclassname">swift.obj.diskfile.</code><code class="descname">ECDiskFileWriter</code><span class="sig-paren">(</span><em>name</em>, <em>datadir</em>, <em>fd</em>, <em>tmppath</em>, <em>bytes_per_sync</em>, <em>threadpool</em>, <em>diskfile</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.ECDiskFileWriter" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#swift.obj.diskfile.BaseDiskFileWriter" title="swift.obj.diskfile.BaseDiskFileWriter"><code class="xref py py-class docutils literal"><span class="pre">swift.obj.diskfile.BaseDiskFileWriter</span></code></a></p>
<dl class="method">
<dt id="swift.obj.diskfile.ECDiskFileWriter.commit">
<code class="descname">commit</code><span class="sig-paren">(</span><em>timestamp</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.ECDiskFileWriter.commit" title="Permalink to this definition">¶</a></dt>
<dd><p>Finalize put by writing a timestamp.durable file for the object. We
do this for EC policy because it requires a 2-phase put commit
confirmation.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timestamp</strong> – object put timestamp, an instance of
<a class="reference internal" href="misc.html#swift.common.utils.Timestamp" title="swift.common.utils.Timestamp"><code class="xref py py-class docutils literal"><span class="pre">Timestamp</span></code></a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.diskfile.ECDiskFileWriter.put">
<code class="descname">put</code><span class="sig-paren">(</span><em>metadata</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.ECDiskFileWriter.put" title="Permalink to this definition">¶</a></dt>
<dd><p>The only difference between this method and the replication policy
DiskFileWriter method is adding the frag index to the metadata.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>metadata</strong> – dictionary of metadata to be associated with object</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.clear_auditor_status">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">clear_auditor_status</code><span class="sig-paren">(</span><em>devices</em>, <em>auditor_type='ALL'</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.clear_auditor_status" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.consolidate_hashes">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">consolidate_hashes</code><span class="sig-paren">(</span><em>partition_dir</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.consolidate_hashes" title="Permalink to this definition">¶</a></dt>
<dd><p>Take what’s in hashes.pkl and hashes.invalid, combine them, write the
result back to hashes.pkl, and clear out hashes.invalid.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>suffix_dir</strong> – absolute path to partition dir containing hashes.pkl
and hashes.invalid</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">the hashes, or None if there’s no hashes.pkl.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.extract_policy">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">extract_policy</code><span class="sig-paren">(</span><em>obj_path</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.extract_policy" title="Permalink to this definition">¶</a></dt>
<dd><p>Extracts the policy for an object (based on the name of the objects
directory) given the device-relative path to the object. Returns None in
the event that the path is malformed in some way.</p>
<p>The device-relative path is everything after the mount point; for example:</p>
<dl class="docutils">
<dt>/srv/node/d42/objects-5/179/</dt>
<dd>485dc017205a81df3af616d917c90179/1401811134.873649.data</dd>
</dl>
<p>would have device-relative path:</p>
<p>objects-5/179/485dc017205a81df3af616d917c90179/1401811134.873649.data</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>obj_path</strong> – device-relative path of an object, or the full path</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" href="misc.html#swift.common.storage_policy.BaseStoragePolicy" title="swift.common.storage_policy.BaseStoragePolicy"><code class="xref py py-class docutils literal"><span class="pre">BaseStoragePolicy</span></code></a> or None</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.get_auditor_status">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">get_auditor_status</code><span class="sig-paren">(</span><em>datadir_path</em>, <em>logger</em>, <em>auditor_type</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.get_auditor_status" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.invalidate_hash">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">invalidate_hash</code><span class="sig-paren">(</span><em>suffix_dir</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.invalidate_hash" title="Permalink to this definition">¶</a></dt>
<dd><p>Invalidates the hash for a suffix_dir in the partition’s hashes file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>suffix_dir</strong> – absolute path to suffix dir whose hash needs
invalidating</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.object_audit_location_generator">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">object_audit_location_generator</code><span class="sig-paren">(</span><em>devices</em>, <em>mount_check=True</em>, <em>logger=None</em>, <em>device_dirs=None</em>, <em>auditor_type='ALL'</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.object_audit_location_generator" title="Permalink to this definition">¶</a></dt>
<dd><p>Given a devices path (e.g. “/srv/node”), yield an AuditLocation for all
objects stored under that directory if device_dirs isn’t set. If
device_dirs is set, only yield AuditLocation for the objects under the
entries in device_dirs. The AuditLocation only knows the path to the hash
directory, not to the .data file therein (if any). This is to avoid a
double listdir(hash_dir); the DiskFile object will always do one, so
we don’t.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>devices</strong> – parent directory of the devices to be audited</li>
<li><strong>mount_check</strong> – flag to check if a mount check should be performed
on devices</li>
<li><strong>logger</strong> – a logger object</li>
<li><strong>device_dirs</strong> – a list of directories under devices to traverse</li>
<li><strong>auditor_type</strong> – either ALL or ZBF</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.quarantine_renamer">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">quarantine_renamer</code><span class="sig-paren">(</span><em>device_path</em>, <em>corrupted_file_path</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.quarantine_renamer" title="Permalink to this definition">¶</a></dt>
<dd><p>In the case that a file is corrupted, move it to a quarantined
area to allow replication to fix it.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name" colspan="2">Params device_path:</th></tr>
<tr class="field-odd field"><td> </td><td class="field-body">The path to the device the corrupted file is on.</td>
</tr>
<tr class="field-even field"><th class="field-name" colspan="2">Params corrupted_file_path:</th></tr>
<tr class="field-even field"><td> </td><td class="field-body">The path to the file you want quarantined.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">path (str) of directory the file was moved to</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><strong>OSError</strong> – re-raises non errno.EEXIST / errno.ENOTEMPTY
exceptions from rename</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.read_metadata">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">read_metadata</code><span class="sig-paren">(</span><em>fd</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.read_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Helper function to read the pickled metadata from an object file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>fd</strong> – file descriptor or filename to load the metadata from</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dictionary of metadata</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.strip_self">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">strip_self</code><span class="sig-paren">(</span><em>f</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.strip_self" title="Permalink to this definition">¶</a></dt>
<dd><p>Wrapper to attach module level functions to base class.</p>
</dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.update_auditor_status">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">update_auditor_status</code><span class="sig-paren">(</span><em>datadir_path</em>, <em>logger</em>, <em>partitions</em>, <em>auditor_type</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.update_auditor_status" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="swift.obj.diskfile.write_metadata">
<code class="descclassname">swift.obj.diskfile.</code><code class="descname">write_metadata</code><span class="sig-paren">(</span><em>fd</em>, <em>metadata</em>, <em>xattr_size=65536</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.diskfile.write_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Helper function to write pickled metadata for an object file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>fd</strong> – file descriptor or filename to write the metadata</li>
<li><strong>metadata</strong> – metadata to write</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-swift.obj.replicator">
<span id="id3"></span><span id="object-replicator"></span><h2>Object Replicator<a class="headerlink" href="#module-swift.obj.replicator" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="swift.obj.replicator.ObjectReplicator">
<em class="property">class </em><code class="descclassname">swift.obj.replicator.</code><code class="descname">ObjectReplicator</code><span class="sig-paren">(</span><em>conf</em>, <em>logger=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">swift.common.daemon.Daemon</span></code></p>
<p>Replicate objects.</p>
<p>Encapsulates most logic and data needed by the object replication process.
Each call to .replicate() performs one replication pass. It’s up to the
caller to do this in a loop.</p>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.build_replication_jobs">
<code class="descname">build_replication_jobs</code><span class="sig-paren">(</span><em>policy</em>, <em>ips</em>, <em>override_devices=None</em>, <em>override_partitions=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.build_replication_jobs" title="Permalink to this definition">¶</a></dt>
<dd><p>Helper function for collect_jobs to build jobs for replication
using replication style storage policy</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.check_ring">
<code class="descname">check_ring</code><span class="sig-paren">(</span><em>object_ring</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.check_ring" title="Permalink to this definition">¶</a></dt>
<dd><p>Check to see if the ring has been updated
:param object_ring: the ring to check</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">boolean indicating whether or not the ring has changed</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.collect_jobs">
<code class="descname">collect_jobs</code><span class="sig-paren">(</span><em>override_devices=None</em>, <em>override_partitions=None</em>, <em>override_policies=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.collect_jobs" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a sorted list of jobs (dictionaries) that specify the
partitions, nodes, etc to be rsynced.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>override_devices</strong> – if set, only jobs on these devices
will be returned</li>
<li><strong>override_partitions</strong> – if set, only jobs on these partitions
will be returned</li>
<li><strong>override_policies</strong> – if set, only jobs in these storage
policies will be returned</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.delete_handoff_objs">
<code class="descname">delete_handoff_objs</code><span class="sig-paren">(</span><em>job</em>, <em>delete_objs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.delete_handoff_objs" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.delete_partition">
<code class="descname">delete_partition</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.delete_partition" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.detect_lockups">
<code class="descname">detect_lockups</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.detect_lockups" title="Permalink to this definition">¶</a></dt>
<dd><p>In testing, the pool.waitall() call very occasionally failed to return.
This is an attempt to make sure the replicator finishes its replication
pass in some eventuality.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.heartbeat">
<code class="descname">heartbeat</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.heartbeat" title="Permalink to this definition">¶</a></dt>
<dd><p>Loop that runs in the background during replication. It periodically
logs progress.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.kill_coros">
<code class="descname">kill_coros</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.kill_coros" title="Permalink to this definition">¶</a></dt>
<dd><p>Utility function that kills all coroutines currently running.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.load_object_ring">
<code class="descname">load_object_ring</code><span class="sig-paren">(</span><em>policy</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.load_object_ring" title="Permalink to this definition">¶</a></dt>
<dd><p>Make sure the policy’s rings are loaded.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>policy</strong> – the StoragePolicy instance</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">appropriate ring object</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.replicate">
<code class="descname">replicate</code><span class="sig-paren">(</span><em>override_devices=None</em>, <em>override_partitions=None</em>, <em>override_policies=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.replicate" title="Permalink to this definition">¶</a></dt>
<dd><p>Run a replication pass</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.rsync">
<code class="descname">rsync</code><span class="sig-paren">(</span><em>node</em>, <em>job</em>, <em>suffixes</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.rsync" title="Permalink to this definition">¶</a></dt>
<dd><p>Uses rsync to implement the sync method. This was the first
sync method in Swift.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.run_forever">
<code class="descname">run_forever</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.run_forever" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.run_once">
<code class="descname">run_once</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.run_once" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.ssync">
<code class="descname">ssync</code><span class="sig-paren">(</span><em>node</em>, <em>job</em>, <em>suffixes</em>, <em>remote_check_objs=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.ssync" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.stats_line">
<code class="descname">stats_line</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.stats_line" title="Permalink to this definition">¶</a></dt>
<dd><p>Logs various stats for the currently running replication pass.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.sync">
<code class="descname">sync</code><span class="sig-paren">(</span><em>node</em>, <em>job</em>, <em>suffixes</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.sync" title="Permalink to this definition">¶</a></dt>
<dd><p>Synchronize local suffix directories from a partition with a remote
node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>node</strong> – the “dev” entry for the remote node to sync with</li>
<li><strong>job</strong> – information about the partition being synced</li>
<li><strong>suffixes</strong> – a list of suffixes which need to be pushed</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">boolean and dictionary, boolean indicating success or failure</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.update">
<code class="descname">update</code><span class="sig-paren">(</span><em>job</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.update" title="Permalink to this definition">¶</a></dt>
<dd><p>High-level method that replicates a single partition.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>job</strong> – a dict containing info about the partition to be replicated</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.replicator.ObjectReplicator.update_deleted">
<code class="descname">update_deleted</code><span class="sig-paren">(</span><em>job</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.replicator.ObjectReplicator.update_deleted" title="Permalink to this definition">¶</a></dt>
<dd><p>High-level method that replicates a single partition that doesn’t
belong on this node.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>job</strong> – a dict containing info about the partition to be replicated</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<span class="target" id="module-swift.obj.ssync_sender"></span><dl class="class">
<dt id="swift.obj.ssync_sender.Sender">
<em class="property">class </em><code class="descclassname">swift.obj.ssync_sender.</code><code class="descname">Sender</code><span class="sig-paren">(</span><em>daemon</em>, <em>node</em>, <em>job</em>, <em>suffixes</em>, <em>remote_check_objs=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.Sender" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Sends SSYNC requests to the object server.</p>
<p>These requests are eventually handled by
<a class="reference internal" href="#module-swift.obj.ssync_receiver" title="swift.obj.ssync_receiver"><code class="xref py py-mod docutils literal"><span class="pre">ssync_receiver</span></code></a> and full documentation about the
process is there.</p>
<dl class="method">
<dt id="swift.obj.ssync_sender.Sender.connect">
<code class="descname">connect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.Sender.connect" title="Permalink to this definition">¶</a></dt>
<dd><p>Establishes a connection and starts an SSYNC request
with the object server.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.ssync_sender.Sender.disconnect">
<code class="descname">disconnect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.Sender.disconnect" title="Permalink to this definition">¶</a></dt>
<dd><p>Closes down the connection to the object server once done
with the SSYNC request.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.ssync_sender.Sender.missing_check">
<code class="descname">missing_check</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.Sender.missing_check" title="Permalink to this definition">¶</a></dt>
<dd><p>Handles the sender-side of the MISSING_CHECK step of a
SSYNC request.</p>
<p>Full documentation of this can be found at
<a class="reference internal" href="#swift.obj.ssync_receiver.Receiver.missing_check" title="swift.obj.ssync_receiver.Receiver.missing_check"><code class="xref py py-meth docutils literal"><span class="pre">Receiver.missing_check()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.ssync_sender.Sender.readline">
<code class="descname">readline</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.Sender.readline" title="Permalink to this definition">¶</a></dt>
<dd><p>Reads a line from the SSYNC response body.</p>
<p>httplib has no readline and will block on read(x) until x is
read, so we have to do the work ourselves. A bit of this is
taken from Python’s httplib itself.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.ssync_sender.Sender.send_delete">
<code class="descname">send_delete</code><span class="sig-paren">(</span><em>url_path</em>, <em>timestamp</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.Sender.send_delete" title="Permalink to this definition">¶</a></dt>
<dd><p>Sends a DELETE subrequest with the given information.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.ssync_sender.Sender.send_post">
<code class="descname">send_post</code><span class="sig-paren">(</span><em>url_path</em>, <em>df</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.Sender.send_post" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.ssync_sender.Sender.send_put">
<code class="descname">send_put</code><span class="sig-paren">(</span><em>url_path</em>, <em>df</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.Sender.send_put" title="Permalink to this definition">¶</a></dt>
<dd><p>Sends a PUT subrequest for the url_path using the source df
(DiskFile) and content_length.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.ssync_sender.Sender.updates">
<code class="descname">updates</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.Sender.updates" title="Permalink to this definition">¶</a></dt>
<dd><p>Handles the sender-side of the UPDATES step of an SSYNC
request.</p>
<p>Full documentation of this can be found at
<a class="reference internal" href="#swift.obj.ssync_receiver.Receiver.updates" title="swift.obj.ssync_receiver.Receiver.updates"><code class="xref py py-meth docutils literal"><span class="pre">Receiver.updates()</span></code></a>.</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="swift.obj.ssync_sender.decode_wanted">
<code class="descclassname">swift.obj.ssync_sender.</code><code class="descname">decode_wanted</code><span class="sig-paren">(</span><em>parts</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.decode_wanted" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse missing_check line parts to determine which parts of local
diskfile were wanted by the receiver.</p>
<p>The encoder for parts is
<a class="reference internal" href="#swift.obj.ssync_receiver.encode_wanted" title="swift.obj.ssync_receiver.encode_wanted"><code class="xref py py-func docutils literal"><span class="pre">encode_wanted()</span></code></a></p>
</dd></dl>
<dl class="function">
<dt id="swift.obj.ssync_sender.encode_missing">
<code class="descclassname">swift.obj.ssync_sender.</code><code class="descname">encode_missing</code><span class="sig-paren">(</span><em>object_hash</em>, <em>ts_data</em>, <em>ts_meta=None</em>, <em>ts_ctype=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_sender.encode_missing" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a string representing the object hash, its data file timestamp
and the delta forwards to its metafile and content-type timestamps, if
non-zero, in the form:
<code class="docutils literal"><span class="pre"><hash></span> <span class="pre"><ts_data></span> <span class="pre">[m:<hex</span> <span class="pre">delta</span> <span class="pre">to</span> <span class="pre">ts_meta>[,t:<hex</span> <span class="pre">delta</span> <span class="pre">to</span> <span class="pre">ts_ctype>]]</span></code></p>
<p>The decoder for this line is
<a class="reference internal" href="#swift.obj.ssync_receiver.decode_missing" title="swift.obj.ssync_receiver.decode_missing"><code class="xref py py-func docutils literal"><span class="pre">decode_missing()</span></code></a></p>
</dd></dl>
<span class="target" id="module-swift.obj.ssync_receiver"></span><dl class="class">
<dt id="swift.obj.ssync_receiver.Receiver">
<em class="property">class </em><code class="descclassname">swift.obj.ssync_receiver.</code><code class="descname">Receiver</code><span class="sig-paren">(</span><em>app</em>, <em>request</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_receiver.Receiver" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Handles incoming SSYNC requests to the object server.</p>
<p>These requests come from the object-replicator daemon that uses
<a class="reference internal" href="#module-swift.obj.ssync_sender" title="swift.obj.ssync_sender"><code class="xref py py-mod docutils literal"><span class="pre">ssync_sender</span></code></a>.</p>
<p>The number of concurrent SSYNC requests is restricted by
use of a replication_semaphore and can be configured with the
object-server.conf [object-server] replication_concurrency
setting.</p>
<p>An SSYNC request is really just an HTTP conduit for
sender/receiver replication communication. The overall
SSYNC request should always succeed, but it will contain
multiple requests within its request and response bodies. This
“hack” is done so that replication concurrency can be managed.</p>
<p>The general process inside an SSYNC request is:</p>
<blockquote>
<div><ol class="arabic simple">
<li>Initialize the request: Basic request validation, mount check,
acquire semaphore lock, etc..</li>
<li>Missing check: Sender sends the hashes and timestamps of
the object information it can send, receiver sends back
the hashes it wants (doesn’t have or has an older
timestamp).</li>
<li>Updates: Sender sends the object information requested.</li>
<li>Close down: Release semaphore lock, etc.</li>
</ol>
</div></blockquote>
<dl class="method">
<dt id="swift.obj.ssync_receiver.Receiver.initialize_request">
<code class="descname">initialize_request</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_receiver.Receiver.initialize_request" title="Permalink to this definition">¶</a></dt>
<dd><p>Basic validation of request and mount check.</p>
<p>This function will be called before attempting to acquire a
replication semaphore lock, so contains only quick checks.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.ssync_receiver.Receiver.missing_check">
<code class="descname">missing_check</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_receiver.Receiver.missing_check" title="Permalink to this definition">¶</a></dt>
<dd><p>Handles the receiver-side of the MISSING_CHECK step of a
SSYNC request.</p>
<p>Receives a list of hashes and timestamps of object
information the sender can provide and responds with a list
of hashes desired, either because they’re missing or have an
older timestamp locally.</p>
<p>The process is generally:</p>
<blockquote>
<div><ol class="arabic">
<li><p class="first">Sender sends <cite>:MISSING_CHECK: START</cite> and begins
sending <cite>hash timestamp</cite> lines.</p>
</li>
<li><p class="first">Receiver gets <cite>:MISSING_CHECK: START</cite> and begins
reading the <cite>hash timestamp</cite> lines, collecting the
hashes of those it desires.</p>
</li>
<li><p class="first">Sender sends <cite>:MISSING_CHECK: END</cite>.</p>
</li>
<li><p class="first">Receiver gets <cite>:MISSING_CHECK: END</cite>, responds with
<cite>:MISSING_CHECK: START</cite>, followed by the list of
<wanted_hash> specifiers it collected as being wanted
(one per line), <cite>:MISSING_CHECK: END</cite>, and flushes any
buffers.</p>
<p>Each <wanted_hash> specifier has the form <hash>[ <parts>] where
<parts> is a string containing characters ‘d’ and/or ‘m’
indicating that only data or meta part of object respectively is
required to be sync’d.</p>
</li>
<li><p class="first">Sender gets <cite>:MISSING_CHECK: START</cite> and reads the list
of hashes desired by the receiver until reading
<cite>:MISSING_CHECK: END</cite>.</p>
</li>
</ol>
</div></blockquote>
<p>The collection and then response is so the sender doesn’t
have to read while it writes to ensure network buffers don’t
fill up and block everything.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.ssync_receiver.Receiver.updates">
<code class="descname">updates</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_receiver.Receiver.updates" title="Permalink to this definition">¶</a></dt>
<dd><p>Handles the UPDATES step of an SSYNC request.</p>
<p>Receives a set of PUT and DELETE subrequests that will be
routed to the object server itself for processing. These
contain the information requested by the MISSING_CHECK step.</p>
<p>The PUT and DELETE subrequests are formatted pretty much
exactly like regular HTTP requests, excepting the HTTP
version on the first request line.</p>
<p>The process is generally:</p>
<blockquote>
<div><ol class="arabic simple">
<li>Sender sends <cite>:UPDATES: START</cite> and begins sending the
PUT and DELETE subrequests.</li>
<li>Receiver gets <cite>:UPDATES: START</cite> and begins routing the
subrequests to the object server.</li>
<li>Sender sends <cite>:UPDATES: END</cite>.</li>
<li>Receiver gets <cite>:UPDATES: END</cite> and sends <cite>:UPDATES:
START</cite> and <cite>:UPDATES: END</cite> (assuming no errors).</li>
<li>Sender gets <cite>:UPDATES: START</cite> and <cite>:UPDATES: END</cite>.</li>
</ol>
</div></blockquote>
<p>If too many subrequests fail, as configured by
replication_failure_threshold and replication_failure_ratio,
the receiver will hang up the request early so as to not
waste any more time.</p>
<p>At step 4, the receiver will send back an error if there were
any failures (that didn’t cause a hangup due to the above
thresholds) so the sender knows the whole was not entirely a
success. This is so the sender knows if it can remove an out
of place partition, for example.</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="swift.obj.ssync_receiver.decode_missing">
<code class="descclassname">swift.obj.ssync_receiver.</code><code class="descname">decode_missing</code><span class="sig-paren">(</span><em>line</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_receiver.decode_missing" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse a string of the form generated by
<a class="reference internal" href="#swift.obj.ssync_sender.encode_missing" title="swift.obj.ssync_sender.encode_missing"><code class="xref py py-func docutils literal"><span class="pre">encode_missing()</span></code></a> and return a dict
with keys <code class="docutils literal"><span class="pre">object_hash</span></code>, <code class="docutils literal"><span class="pre">ts_data</span></code>, <code class="docutils literal"><span class="pre">ts_meta</span></code>, <code class="docutils literal"><span class="pre">ts_ctype</span></code>.</p>
<p>The encoder for this line is
<a class="reference internal" href="#swift.obj.ssync_sender.encode_missing" title="swift.obj.ssync_sender.encode_missing"><code class="xref py py-func docutils literal"><span class="pre">encode_missing()</span></code></a></p>
</dd></dl>
<dl class="function">
<dt id="swift.obj.ssync_receiver.encode_wanted">
<code class="descclassname">swift.obj.ssync_receiver.</code><code class="descname">encode_wanted</code><span class="sig-paren">(</span><em>remote</em>, <em>local</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.ssync_receiver.encode_wanted" title="Permalink to this definition">¶</a></dt>
<dd><p>Compare a remote and local results and generate a wanted line.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>remote</strong> – a dict, with ts_data and ts_meta keys in the form
returned by <a class="reference internal" href="#swift.obj.ssync_receiver.decode_missing" title="swift.obj.ssync_receiver.decode_missing"><code class="xref py py-func docutils literal"><span class="pre">decode_missing()</span></code></a></li>
<li><strong>local</strong> – a dict, possibly empty, with ts_data and ts_meta keys
in the form returned <code class="xref py py-meth docutils literal"><span class="pre">Receiver._check_local()</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>The decoder for this line is
<a class="reference internal" href="#swift.obj.ssync_sender.decode_wanted" title="swift.obj.ssync_sender.decode_wanted"><code class="xref py py-func docutils literal"><span class="pre">decode_wanted()</span></code></a></p>
</dd></dl>
</div>
<div class="section" id="module-swift.obj.server">
<span id="id4"></span><span id="object-server"></span><h2>Object Server<a class="headerlink" href="#module-swift.obj.server" title="Permalink to this headline">¶</a></h2>
<p>Object Server for Swift</p>
<dl class="class">
<dt id="swift.obj.server.EventletPlungerString">
<em class="property">class </em><code class="descclassname">swift.obj.server.</code><code class="descname">EventletPlungerString</code><a class="headerlink" href="#swift.obj.server.EventletPlungerString" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">str</span></code></p>
<p>Eventlet won’t send headers until it’s accumulated at least
eventlet.wsgi.MINIMUM_CHUNK_SIZE bytes or the app iter is exhausted. If we
want to send the response body behind Eventlet’s back, perhaps with some
zero-copy wizardry, then we have to unclog the plumbing in eventlet.wsgi
to force the headers out, so we use an EventletPlungerString to empty out
all of Eventlet’s buffers.</p>
</dd></dl>
<dl class="class">
<dt id="swift.obj.server.ObjectController">
<em class="property">class </em><code class="descclassname">swift.obj.server.</code><code class="descname">ObjectController</code><span class="sig-paren">(</span><em>conf</em>, <em>logger=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">swift.common.base_storage_server.BaseStorageServer</span></code></p>
<p>Implements the WSGI application for the Swift Object Server.</p>
<dl class="method">
<dt id="swift.obj.server.ObjectController.DELETE">
<code class="descname">DELETE</code><span class="sig-paren">(</span><em>ctrl</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.DELETE" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle HTTP DELETE requests for the Swift Object Server.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.GET">
<code class="descname">GET</code><span class="sig-paren">(</span><em>ctrl</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.GET" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle HTTP GET requests for the Swift Object Server.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.HEAD">
<code class="descname">HEAD</code><span class="sig-paren">(</span><em>ctrl</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.HEAD" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle HTTP HEAD requests for the Swift Object Server.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.POST">
<code class="descname">POST</code><span class="sig-paren">(</span><em>ctrl</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.POST" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle HTTP POST requests for the Swift Object Server.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.PUT">
<code class="descname">PUT</code><span class="sig-paren">(</span><em>ctrl</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.PUT" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle HTTP PUT requests for the Swift Object Server.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.REPLICATE">
<code class="descname">REPLICATE</code><span class="sig-paren">(</span><em>ctrl</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.REPLICATE" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle REPLICATE requests for the Swift Object Server. This is used
by the object replicator to get hashes for directories.</p>
<p>Note that the name REPLICATE is preserved for historical reasons as
this verb really just returns the hashes information for the specified
parameters and is used, for example, by both replication and EC.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.SSYNC">
<code class="descname">SSYNC</code><span class="sig-paren">(</span><em>ctrl</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.SSYNC" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.async_update">
<code class="descname">async_update</code><span class="sig-paren">(</span><em>op</em>, <em>account</em>, <em>container</em>, <em>obj</em>, <em>host</em>, <em>partition</em>, <em>contdevice</em>, <em>headers_out</em>, <em>objdevice</em>, <em>policy</em>, <em>logger_thread_locals=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.async_update" title="Permalink to this definition">¶</a></dt>
<dd><p>Sends or saves an async update.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>op</strong> – operation performed (ex: ‘PUT’, or ‘DELETE’)</li>
<li><strong>account</strong> – account name for the object</li>
<li><strong>container</strong> – container name for the object</li>
<li><strong>obj</strong> – object name</li>
<li><strong>host</strong> – host that the container is on</li>
<li><strong>partition</strong> – partition that the container is on</li>
<li><strong>contdevice</strong> – device name that the container is on</li>
<li><strong>headers_out</strong> – dictionary of headers to send in the container
request</li>
<li><strong>objdevice</strong> – device name that the object is in</li>
<li><strong>policy</strong> – the associated BaseStoragePolicy instance</li>
<li><strong>logger_thread_locals</strong> – The thread local values to be set on the
self.logger to retain transaction
logging information.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.container_update">
<code class="descname">container_update</code><span class="sig-paren">(</span><em>op</em>, <em>account</em>, <em>container</em>, <em>obj</em>, <em>request</em>, <em>headers_out</em>, <em>objdevice</em>, <em>policy</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.container_update" title="Permalink to this definition">¶</a></dt>
<dd><p>Update the container when objects are updated.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>op</strong> – operation performed (ex: ‘PUT’, or ‘DELETE’)</li>
<li><strong>account</strong> – account name for the object</li>
<li><strong>container</strong> – container name for the object</li>
<li><strong>obj</strong> – object name</li>
<li><strong>request</strong> – the original request object driving the update</li>
<li><strong>headers_out</strong> – dictionary of headers to send in the container
request(s)</li>
<li><strong>objdevice</strong> – device name that the object is in</li>
<li><strong>policy</strong> – the BaseStoragePolicy instance</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.delete_at_update">
<code class="descname">delete_at_update</code><span class="sig-paren">(</span><em>op</em>, <em>delete_at</em>, <em>account</em>, <em>container</em>, <em>obj</em>, <em>request</em>, <em>objdevice</em>, <em>policy</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.delete_at_update" title="Permalink to this definition">¶</a></dt>
<dd><p>Update the expiring objects container when objects are updated.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>op</strong> – operation performed (ex: ‘PUT’, or ‘DELETE’)</li>
<li><strong>delete_at</strong> – scheduled delete in UNIX seconds, int</li>
<li><strong>account</strong> – account name for the object</li>
<li><strong>container</strong> – container name for the object</li>
<li><strong>obj</strong> – object name</li>
<li><strong>request</strong> – the original request driving the update</li>
<li><strong>objdevice</strong> – device name that the object is in</li>
<li><strong>policy</strong> – the BaseStoragePolicy instance (used for tmp dir)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.get_diskfile">
<code class="descname">get_diskfile</code><span class="sig-paren">(</span><em>device</em>, <em>partition</em>, <em>account</em>, <em>container</em>, <em>obj</em>, <em>policy</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.get_diskfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Utility method for instantiating a DiskFile object supporting a given
REST API.</p>
<p>An implementation of the object server that wants to use a different
DiskFile class would simply over-ride this method to provide that
behavior.</p>
</dd></dl>
<dl class="attribute">
<dt id="swift.obj.server.ObjectController.server_type">
<code class="descname">server_type</code><em class="property"> = 'object-server'</em><a class="headerlink" href="#swift.obj.server.ObjectController.server_type" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="swift.obj.server.ObjectController.setup">
<code class="descname">setup</code><span class="sig-paren">(</span><em>conf</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.ObjectController.setup" title="Permalink to this definition">¶</a></dt>
<dd><p>Implementation specific setup. This method is called at the very end
by the constructor to allow a specific implementation to modify
existing attributes or add its own attributes.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>conf</strong> – WSGI configuration parameter</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="swift.obj.server.app_factory">
<code class="descclassname">swift.obj.server.</code><code class="descname">app_factory</code><span class="sig-paren">(</span><em>global_conf</em>, <em>**local_conf</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.app_factory" title="Permalink to this definition">¶</a></dt>
<dd><p>paste.deploy app factory for creating WSGI object server apps</p>
</dd></dl>
<dl class="function">
<dt id="swift.obj.server.drain">
<code class="descclassname">swift.obj.server.</code><code class="descname">drain</code><span class="sig-paren">(</span><em>file_like</em>, <em>read_size</em>, <em>timeout</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.drain" title="Permalink to this definition">¶</a></dt>
<dd><p>Read and discard any bytes from file_like.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>file_like</strong> – file-like object to read from</li>
<li><strong>read_size</strong> – how big a chunk to read at a time</li>
<li><strong>timeout</strong> – how long to wait for a read (use None for no timeout)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><strong>ChunkReadTimeout</strong> – if no chunk was read in time</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="swift.obj.server.global_conf_callback">
<code class="descclassname">swift.obj.server.</code><code class="descname">global_conf_callback</code><span class="sig-paren">(</span><em>preloaded_app_conf</em>, <em>global_conf</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.global_conf_callback" title="Permalink to this definition">¶</a></dt>
<dd><p>Callback for swift.common.wsgi.run_wsgi during the global_conf
creation so that we can add our replication_semaphore, used to
limit the number of concurrent SSYNC_REQUESTS across all
workers.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>preloaded_app_conf</strong> – The preloaded conf for the WSGI app.
This conf instance will go away, so
just read from it, don’t write.</li>
<li><strong>global_conf</strong> – The global conf that will eventually be
passed to the app_factory function later.
This conf is created before the worker
subprocesses are forked, so can be useful to
set up semaphores, shared memory, etc.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="swift.obj.server.iter_mime_headers_and_bodies">
<code class="descclassname">swift.obj.server.</code><code class="descname">iter_mime_headers_and_bodies</code><span class="sig-paren">(</span><em>wsgi_input</em>, <em>mime_boundary</em>, <em>read_chunk_size</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.server.iter_mime_headers_and_bodies" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-swift.obj.updater">
<span id="id5"></span><span id="object-updater"></span><h2>Object Updater<a class="headerlink" href="#module-swift.obj.updater" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="swift.obj.updater.ObjectUpdater">
<em class="property">class </em><code class="descclassname">swift.obj.updater.</code><code class="descname">ObjectUpdater</code><span class="sig-paren">(</span><em>conf</em>, <em>logger=None</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.updater.ObjectUpdater" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">swift.common.daemon.Daemon</span></code></p>
<p>Update object information in container listings.</p>
<dl class="method">
<dt id="swift.obj.updater.ObjectUpdater.get_container_ring">
<code class="descname">get_container_ring</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.updater.ObjectUpdater.get_container_ring" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the container ring. Load it, if it hasn’t been yet.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.updater.ObjectUpdater.object_sweep">
<code class="descname">object_sweep</code><span class="sig-paren">(</span><em>device</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.updater.ObjectUpdater.object_sweep" title="Permalink to this definition">¶</a></dt>
<dd><p>If there are async pendings on the device, walk each one and update.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>device</strong> – path to device</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.updater.ObjectUpdater.object_update">
<code class="descname">object_update</code><span class="sig-paren">(</span><em>node</em>, <em>part</em>, <em>op</em>, <em>obj</em>, <em>headers_out</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.updater.ObjectUpdater.object_update" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform the object update to the container</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>node</strong> – node dictionary from the container ring</li>
<li><strong>part</strong> – partition that holds the container</li>
<li><strong>op</strong> – operation performed (ex: ‘PUT’ or ‘DELETE’)</li>
<li><strong>obj</strong> – object name being updated</li>
<li><strong>headers_out</strong> – headers to send with the update</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.updater.ObjectUpdater.process_object_update">
<code class="descname">process_object_update</code><span class="sig-paren">(</span><em>update_path</em>, <em>device</em>, <em>policy</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.updater.ObjectUpdater.process_object_update" title="Permalink to this definition">¶</a></dt>
<dd><p>Process the object information to be updated and update.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>update_path</strong> – path to pickled object update file</li>
<li><strong>device</strong> – path to device</li>
<li><strong>policy</strong> – storage policy of object update</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="swift.obj.updater.ObjectUpdater.run_forever">
<code class="descname">run_forever</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.updater.ObjectUpdater.run_forever" title="Permalink to this definition">¶</a></dt>
<dd><p>Run the updater continuously.</p>
</dd></dl>
<dl class="method">
<dt id="swift.obj.updater.ObjectUpdater.run_once">
<code class="descname">run_once</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#swift.obj.updater.ObjectUpdater.run_once" title="Permalink to this definition">¶</a></dt>
<dd><p>Run the updater once.</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="swift.obj.updater.random">
<code class="descclassname">swift.obj.updater.</code><code class="descname">random</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → x in the interval [0, 1).<a class="headerlink" href="#swift.obj.updater.random" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Object</a><ul>
<li><a class="reference internal" href="#module-swift.obj.auditor">Object Auditor</a></li>
<li><a class="reference internal" href="#module-swift.obj.diskfile">Object Backend</a></li>
<li><a class="reference internal" href="#module-swift.obj.replicator">Object Replicator</a></li>
<li><a class="reference internal" href="#module-swift.obj.server">Object Server</a></li>
<li><a class="reference internal" href="#module-swift.obj.updater">Object Updater</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="db.html"
title="previous chapter">Account DB and Container DB</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="misc.html"
title="next chapter">Misc</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/object.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="misc.html" title="Misc"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="db.html" title="Account DB and Container DB"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">swift 2.7.0 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2016, OpenStack Foundation.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.6.
</div>
<script type="text/javascript">
try {
//Tracking docs.openstack.org/developer/<projectname> only
//The URL is built from the project variable in conf.py
var pageTracker = _gat._getTracker("UA-17511903-1");
pageTracker._setCookiePath("/developer/swift");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
|