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 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683
// This file is @generated by prost-build.
/// The values associated with a key of an attribute.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AttributeValues {
/// The list of values associated with a key.
#[prost(bytes = "bytes", repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<::prost::bytes::Bytes>,
}
/// A message that is published by publishers and delivered to subscribers.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PubSubMessage {
/// The key used for routing messages to partitions or for compaction (e.g.,
/// keep the last N messages per key). If the key is empty, the message is
/// routed to an arbitrary partition.
#[prost(bytes = "bytes", tag = "1")]
pub key: ::prost::bytes::Bytes,
/// The payload of the message.
#[prost(bytes = "bytes", tag = "2")]
pub data: ::prost::bytes::Bytes,
/// Optional attributes that can be used for message metadata/headers.
#[prost(btree_map = "string, message", tag = "3")]
pub attributes: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
AttributeValues,
>,
/// An optional, user-specified event time.
#[prost(message, optional, tag = "4")]
pub event_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// A cursor that describes the position of a message within a topic partition.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Cursor {
/// The offset of a message within a topic partition. Must be greater than or
/// equal 0.
#[prost(int64, tag = "1")]
pub offset: i64,
}
/// A message that has been stored and sequenced by the Pub/Sub Lite system.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SequencedMessage {
/// The position of a message within the partition where it is stored.
#[prost(message, optional, tag = "1")]
pub cursor: ::core::option::Option<Cursor>,
/// The time when the message was received by the server when it was first
/// published.
#[prost(message, optional, tag = "2")]
pub publish_time: ::core::option::Option<::prost_types::Timestamp>,
/// The user message.
#[prost(message, optional, tag = "3")]
pub message: ::core::option::Option<PubSubMessage>,
/// The size in bytes of this message for flow control and quota purposes.
#[prost(int64, tag = "4")]
pub size_bytes: i64,
}
/// Metadata about a reservation resource.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Reservation {
/// The name of the reservation.
/// Structured like:
/// projects/{project_number}/locations/{location}/reservations/{reservation_id}
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The reserved throughput capacity. Every unit of throughput capacity is
/// equivalent to 1 MiB/s of published messages or 2 MiB/s of subscribed
/// messages.
///
/// Any topics which are declared as using capacity from a Reservation will
/// consume resources from this reservation instead of being charged
/// individually.
#[prost(int64, tag = "2")]
pub throughput_capacity: i64,
}
/// Metadata about a topic resource.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Topic {
/// The name of the topic.
/// Structured like:
/// projects/{project_number}/locations/{location}/topics/{topic_id}
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The settings for this topic's partitions.
#[prost(message, optional, tag = "2")]
pub partition_config: ::core::option::Option<topic::PartitionConfig>,
/// The settings for this topic's message retention.
#[prost(message, optional, tag = "3")]
pub retention_config: ::core::option::Option<topic::RetentionConfig>,
/// The settings for this topic's Reservation usage.
#[prost(message, optional, tag = "4")]
pub reservation_config: ::core::option::Option<topic::ReservationConfig>,
}
/// Nested message and enum types in `Topic`.
pub mod topic {
/// The settings for a topic's partitions.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PartitionConfig {
/// The number of partitions in the topic. Must be at least 1.
///
/// Once a topic has been created the number of partitions can be increased
/// but not decreased. Message ordering is not guaranteed across a topic
/// resize. For more information see
/// <https://cloud.google.com/pubsub/lite/docs/topics#scaling_capacity>
#[prost(int64, tag = "1")]
pub count: i64,
/// The throughput dimension of this topic.
#[prost(oneof = "partition_config::Dimension", tags = "2, 3")]
pub dimension: ::core::option::Option<partition_config::Dimension>,
}
/// Nested message and enum types in `PartitionConfig`.
pub mod partition_config {
/// The throughput capacity configuration for each partition.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Capacity {
/// Publish throughput capacity per partition in MiB/s.
/// Must be >= 4 and <= 16.
#[prost(int32, tag = "1")]
pub publish_mib_per_sec: i32,
/// Subscribe throughput capacity per partition in MiB/s.
/// Must be >= 4 and <= 32.
#[prost(int32, tag = "2")]
pub subscribe_mib_per_sec: i32,
}
/// The throughput dimension of this topic.
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Dimension {
/// DEPRECATED: Use capacity instead which can express a superset of
/// configurations.
///
/// Every partition in the topic is allocated throughput equivalent to
/// `scale` times the standard partition throughput (4 MiB/s). This is also
/// reflected in the cost of this topic; a topic with `scale` of 2 and
/// count of 10 is charged for 20 partitions. This value must be in the
/// range \[1,4\].
#[prost(int32, tag = "2")]
Scale(i32),
/// The capacity configuration.
#[prost(message, tag = "3")]
Capacity(Capacity),
}
}
/// The settings for a topic's message retention.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RetentionConfig {
/// The provisioned storage, in bytes, per partition. If the number of bytes
/// stored in any of the topic's partitions grows beyond this value, older
/// messages will be dropped to make room for newer ones, regardless of the
/// value of `period`.
#[prost(int64, tag = "1")]
pub per_partition_bytes: i64,
/// How long a published message is retained. If unset, messages will be
/// retained as long as the bytes retained for each partition is below
/// `per_partition_bytes`.
#[prost(message, optional, tag = "2")]
pub period: ::core::option::Option<::prost_types::Duration>,
}
/// The settings for this topic's Reservation usage.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReservationConfig {
/// The Reservation to use for this topic's throughput capacity.
/// Structured like:
/// projects/{project_number}/locations/{location}/reservations/{reservation_id}
#[prost(string, tag = "1")]
pub throughput_reservation: ::prost::alloc::string::String,
}
}
/// Metadata about a subscription resource.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Subscription {
/// The name of the subscription.
/// Structured like:
/// projects/{project_number}/locations/{location}/subscriptions/{subscription_id}
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The name of the topic this subscription is attached to.
/// Structured like:
/// projects/{project_number}/locations/{location}/topics/{topic_id}
#[prost(string, tag = "2")]
pub topic: ::prost::alloc::string::String,
/// The settings for this subscription's message delivery.
#[prost(message, optional, tag = "3")]
pub delivery_config: ::core::option::Option<subscription::DeliveryConfig>,
/// If present, messages are automatically written from the Pub/Sub Lite topic
/// associated with this subscription to a destination.
#[prost(message, optional, tag = "4")]
pub export_config: ::core::option::Option<ExportConfig>,
}
/// Nested message and enum types in `Subscription`.
pub mod subscription {
/// The settings for a subscription's message delivery.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeliveryConfig {
/// The DeliveryRequirement for this subscription.
#[prost(enumeration = "delivery_config::DeliveryRequirement", tag = "3")]
pub delivery_requirement: i32,
}
/// Nested message and enum types in `DeliveryConfig`.
pub mod delivery_config {
/// When this subscription should send messages to subscribers relative to
/// messages persistence in storage. For details, see [Creating Lite
/// subscriptions](<https://cloud.google.com/pubsub/lite/docs/subscriptions#creating_lite_subscriptions>).
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum DeliveryRequirement {
/// Default value. This value is unused.
Unspecified = 0,
/// The server does not wait for a published message to be successfully
/// written to storage before delivering it to subscribers.
DeliverImmediately = 1,
/// The server will not deliver a published message to subscribers until
/// the message has been successfully written to storage. This will result
/// in higher end-to-end latency, but consistent delivery.
DeliverAfterStored = 2,
}
impl DeliveryRequirement {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
DeliveryRequirement::Unspecified => {
"DELIVERY_REQUIREMENT_UNSPECIFIED"
}
DeliveryRequirement::DeliverImmediately => "DELIVER_IMMEDIATELY",
DeliveryRequirement::DeliverAfterStored => "DELIVER_AFTER_STORED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DELIVERY_REQUIREMENT_UNSPECIFIED" => Some(Self::Unspecified),
"DELIVER_IMMEDIATELY" => Some(Self::DeliverImmediately),
"DELIVER_AFTER_STORED" => Some(Self::DeliverAfterStored),
_ => None,
}
}
}
}
}
/// Configuration for a Pub/Sub Lite subscription that writes messages to a
/// destination. User subscriber clients must not connect to this subscription.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExportConfig {
/// The desired state of this export. Setting this to values other than
/// `ACTIVE` and `PAUSED` will result in an error.
#[prost(enumeration = "export_config::State", tag = "1")]
pub desired_state: i32,
/// Output only. The current state of the export, which may be different to the
/// desired state due to errors. This field is output only.
#[prost(enumeration = "export_config::State", tag = "6")]
pub current_state: i32,
/// Optional. The name of an optional Pub/Sub Lite topic to publish messages
/// that can not be exported to the destination. For example, the message can
/// not be published to the Pub/Sub service because it does not satisfy the
/// constraints documented at <https://cloud.google.com/pubsub/docs/publisher.>
///
/// Structured like:
/// projects/{project_number}/locations/{location}/topics/{topic_id}.
/// Must be within the same project and location as the subscription. The topic
/// may be changed or removed.
#[prost(string, tag = "5")]
pub dead_letter_topic: ::prost::alloc::string::String,
/// The destination to export to. Required.
#[prost(oneof = "export_config::Destination", tags = "3")]
pub destination: ::core::option::Option<export_config::Destination>,
}
/// Nested message and enum types in `ExportConfig`.
pub mod export_config {
/// Configuration for exporting to a Pub/Sub topic.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PubSubConfig {
/// The name of the Pub/Sub topic.
/// Structured like: projects/{project_number}/topics/{topic_id}.
/// The topic may be changed.
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
}
/// The desired export state.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum State {
/// Default value. This value is unused.
Unspecified = 0,
/// Messages are being exported.
Active = 1,
/// Exporting messages is suspended.
Paused = 2,
/// Messages cannot be exported due to permission denied errors. Output only.
PermissionDenied = 3,
/// Messages cannot be exported due to missing resources. Output only.
NotFound = 4,
}
impl State {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
State::Unspecified => "STATE_UNSPECIFIED",
State::Active => "ACTIVE",
State::Paused => "PAUSED",
State::PermissionDenied => "PERMISSION_DENIED",
State::NotFound => "NOT_FOUND",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STATE_UNSPECIFIED" => Some(Self::Unspecified),
"ACTIVE" => Some(Self::Active),
"PAUSED" => Some(Self::Paused),
"PERMISSION_DENIED" => Some(Self::PermissionDenied),
"NOT_FOUND" => Some(Self::NotFound),
_ => None,
}
}
}
/// The destination to export to. Required.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Destination {
/// Messages are automatically written from the Pub/Sub Lite topic associated
/// with this subscription to a Pub/Sub topic.
#[prost(message, tag = "3")]
PubsubConfig(PubSubConfig),
}
}
/// A target publish or event time. Can be used for seeking to or retrieving the
/// corresponding cursor.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TimeTarget {
/// The type of message time to query.
#[prost(oneof = "time_target::Time", tags = "1, 2")]
pub time: ::core::option::Option<time_target::Time>,
}
/// Nested message and enum types in `TimeTarget`.
pub mod time_target {
/// The type of message time to query.
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Time {
/// Request the cursor of the first message with publish time greater than or
/// equal to `publish_time`. All messages thereafter are guaranteed to have
/// publish times >= `publish_time`.
#[prost(message, tag = "1")]
PublishTime(::prost_types::Timestamp),
/// Request the cursor of the first message with event time greater than or
/// equal to `event_time`. If messages are missing an event time, the publish
/// time is used as a fallback. As event times are user supplied, subsequent
/// messages may have event times less than `event_time` and should be
/// filtered by the client, if necessary.
#[prost(message, tag = "2")]
EventTime(::prost_types::Timestamp),
}
}
/// The first request that must be sent on a newly-opened stream.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialPublishRequest {
/// The topic to which messages will be written.
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
/// The partition within the topic to which messages will be written.
/// Partitions are zero indexed, so `partition` must be in the range [0,
/// topic.num_partitions).
#[prost(int64, tag = "2")]
pub partition: i64,
/// Unique identifier for a publisher client. If set, enables publish
/// idempotency within a publisher client session.
///
/// The length of this field must be exactly 16 bytes long and should be
/// populated with a 128 bit uuid, generated by standard uuid algorithms like
/// uuid1 or uuid4. The same identifier should be reused following
/// disconnections with retryable stream errors.
#[prost(bytes = "bytes", tag = "3")]
pub client_id: ::prost::bytes::Bytes,
}
/// Response to an InitialPublishRequest.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct InitialPublishResponse {}
/// Request to publish messages to the topic.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MessagePublishRequest {
/// The messages to publish.
#[prost(message, repeated, tag = "1")]
pub messages: ::prost::alloc::vec::Vec<PubSubMessage>,
/// The sequence number corresponding to the first message in `messages`.
/// Messages within a batch are ordered and the sequence numbers of all
/// subsequent messages in the batch are assumed to be incremental.
///
/// Sequence numbers are assigned at the message level and the first message
/// published in a publisher client session must have a sequence number of 0.
/// All messages must have contiguous sequence numbers, which uniquely identify
/// the messages accepted by the publisher client. Since messages are ordered,
/// the client only needs to specify the sequence number of the first message
/// in a published batch. The server deduplicates messages with the same
/// sequence number from the same publisher `client_id`.
#[prost(int64, tag = "2")]
pub first_sequence_number: i64,
}
/// Response to a MessagePublishRequest.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MessagePublishResponse {
/// The cursor of the first published message in the batch. The cursors for any
/// remaining messages in the batch are guaranteed to be sequential.
#[prost(message, optional, tag = "1")]
pub start_cursor: ::core::option::Option<Cursor>,
/// Cursors for messages published in the batch. There will exist multiple
/// ranges when cursors are not contiguous within the batch.
///
/// The cursor ranges may not account for all messages in the batch when
/// publish idempotency is enabled. A missing range indicates that cursors
/// could not be determined for messages within the range, as they were
/// deduplicated and the necessary data was not available at publish time.
/// These messages will have offsets when received by a subscriber.
#[prost(message, repeated, tag = "2")]
pub cursor_ranges: ::prost::alloc::vec::Vec<message_publish_response::CursorRange>,
}
/// Nested message and enum types in `MessagePublishResponse`.
pub mod message_publish_response {
/// Cursors for a subrange of published messages.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CursorRange {
/// The cursor of the message at the start index. The cursors for remaining
/// messages up to the end index (exclusive) are sequential.
#[prost(message, optional, tag = "1")]
pub start_cursor: ::core::option::Option<super::Cursor>,
/// Index of the message in the published batch that corresponds to the
/// start cursor. Inclusive.
#[prost(int32, tag = "2")]
pub start_index: i32,
/// Index of the last message in this range. Exclusive.
#[prost(int32, tag = "3")]
pub end_index: i32,
}
}
/// Request sent from the client to the server on a stream.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PublishRequest {
/// The type of request this is.
#[prost(oneof = "publish_request::RequestType", tags = "1, 2")]
pub request_type: ::core::option::Option<publish_request::RequestType>,
}
/// Nested message and enum types in `PublishRequest`.
pub mod publish_request {
/// The type of request this is.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum RequestType {
/// Initial request on the stream.
#[prost(message, tag = "1")]
InitialRequest(super::InitialPublishRequest),
/// Request to publish messages.
#[prost(message, tag = "2")]
MessagePublishRequest(super::MessagePublishRequest),
}
}
/// Response to a PublishRequest.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PublishResponse {
/// The type of response this is.
#[prost(oneof = "publish_response::ResponseType", tags = "1, 2")]
pub response_type: ::core::option::Option<publish_response::ResponseType>,
}
/// Nested message and enum types in `PublishResponse`.
pub mod publish_response {
/// The type of response this is.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ResponseType {
/// Initial response on the stream.
#[prost(message, tag = "1")]
InitialResponse(super::InitialPublishResponse),
/// Response to publishing messages.
#[prost(message, tag = "2")]
MessageResponse(super::MessagePublishResponse),
}
}
/// Generated client implementations.
pub mod publisher_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// The service that a publisher client application uses to publish messages to
/// topics. Published messages are retained by the service for the duration of
/// the retention period configured for the respective topic, and are delivered
/// to subscriber clients upon request (via the `SubscriberService`).
#[derive(Debug, Clone)]
pub struct PublisherServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> PublisherServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> PublisherServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
PublisherServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Establishes a stream with the server for publishing messages. Once the
/// stream is initialized, the client publishes messages by sending publish
/// requests on the stream. The server responds with a PublishResponse for each
/// PublishRequest sent by the client, in the same order that the requests
/// were sent. Note that multiple PublishRequests can be in flight
/// simultaneously, but they will be processed by the server in the order that
/// they are sent by the client on a given stream.
pub async fn publish(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::PublishRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::PublishResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.PublisherService/Publish",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.PublisherService",
"Publish",
),
);
self.inner.streaming(req, path, codec).await
}
}
}
/// The first streaming request that must be sent on a newly-opened stream. The
/// client must wait for the response before sending subsequent requests on the
/// stream.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialCommitCursorRequest {
/// The subscription for which to manage committed cursors.
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
/// The partition for which to manage committed cursors. Partitions are zero
/// indexed, so `partition` must be in the range [0, topic.num_partitions).
#[prost(int64, tag = "2")]
pub partition: i64,
}
/// Response to an InitialCommitCursorRequest.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct InitialCommitCursorResponse {}
/// Streaming request to update the committed cursor. Subsequent
/// SequencedCommitCursorRequests override outstanding ones.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SequencedCommitCursorRequest {
/// The new value for the committed cursor.
#[prost(message, optional, tag = "1")]
pub cursor: ::core::option::Option<Cursor>,
}
/// Response to a SequencedCommitCursorRequest.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SequencedCommitCursorResponse {
/// The number of outstanding SequencedCommitCursorRequests acknowledged by
/// this response. Note that SequencedCommitCursorRequests are acknowledged in
/// the order that they are received.
#[prost(int64, tag = "1")]
pub acknowledged_commits: i64,
}
/// A request sent from the client to the server on a stream.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamingCommitCursorRequest {
/// The type of request this is.
#[prost(oneof = "streaming_commit_cursor_request::Request", tags = "1, 2")]
pub request: ::core::option::Option<streaming_commit_cursor_request::Request>,
}
/// Nested message and enum types in `StreamingCommitCursorRequest`.
pub mod streaming_commit_cursor_request {
/// The type of request this is.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
/// Initial request on the stream.
#[prost(message, tag = "1")]
Initial(super::InitialCommitCursorRequest),
/// Request to commit a new cursor value.
#[prost(message, tag = "2")]
Commit(super::SequencedCommitCursorRequest),
}
}
/// Response to a StreamingCommitCursorRequest.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StreamingCommitCursorResponse {
/// The type of request this is.
#[prost(oneof = "streaming_commit_cursor_response::Request", tags = "1, 2")]
pub request: ::core::option::Option<streaming_commit_cursor_response::Request>,
}
/// Nested message and enum types in `StreamingCommitCursorResponse`.
pub mod streaming_commit_cursor_response {
/// The type of request this is.
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Request {
/// Initial response on the stream.
#[prost(message, tag = "1")]
Initial(super::InitialCommitCursorResponse),
/// Response to committing a new cursor value.
#[prost(message, tag = "2")]
Commit(super::SequencedCommitCursorResponse),
}
}
/// Request for CommitCursor.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitCursorRequest {
/// The subscription for which to update the cursor.
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
/// The partition for which to update the cursor. Partitions are zero indexed,
/// so `partition` must be in the range [0, topic.num_partitions).
#[prost(int64, tag = "2")]
pub partition: i64,
/// The new value for the committed cursor.
#[prost(message, optional, tag = "3")]
pub cursor: ::core::option::Option<Cursor>,
}
/// Response for CommitCursor.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CommitCursorResponse {}
/// Request for ListPartitionCursors.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPartitionCursorsRequest {
/// Required. The subscription for which to retrieve cursors.
/// Structured like
/// `projects/{project_number}/locations/{location}/subscriptions/{subscription_id}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// The maximum number of cursors to return. The service may return fewer than
/// this value.
/// If unset or zero, all cursors for the parent will be returned.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// A page token, received from a previous `ListPartitionCursors` call.
/// Provide this to retrieve the subsequent page.
///
/// When paginating, all other parameters provided to `ListPartitionCursors`
/// must match the call that provided the page token.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// A pair of a Cursor and the partition it is for.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PartitionCursor {
/// The partition this is for.
#[prost(int64, tag = "1")]
pub partition: i64,
/// The value of the cursor.
#[prost(message, optional, tag = "2")]
pub cursor: ::core::option::Option<Cursor>,
}
/// Response for ListPartitionCursors
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPartitionCursorsResponse {
/// The partition cursors from this request.
#[prost(message, repeated, tag = "1")]
pub partition_cursors: ::prost::alloc::vec::Vec<PartitionCursor>,
/// A token, which can be sent as `page_token` to retrieve the next page.
/// If this field is omitted, there are no subsequent pages.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod cursor_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// The service that a subscriber client application uses to manage committed
/// cursors while receiving messsages. A cursor represents a subscriber's
/// progress within a topic partition for a given subscription.
#[derive(Debug, Clone)]
pub struct CursorServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> CursorServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> CursorServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
CursorServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Establishes a stream with the server for managing committed cursors.
pub async fn streaming_commit_cursor(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::StreamingCommitCursorRequest,
>,
) -> std::result::Result<
tonic::Response<
tonic::codec::Streaming<super::StreamingCommitCursorResponse>,
>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.CursorService/StreamingCommitCursor",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.CursorService",
"StreamingCommitCursor",
),
);
self.inner.streaming(req, path, codec).await
}
/// Updates the committed cursor.
pub async fn commit_cursor(
&mut self,
request: impl tonic::IntoRequest<super::CommitCursorRequest>,
) -> std::result::Result<
tonic::Response<super::CommitCursorResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.CursorService/CommitCursor",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.CursorService",
"CommitCursor",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns all committed cursor information for a subscription.
pub async fn list_partition_cursors(
&mut self,
request: impl tonic::IntoRequest<super::ListPartitionCursorsRequest>,
) -> std::result::Result<
tonic::Response<super::ListPartitionCursorsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.CursorService/ListPartitionCursors",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.CursorService",
"ListPartitionCursors",
),
);
self.inner.unary(req, path, codec).await
}
}
}
/// Compute statistics about a range of messages in a given topic and partition.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeMessageStatsRequest {
/// Required. The topic for which we should compute message stats.
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
/// Required. The partition for which we should compute message stats.
#[prost(int64, tag = "2")]
pub partition: i64,
/// The inclusive start of the range.
#[prost(message, optional, tag = "3")]
pub start_cursor: ::core::option::Option<Cursor>,
/// The exclusive end of the range. The range is empty if end_cursor <=
/// start_cursor. Specifying a start_cursor before the first message and an
/// end_cursor after the last message will retrieve all messages.
#[prost(message, optional, tag = "4")]
pub end_cursor: ::core::option::Option<Cursor>,
}
/// Response containing stats for messages in the requested topic and partition.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ComputeMessageStatsResponse {
/// The count of messages.
#[prost(int64, tag = "1")]
pub message_count: i64,
/// The number of quota bytes accounted to these messages.
#[prost(int64, tag = "2")]
pub message_bytes: i64,
/// The minimum publish timestamp across these messages. Note that publish
/// timestamps within a partition are not guaranteed to be non-decreasing. The
/// timestamp will be unset if there are no messages.
#[prost(message, optional, tag = "3")]
pub minimum_publish_time: ::core::option::Option<::prost_types::Timestamp>,
/// The minimum event timestamp across these messages. For the purposes of this
/// computation, if a message does not have an event time, we use the publish
/// time. The timestamp will be unset if there are no messages.
#[prost(message, optional, tag = "4")]
pub minimum_event_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Compute the current head cursor for a partition.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeHeadCursorRequest {
/// Required. The topic for which we should compute the head cursor.
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
/// Required. The partition for which we should compute the head cursor.
#[prost(int64, tag = "2")]
pub partition: i64,
}
/// Response containing the head cursor for the requested topic and partition.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ComputeHeadCursorResponse {
/// The head cursor.
#[prost(message, optional, tag = "1")]
pub head_cursor: ::core::option::Option<Cursor>,
}
/// Compute the corresponding cursor for a publish or event time in a topic
/// partition.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeTimeCursorRequest {
/// Required. The topic for which we should compute the cursor.
#[prost(string, tag = "1")]
pub topic: ::prost::alloc::string::String,
/// Required. The partition for which we should compute the cursor.
#[prost(int64, tag = "2")]
pub partition: i64,
/// Required. The target publish or event time. Specifying a future time will
/// return an unset cursor.
#[prost(message, optional, tag = "3")]
pub target: ::core::option::Option<TimeTarget>,
}
/// Response containing the cursor corresponding to a publish or event time in a
/// topic partition.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ComputeTimeCursorResponse {
/// If present, the cursor references the first message with time greater than
/// or equal to the specified target time. If such a message cannot be found,
/// the cursor will be unset (i.e. `cursor` is not present).
#[prost(message, optional, tag = "1")]
pub cursor: ::core::option::Option<Cursor>,
}
/// Generated client implementations.
pub mod topic_stats_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// This service allows users to get stats about messages in their topic.
#[derive(Debug, Clone)]
pub struct TopicStatsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> TopicStatsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TopicStatsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
TopicStatsServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Compute statistics about a range of messages in a given topic and
/// partition.
pub async fn compute_message_stats(
&mut self,
request: impl tonic::IntoRequest<super::ComputeMessageStatsRequest>,
) -> std::result::Result<
tonic::Response<super::ComputeMessageStatsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.TopicStatsService/ComputeMessageStats",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.TopicStatsService",
"ComputeMessageStats",
),
);
self.inner.unary(req, path, codec).await
}
/// Compute the head cursor for the partition.
/// The head cursor's offset is guaranteed to be less than or equal to all
/// messages which have not yet been acknowledged as published, and
/// greater than the offset of any message whose publish has already
/// been acknowledged. It is zero if there have never been messages in the
/// partition.
pub async fn compute_head_cursor(
&mut self,
request: impl tonic::IntoRequest<super::ComputeHeadCursorRequest>,
) -> std::result::Result<
tonic::Response<super::ComputeHeadCursorResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.TopicStatsService/ComputeHeadCursor",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.TopicStatsService",
"ComputeHeadCursor",
),
);
self.inner.unary(req, path, codec).await
}
/// Compute the corresponding cursor for a publish or event time in a topic
/// partition.
pub async fn compute_time_cursor(
&mut self,
request: impl tonic::IntoRequest<super::ComputeTimeCursorRequest>,
) -> std::result::Result<
tonic::Response<super::ComputeTimeCursorResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.TopicStatsService/ComputeTimeCursor",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.TopicStatsService",
"ComputeTimeCursor",
),
);
self.inner.unary(req, path, codec).await
}
}
}
/// Request for CreateTopic.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateTopicRequest {
/// Required. The parent location in which to create the topic.
/// Structured like `projects/{project_number}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. Configuration of the topic to create. Its `name` field is
/// ignored.
#[prost(message, optional, tag = "2")]
pub topic: ::core::option::Option<Topic>,
/// Required. The ID to use for the topic, which will become the final
/// component of the topic's name.
///
/// This value is structured like: `my-topic-name`.
#[prost(string, tag = "3")]
pub topic_id: ::prost::alloc::string::String,
}
/// Request for GetTopic.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTopicRequest {
/// Required. The name of the topic whose configuration to return.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request for GetTopicPartitions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTopicPartitionsRequest {
/// Required. The topic whose partition information to return.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Response for GetTopicPartitions.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct TopicPartitions {
/// The number of partitions in the topic.
#[prost(int64, tag = "1")]
pub partition_count: i64,
}
/// Request for ListTopics.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicsRequest {
/// Required. The parent whose topics are to be listed.
/// Structured like `projects/{project_number}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// The maximum number of topics to return. The service may return fewer than
/// this value.
/// If unset or zero, all topics for the parent will be returned.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// A page token, received from a previous `ListTopics` call.
/// Provide this to retrieve the subsequent page.
///
/// When paginating, all other parameters provided to `ListTopics` must match
/// the call that provided the page token.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// Response for ListTopics.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicsResponse {
/// The list of topic in the requested parent. The order of the topics is
/// unspecified.
#[prost(message, repeated, tag = "1")]
pub topics: ::prost::alloc::vec::Vec<Topic>,
/// A token that can be sent as `page_token` to retrieve the next page of
/// results. If this field is omitted, there are no more results.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request for UpdateTopic.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateTopicRequest {
/// Required. The topic to update. Its `name` field must be populated.
#[prost(message, optional, tag = "1")]
pub topic: ::core::option::Option<Topic>,
/// Required. A mask specifying the topic fields to change.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// Request for DeleteTopic.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteTopicRequest {
/// Required. The name of the topic to delete.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request for ListTopicSubscriptions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicSubscriptionsRequest {
/// Required. The name of the topic whose subscriptions to list.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The maximum number of subscriptions to return. The service may return fewer
/// than this value.
/// If unset or zero, all subscriptions for the given topic will be returned.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// A page token, received from a previous `ListTopicSubscriptions` call.
/// Provide this to retrieve the subsequent page.
///
/// When paginating, all other parameters provided to `ListTopicSubscriptions`
/// must match the call that provided the page token.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// Response for ListTopicSubscriptions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListTopicSubscriptionsResponse {
/// The names of subscriptions attached to the topic. The order of the
/// subscriptions is unspecified.
#[prost(string, repeated, tag = "1")]
pub subscriptions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// A token that can be sent as `page_token` to retrieve the next page of
/// results. If this field is omitted, there are no more results.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request for CreateSubscription.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateSubscriptionRequest {
/// Required. The parent location in which to create the subscription.
/// Structured like `projects/{project_number}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. Configuration of the subscription to create. Its `name` field is
/// ignored.
#[prost(message, optional, tag = "2")]
pub subscription: ::core::option::Option<Subscription>,
/// Required. The ID to use for the subscription, which will become the final
/// component of the subscription's name.
///
/// This value is structured like: `my-sub-name`.
#[prost(string, tag = "3")]
pub subscription_id: ::prost::alloc::string::String,
/// If true, the newly created subscription will only receive messages
/// published after the subscription was created. Otherwise, the entire
/// message backlog will be received on the subscription. Defaults to false.
#[prost(bool, tag = "4")]
pub skip_backlog: bool,
}
/// Request for GetSubscription.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSubscriptionRequest {
/// Required. The name of the subscription whose configuration to return.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request for ListSubscriptions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSubscriptionsRequest {
/// Required. The parent whose subscriptions are to be listed.
/// Structured like `projects/{project_number}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// The maximum number of subscriptions to return. The service may return fewer
/// than this value.
/// If unset or zero, all subscriptions for the parent will be returned.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// A page token, received from a previous `ListSubscriptions` call.
/// Provide this to retrieve the subsequent page.
///
/// When paginating, all other parameters provided to `ListSubscriptions` must
/// match the call that provided the page token.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// Response for ListSubscriptions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSubscriptionsResponse {
/// The list of subscriptions in the requested parent. The order of the
/// subscriptions is unspecified.
#[prost(message, repeated, tag = "1")]
pub subscriptions: ::prost::alloc::vec::Vec<Subscription>,
/// A token that can be sent as `page_token` to retrieve the next page of
/// results. If this field is omitted, there are no more results.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request for UpdateSubscription.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateSubscriptionRequest {
/// Required. The subscription to update. Its `name` field must be populated.
/// Topic field must not be populated.
#[prost(message, optional, tag = "1")]
pub subscription: ::core::option::Option<Subscription>,
/// Required. A mask specifying the subscription fields to change.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// Request for DeleteSubscription.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteSubscriptionRequest {
/// Required. The name of the subscription to delete.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request for SeekSubscription.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SeekSubscriptionRequest {
/// Required. The name of the subscription to seek.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The target to seek to. Must be set.
#[prost(oneof = "seek_subscription_request::Target", tags = "2, 3")]
pub target: ::core::option::Option<seek_subscription_request::Target>,
}
/// Nested message and enum types in `SeekSubscriptionRequest`.
pub mod seek_subscription_request {
/// A named position with respect to the message backlog.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum NamedTarget {
/// Unspecified named target. Do not use.
Unspecified = 0,
/// Seek to the oldest retained message.
Tail = 1,
/// Seek past all recently published messages, skipping the entire message
/// backlog.
Head = 2,
}
impl NamedTarget {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
NamedTarget::Unspecified => "NAMED_TARGET_UNSPECIFIED",
NamedTarget::Tail => "TAIL",
NamedTarget::Head => "HEAD",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NAMED_TARGET_UNSPECIFIED" => Some(Self::Unspecified),
"TAIL" => Some(Self::Tail),
"HEAD" => Some(Self::Head),
_ => None,
}
}
}
/// The target to seek to. Must be set.
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Target {
/// Seek to a named position with respect to the message backlog.
#[prost(enumeration = "NamedTarget", tag = "2")]
NamedTarget(i32),
/// Seek to the first message whose publish or event time is greater than or
/// equal to the specified query time. If no such message can be located,
/// will seek to the end of the message backlog.
#[prost(message, tag = "3")]
TimeTarget(super::TimeTarget),
}
}
/// Response for SeekSubscription long running operation.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SeekSubscriptionResponse {}
/// Metadata for long running operations.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OperationMetadata {
/// The time the operation was created.
#[prost(message, optional, tag = "1")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// The time the operation finished running. Not set if the operation has not
/// completed.
#[prost(message, optional, tag = "2")]
pub end_time: ::core::option::Option<::prost_types::Timestamp>,
/// Resource path for the target of the operation. For example, targets of
/// seeks are subscription resources, structured like:
/// projects/{project_number}/locations/{location}/subscriptions/{subscription_id}
#[prost(string, tag = "3")]
pub target: ::prost::alloc::string::String,
/// Name of the verb executed by the operation.
#[prost(string, tag = "4")]
pub verb: ::prost::alloc::string::String,
}
/// Request for CreateReservation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateReservationRequest {
/// Required. The parent location in which to create the reservation.
/// Structured like `projects/{project_number}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. Configuration of the reservation to create. Its `name` field is
/// ignored.
#[prost(message, optional, tag = "2")]
pub reservation: ::core::option::Option<Reservation>,
/// Required. The ID to use for the reservation, which will become the final
/// component of the reservation's name.
///
/// This value is structured like: `my-reservation-name`.
#[prost(string, tag = "3")]
pub reservation_id: ::prost::alloc::string::String,
}
/// Request for GetReservation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetReservationRequest {
/// Required. The name of the reservation whose configuration to return.
/// Structured like:
/// projects/{project_number}/locations/{location}/reservations/{reservation_id}
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request for ListReservations.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReservationsRequest {
/// Required. The parent whose reservations are to be listed.
/// Structured like `projects/{project_number}/locations/{location}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// The maximum number of reservations to return. The service may return fewer
/// than this value. If unset or zero, all reservations for the parent will be
/// returned.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// A page token, received from a previous `ListReservations` call.
/// Provide this to retrieve the subsequent page.
///
/// When paginating, all other parameters provided to `ListReservations` must
/// match the call that provided the page token.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// Response for ListReservations.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReservationsResponse {
/// The list of reservation in the requested parent. The order of the
/// reservations is unspecified.
#[prost(message, repeated, tag = "1")]
pub reservations: ::prost::alloc::vec::Vec<Reservation>,
/// A token that can be sent as `page_token` to retrieve the next page of
/// results. If this field is omitted, there are no more results.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request for UpdateReservation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateReservationRequest {
/// Required. The reservation to update. Its `name` field must be populated.
#[prost(message, optional, tag = "1")]
pub reservation: ::core::option::Option<Reservation>,
/// Required. A mask specifying the reservation fields to change.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// Request for DeleteReservation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteReservationRequest {
/// Required. The name of the reservation to delete.
/// Structured like:
/// projects/{project_number}/locations/{location}/reservations/{reservation_id}
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request for ListReservationTopics.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReservationTopicsRequest {
/// Required. The name of the reservation whose topics to list.
/// Structured like:
/// projects/{project_number}/locations/{location}/reservations/{reservation_id}
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The maximum number of topics to return. The service may return fewer
/// than this value.
/// If unset or zero, all topics for the given reservation will be returned.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// A page token, received from a previous `ListReservationTopics` call.
/// Provide this to retrieve the subsequent page.
///
/// When paginating, all other parameters provided to `ListReservationTopics`
/// must match the call that provided the page token.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// Response for ListReservationTopics.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListReservationTopicsResponse {
/// The names of topics attached to the reservation. The order of the
/// topics is unspecified.
#[prost(string, repeated, tag = "1")]
pub topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// A token that can be sent as `page_token` to retrieve the next page of
/// results. If this field is omitted, there are no more results.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod admin_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// The service that a client application uses to manage topics and
/// subscriptions, such creating, listing, and deleting topics and subscriptions.
#[derive(Debug, Clone)]
pub struct AdminServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> AdminServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> AdminServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
AdminServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Creates a new topic.
pub async fn create_topic(
&mut self,
request: impl tonic::IntoRequest<super::CreateTopicRequest>,
) -> std::result::Result<tonic::Response<super::Topic>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/CreateTopic",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"CreateTopic",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns the topic configuration.
pub async fn get_topic(
&mut self,
request: impl tonic::IntoRequest<super::GetTopicRequest>,
) -> std::result::Result<tonic::Response<super::Topic>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/GetTopic",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"GetTopic",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns the partition information for the requested topic.
pub async fn get_topic_partitions(
&mut self,
request: impl tonic::IntoRequest<super::GetTopicPartitionsRequest>,
) -> std::result::Result<
tonic::Response<super::TopicPartitions>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/GetTopicPartitions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"GetTopicPartitions",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns the list of topics for the given project.
pub async fn list_topics(
&mut self,
request: impl tonic::IntoRequest<super::ListTopicsRequest>,
) -> std::result::Result<
tonic::Response<super::ListTopicsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/ListTopics",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"ListTopics",
),
);
self.inner.unary(req, path, codec).await
}
/// Updates properties of the specified topic.
pub async fn update_topic(
&mut self,
request: impl tonic::IntoRequest<super::UpdateTopicRequest>,
) -> std::result::Result<tonic::Response<super::Topic>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/UpdateTopic",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"UpdateTopic",
),
);
self.inner.unary(req, path, codec).await
}
/// Deletes the specified topic.
pub async fn delete_topic(
&mut self,
request: impl tonic::IntoRequest<super::DeleteTopicRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/DeleteTopic",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"DeleteTopic",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists the subscriptions attached to the specified topic.
pub async fn list_topic_subscriptions(
&mut self,
request: impl tonic::IntoRequest<super::ListTopicSubscriptionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListTopicSubscriptionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/ListTopicSubscriptions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"ListTopicSubscriptions",
),
);
self.inner.unary(req, path, codec).await
}
/// Creates a new subscription.
pub async fn create_subscription(
&mut self,
request: impl tonic::IntoRequest<super::CreateSubscriptionRequest>,
) -> std::result::Result<tonic::Response<super::Subscription>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/CreateSubscription",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"CreateSubscription",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns the subscription configuration.
pub async fn get_subscription(
&mut self,
request: impl tonic::IntoRequest<super::GetSubscriptionRequest>,
) -> std::result::Result<tonic::Response<super::Subscription>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/GetSubscription",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"GetSubscription",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns the list of subscriptions for the given project.
pub async fn list_subscriptions(
&mut self,
request: impl tonic::IntoRequest<super::ListSubscriptionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListSubscriptionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/ListSubscriptions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"ListSubscriptions",
),
);
self.inner.unary(req, path, codec).await
}
/// Updates properties of the specified subscription.
pub async fn update_subscription(
&mut self,
request: impl tonic::IntoRequest<super::UpdateSubscriptionRequest>,
) -> std::result::Result<tonic::Response<super::Subscription>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/UpdateSubscription",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"UpdateSubscription",
),
);
self.inner.unary(req, path, codec).await
}
/// Deletes the specified subscription.
pub async fn delete_subscription(
&mut self,
request: impl tonic::IntoRequest<super::DeleteSubscriptionRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/DeleteSubscription",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"DeleteSubscription",
),
);
self.inner.unary(req, path, codec).await
}
/// Performs an out-of-band seek for a subscription to a specified target,
/// which may be timestamps or named positions within the message backlog.
/// Seek translates these targets to cursors for each partition and
/// orchestrates subscribers to start consuming messages from these seek
/// cursors.
///
/// If an operation is returned, the seek has been registered and subscribers
/// will eventually receive messages from the seek cursors (i.e. eventual
/// consistency), as long as they are using a minimum supported client library
/// version and not a system that tracks cursors independently of Pub/Sub Lite
/// (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for
/// unsupported clients.
///
/// If clients would like to know when subscribers react to the seek (or not),
/// they can poll the operation. The seek operation will succeed and complete
/// once subscribers are ready to receive messages from the seek cursors for
/// all partitions of the topic. This means that the seek operation will not
/// complete until all subscribers come online.
///
/// If the previous seek operation has not yet completed, it will be aborted
/// and the new invocation of seek will supersede it.
pub async fn seek_subscription(
&mut self,
request: impl tonic::IntoRequest<super::SeekSubscriptionRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::longrunning::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/SeekSubscription",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"SeekSubscription",
),
);
self.inner.unary(req, path, codec).await
}
/// Creates a new reservation.
pub async fn create_reservation(
&mut self,
request: impl tonic::IntoRequest<super::CreateReservationRequest>,
) -> std::result::Result<tonic::Response<super::Reservation>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/CreateReservation",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"CreateReservation",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns the reservation configuration.
pub async fn get_reservation(
&mut self,
request: impl tonic::IntoRequest<super::GetReservationRequest>,
) -> std::result::Result<tonic::Response<super::Reservation>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/GetReservation",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"GetReservation",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns the list of reservations for the given project.
pub async fn list_reservations(
&mut self,
request: impl tonic::IntoRequest<super::ListReservationsRequest>,
) -> std::result::Result<
tonic::Response<super::ListReservationsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/ListReservations",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"ListReservations",
),
);
self.inner.unary(req, path, codec).await
}
/// Updates properties of the specified reservation.
pub async fn update_reservation(
&mut self,
request: impl tonic::IntoRequest<super::UpdateReservationRequest>,
) -> std::result::Result<tonic::Response<super::Reservation>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/UpdateReservation",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"UpdateReservation",
),
);
self.inner.unary(req, path, codec).await
}
/// Deletes the specified reservation.
pub async fn delete_reservation(
&mut self,
request: impl tonic::IntoRequest<super::DeleteReservationRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/DeleteReservation",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"DeleteReservation",
),
);
self.inner.unary(req, path, codec).await
}
/// Lists the topics attached to the specified reservation.
pub async fn list_reservation_topics(
&mut self,
request: impl tonic::IntoRequest<super::ListReservationTopicsRequest>,
) -> std::result::Result<
tonic::Response<super::ListReservationTopicsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.AdminService/ListReservationTopics",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.AdminService",
"ListReservationTopics",
),
);
self.inner.unary(req, path, codec).await
}
}
}
/// The first request that must be sent on a newly-opened stream. The client must
/// wait for the response before sending subsequent requests on the stream.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialSubscribeRequest {
/// The subscription from which to receive messages.
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
/// The partition from which to receive messages. Partitions are zero indexed,
/// so `partition` must be in the range [0, topic.num_partitions).
#[prost(int64, tag = "2")]
pub partition: i64,
/// Optional. Initial target location within the message backlog. If not set,
/// messages will be delivered from the commit cursor for the given
/// subscription and partition.
#[prost(message, optional, tag = "4")]
pub initial_location: ::core::option::Option<SeekRequest>,
}
/// Response to an InitialSubscribeRequest.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct InitialSubscribeResponse {
/// The cursor from which the subscriber will start receiving messages once
/// flow control tokens become available.
#[prost(message, optional, tag = "1")]
pub cursor: ::core::option::Option<Cursor>,
}
/// Request to update the stream's delivery cursor based on the given target.
/// Resets the server available tokens to 0. SeekRequests past head result in
/// stream breakage.
///
/// SeekRequests may not be sent while another SeekRequest is outstanding (i.e.,
/// has not received a SeekResponse) on the same stream.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SeekRequest {
/// The target to seek to. Must be set.
#[prost(oneof = "seek_request::Target", tags = "1, 2")]
pub target: ::core::option::Option<seek_request::Target>,
}
/// Nested message and enum types in `SeekRequest`.
pub mod seek_request {
/// A special target in the partition that takes no other parameters.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum NamedTarget {
/// Default value. This value is unused.
Unspecified = 0,
/// A target corresponding to the most recently published message in the
/// partition.
Head = 1,
/// A target corresponding to the committed cursor for the given subscription
/// and topic partition.
CommittedCursor = 2,
}
impl NamedTarget {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
NamedTarget::Unspecified => "NAMED_TARGET_UNSPECIFIED",
NamedTarget::Head => "HEAD",
NamedTarget::CommittedCursor => "COMMITTED_CURSOR",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NAMED_TARGET_UNSPECIFIED" => Some(Self::Unspecified),
"HEAD" => Some(Self::Head),
"COMMITTED_CURSOR" => Some(Self::CommittedCursor),
_ => None,
}
}
}
/// The target to seek to. Must be set.
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Target {
/// A named target.
#[prost(enumeration = "NamedTarget", tag = "1")]
NamedTarget(i32),
/// A target corresponding to the cursor, pointing to anywhere in the
/// topic partition.
#[prost(message, tag = "2")]
Cursor(super::Cursor),
}
}
/// Response to a SeekRequest.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SeekResponse {
/// The new delivery cursor for the current stream.
#[prost(message, optional, tag = "1")]
pub cursor: ::core::option::Option<Cursor>,
}
/// Request to grant tokens to the server, requesting delivery of messages when
/// they become available.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FlowControlRequest {
/// The number of message tokens to grant. Must be greater than or equal to 0.
#[prost(int64, tag = "1")]
pub allowed_messages: i64,
/// The number of byte tokens to grant. Must be greater than or equal to 0.
#[prost(int64, tag = "2")]
pub allowed_bytes: i64,
}
/// A request sent from the client to the server on a stream.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeRequest {
/// The type of request this is.
#[prost(oneof = "subscribe_request::Request", tags = "1, 2, 3")]
pub request: ::core::option::Option<subscribe_request::Request>,
}
/// Nested message and enum types in `SubscribeRequest`.
pub mod subscribe_request {
/// The type of request this is.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
/// Initial request on the stream.
#[prost(message, tag = "1")]
Initial(super::InitialSubscribeRequest),
/// Request to update the stream's delivery cursor.
#[prost(message, tag = "2")]
Seek(super::SeekRequest),
/// Request to grant tokens to the server,
#[prost(message, tag = "3")]
FlowControl(super::FlowControlRequest),
}
}
/// Response containing a list of messages. Upon delivering a MessageResponse to
/// the client, the server:
/// * Updates the stream's delivery cursor to one greater than the cursor of the
/// last message in the list.
/// * Subtracts the total number of bytes and messages from the tokens available
/// to the server.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MessageResponse {
/// Messages from the topic partition.
#[prost(message, repeated, tag = "1")]
pub messages: ::prost::alloc::vec::Vec<SequencedMessage>,
}
/// Response to SubscribeRequest.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SubscribeResponse {
/// The type of response this is.
#[prost(oneof = "subscribe_response::Response", tags = "1, 2, 3")]
pub response: ::core::option::Option<subscribe_response::Response>,
}
/// Nested message and enum types in `SubscribeResponse`.
pub mod subscribe_response {
/// The type of response this is.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
/// Initial response on the stream.
#[prost(message, tag = "1")]
Initial(super::InitialSubscribeResponse),
/// Response to a Seek operation.
#[prost(message, tag = "2")]
Seek(super::SeekResponse),
/// Response containing messages from the topic partition.
#[prost(message, tag = "3")]
Messages(super::MessageResponse),
}
}
/// The first request that must be sent on a newly-opened stream. The client must
/// wait for the response before sending subsequent requests on the stream.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InitialPartitionAssignmentRequest {
/// The subscription name. Structured like:
/// projects/<project number>/locations/<zone name>/subscriptions/<subscription
/// id>
#[prost(string, tag = "1")]
pub subscription: ::prost::alloc::string::String,
/// An opaque, unique client identifier. This field must be exactly 16 bytes
/// long and is interpreted as an unsigned 128 bit integer. Other size values
/// will be rejected and the stream will be failed with a non-retryable error.
///
/// This field is large enough to fit a uuid from standard uuid algorithms like
/// uuid1 or uuid4, which should be used to generate this number. The same
/// identifier should be reused following disconnections with retryable stream
/// errors.
#[prost(bytes = "bytes", tag = "2")]
pub client_id: ::prost::bytes::Bytes,
}
/// PartitionAssignments should not race with acknowledgements. There
/// should be exactly one unacknowledged PartitionAssignment at a time. If not,
/// the client must break the stream.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PartitionAssignment {
/// The list of partition numbers this subscriber is assigned to.
#[prost(int64, repeated, tag = "1")]
pub partitions: ::prost::alloc::vec::Vec<i64>,
}
/// Acknowledge receipt and handling of the previous assignment.
/// If not sent within a short period after receiving the assignment,
/// partitions may remain unassigned for a period of time until the
/// client is known to be inactive, after which time the server will break the
/// stream.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PartitionAssignmentAck {}
/// A request on the PartitionAssignment stream.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PartitionAssignmentRequest {
/// The type of request this is.
#[prost(oneof = "partition_assignment_request::Request", tags = "1, 2")]
pub request: ::core::option::Option<partition_assignment_request::Request>,
}
/// Nested message and enum types in `PartitionAssignmentRequest`.
pub mod partition_assignment_request {
/// The type of request this is.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
/// Initial request on the stream.
#[prost(message, tag = "1")]
Initial(super::InitialPartitionAssignmentRequest),
/// Acknowledgement of a partition assignment.
#[prost(message, tag = "2")]
Ack(super::PartitionAssignmentAck),
}
}
/// Generated client implementations.
pub mod subscriber_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// The service that a subscriber client application uses to receive messages
/// from subscriptions.
#[derive(Debug, Clone)]
pub struct SubscriberServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> SubscriberServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SubscriberServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
SubscriberServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Establishes a stream with the server for receiving messages.
pub async fn subscribe(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::SubscribeRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::SubscribeResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.SubscriberService/Subscribe",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.SubscriberService",
"Subscribe",
),
);
self.inner.streaming(req, path, codec).await
}
}
}
/// Generated client implementations.
pub mod partition_assignment_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// The service that a subscriber client application uses to determine which
/// partitions it should connect to.
#[derive(Debug, Clone)]
pub struct PartitionAssignmentServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> PartitionAssignmentServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> PartitionAssignmentServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
PartitionAssignmentServiceClient::new(
InterceptedService::new(inner, interceptor),
)
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Assign partitions for this client to handle for the specified subscription.
///
/// The client must send an InitialPartitionAssignmentRequest first.
/// The server will then send at most one unacknowledged PartitionAssignment
/// outstanding on the stream at a time.
/// The client should send a PartitionAssignmentAck after updating the
/// partitions it is connected to to reflect the new assignment.
pub async fn assign_partitions(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::PartitionAssignmentRequest,
>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::PartitionAssignment>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.pubsublite.v1.PartitionAssignmentService/AssignPartitions",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.pubsublite.v1.PartitionAssignmentService",
"AssignPartitions",
),
);
self.inner.streaming(req, path, codec).await
}
}
}