tigerbeetle 0.0.34 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/ext/tb_client/extconf.rb +13 -13
- data/ext/tb_client/tigerbeetle/LICENSE +177 -0
- data/ext/tb_client/tigerbeetle/build.zig +2327 -0
- data/ext/tb_client/tigerbeetle/src/aof.zig +1000 -0
- data/ext/tb_client/tigerbeetle/src/build_multiversion.zig +808 -0
- data/ext/tb_client/tigerbeetle/src/cdc/amqp/protocol.zig +1283 -0
- data/ext/tb_client/tigerbeetle/src/cdc/amqp/spec.zig +1704 -0
- data/ext/tb_client/tigerbeetle/src/cdc/amqp/types.zig +341 -0
- data/ext/tb_client/tigerbeetle/src/cdc/amqp.zig +1450 -0
- data/ext/tb_client/tigerbeetle/src/cdc/runner.zig +1659 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/samples/main.c +406 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client/context.zig +1084 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client/echo_client.zig +286 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client/packet.zig +158 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client/signal.zig +229 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client/signal_fuzz.zig +110 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client.h +386 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client.zig +34 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client_exports.zig +281 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client_header.zig +312 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/tb_client_header_test.zig +138 -0
- data/ext/tb_client/tigerbeetle/src/clients/c/test.zig +466 -0
- data/ext/tb_client/tigerbeetle/src/clients/docs_samples.zig +157 -0
- data/ext/tb_client/tigerbeetle/src/clients/docs_types.zig +90 -0
- data/ext/tb_client/tigerbeetle/src/clients/dotnet/ci.zig +203 -0
- data/ext/tb_client/tigerbeetle/src/clients/dotnet/docs.zig +79 -0
- data/ext/tb_client/tigerbeetle/src/clients/dotnet/dotnet_bindings.zig +542 -0
- data/ext/tb_client/tigerbeetle/src/clients/go/ci.zig +109 -0
- data/ext/tb_client/tigerbeetle/src/clients/go/docs.zig +86 -0
- data/ext/tb_client/tigerbeetle/src/clients/go/go_bindings.zig +370 -0
- data/ext/tb_client/tigerbeetle/src/clients/go/pkg/native/tb_client.h +386 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/ci.zig +167 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/docs.zig +126 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/java_bindings.zig +996 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/src/client.zig +748 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/src/jni.zig +3238 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/src/jni_tests.zig +1718 -0
- data/ext/tb_client/tigerbeetle/src/clients/java/src/jni_thread_cleaner.zig +190 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/ci.zig +104 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/docs.zig +75 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/node.zig +522 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/node_bindings.zig +267 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/src/c.zig +3 -0
- data/ext/tb_client/tigerbeetle/src/clients/node/src/translate.zig +379 -0
- data/ext/tb_client/tigerbeetle/src/clients/python/ci.zig +131 -0
- data/ext/tb_client/tigerbeetle/src/clients/python/docs.zig +63 -0
- data/ext/tb_client/tigerbeetle/src/clients/python/python_bindings.zig +588 -0
- data/ext/tb_client/tigerbeetle/src/clients/rust/assets/tb_client.h +386 -0
- data/ext/tb_client/tigerbeetle/src/clients/rust/ci.zig +73 -0
- data/ext/tb_client/tigerbeetle/src/clients/rust/docs.zig +106 -0
- data/ext/tb_client/tigerbeetle/src/clients/rust/rust_bindings.zig +305 -0
- data/ext/tb_client/tigerbeetle/src/config.zig +296 -0
- data/ext/tb_client/tigerbeetle/src/constants.zig +790 -0
- data/ext/tb_client/tigerbeetle/src/copyhound.zig +202 -0
- data/ext/tb_client/tigerbeetle/src/counting_allocator.zig +72 -0
- data/ext/tb_client/tigerbeetle/src/direction.zig +11 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/build.zig +158 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/content.zig +156 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/docs.zig +252 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/file_checker.zig +313 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/html.zig +87 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/page_writer.zig +63 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/redirects.zig +47 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/search_index_writer.zig +28 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/service_worker_writer.zig +61 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/single_page_writer.zig +169 -0
- data/ext/tb_client/tigerbeetle/src/docs_website/src/website.zig +46 -0
- data/ext/tb_client/tigerbeetle/src/ewah.zig +445 -0
- data/ext/tb_client/tigerbeetle/src/ewah_benchmark.zig +128 -0
- data/ext/tb_client/tigerbeetle/src/ewah_fuzz.zig +171 -0
- data/ext/tb_client/tigerbeetle/src/fuzz_tests.zig +179 -0
- data/ext/tb_client/tigerbeetle/src/integration_tests.zig +662 -0
- data/ext/tb_client/tigerbeetle/src/io/common.zig +155 -0
- data/ext/tb_client/tigerbeetle/src/io/darwin.zig +1093 -0
- data/ext/tb_client/tigerbeetle/src/io/linux.zig +1880 -0
- data/ext/tb_client/tigerbeetle/src/io/test.zig +1005 -0
- data/ext/tb_client/tigerbeetle/src/io/windows.zig +1598 -0
- data/ext/tb_client/tigerbeetle/src/io.zig +34 -0
- data/ext/tb_client/tigerbeetle/src/iops.zig +134 -0
- data/ext/tb_client/tigerbeetle/src/list.zig +236 -0
- data/ext/tb_client/tigerbeetle/src/lsm/binary_search.zig +848 -0
- data/ext/tb_client/tigerbeetle/src/lsm/binary_search_benchmark.zig +179 -0
- data/ext/tb_client/tigerbeetle/src/lsm/cache_map.zig +424 -0
- data/ext/tb_client/tigerbeetle/src/lsm/cache_map_fuzz.zig +420 -0
- data/ext/tb_client/tigerbeetle/src/lsm/compaction.zig +2117 -0
- data/ext/tb_client/tigerbeetle/src/lsm/composite_key.zig +182 -0
- data/ext/tb_client/tigerbeetle/src/lsm/forest.zig +1119 -0
- data/ext/tb_client/tigerbeetle/src/lsm/forest_fuzz.zig +1102 -0
- data/ext/tb_client/tigerbeetle/src/lsm/forest_table_iterator.zig +200 -0
- data/ext/tb_client/tigerbeetle/src/lsm/groove.zig +1495 -0
- data/ext/tb_client/tigerbeetle/src/lsm/k_way_merge.zig +739 -0
- data/ext/tb_client/tigerbeetle/src/lsm/k_way_merge_benchmark.zig +166 -0
- data/ext/tb_client/tigerbeetle/src/lsm/manifest.zig +754 -0
- data/ext/tb_client/tigerbeetle/src/lsm/manifest_level.zig +1294 -0
- data/ext/tb_client/tigerbeetle/src/lsm/manifest_level_fuzz.zig +510 -0
- data/ext/tb_client/tigerbeetle/src/lsm/manifest_log.zig +1263 -0
- data/ext/tb_client/tigerbeetle/src/lsm/manifest_log_fuzz.zig +628 -0
- data/ext/tb_client/tigerbeetle/src/lsm/node_pool.zig +247 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_buffer.zig +116 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_builder.zig +543 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_fuzz.zig +938 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_lookup.zig +293 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_merge.zig +362 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_range.zig +99 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_state.zig +17 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scan_tree.zig +1036 -0
- data/ext/tb_client/tigerbeetle/src/lsm/schema.zig +617 -0
- data/ext/tb_client/tigerbeetle/src/lsm/scratch_memory.zig +84 -0
- data/ext/tb_client/tigerbeetle/src/lsm/segmented_array.zig +1500 -0
- data/ext/tb_client/tigerbeetle/src/lsm/segmented_array_benchmark.zig +149 -0
- data/ext/tb_client/tigerbeetle/src/lsm/segmented_array_fuzz.zig +7 -0
- data/ext/tb_client/tigerbeetle/src/lsm/set_associative_cache.zig +865 -0
- data/ext/tb_client/tigerbeetle/src/lsm/table.zig +607 -0
- data/ext/tb_client/tigerbeetle/src/lsm/table_memory.zig +843 -0
- data/ext/tb_client/tigerbeetle/src/lsm/table_value_iterator.zig +105 -0
- data/ext/tb_client/tigerbeetle/src/lsm/timestamp_range.zig +40 -0
- data/ext/tb_client/tigerbeetle/src/lsm/tree.zig +630 -0
- data/ext/tb_client/tigerbeetle/src/lsm/tree_fuzz.zig +933 -0
- data/ext/tb_client/tigerbeetle/src/lsm/zig_zag_merge.zig +557 -0
- data/ext/tb_client/tigerbeetle/src/message_buffer.zig +469 -0
- data/ext/tb_client/tigerbeetle/src/message_bus.zig +1214 -0
- data/ext/tb_client/tigerbeetle/src/message_bus_fuzz.zig +936 -0
- data/ext/tb_client/tigerbeetle/src/message_pool.zig +343 -0
- data/ext/tb_client/tigerbeetle/src/multiversion.zig +2195 -0
- data/ext/tb_client/tigerbeetle/src/queue.zig +390 -0
- data/ext/tb_client/tigerbeetle/src/repl/completion.zig +201 -0
- data/ext/tb_client/tigerbeetle/src/repl/parser.zig +1356 -0
- data/ext/tb_client/tigerbeetle/src/repl/terminal.zig +496 -0
- data/ext/tb_client/tigerbeetle/src/repl.zig +1034 -0
- data/ext/tb_client/tigerbeetle/src/scripts/amqp.zig +973 -0
- data/ext/tb_client/tigerbeetle/src/scripts/cfo.zig +1866 -0
- data/ext/tb_client/tigerbeetle/src/scripts/changelog.zig +304 -0
- data/ext/tb_client/tigerbeetle/src/scripts/ci.zig +227 -0
- data/ext/tb_client/tigerbeetle/src/scripts/client_readmes.zig +658 -0
- data/ext/tb_client/tigerbeetle/src/scripts/devhub.zig +466 -0
- data/ext/tb_client/tigerbeetle/src/scripts/release.zig +1058 -0
- data/ext/tb_client/tigerbeetle/src/scripts.zig +105 -0
- data/ext/tb_client/tigerbeetle/src/shell.zig +1195 -0
- data/ext/tb_client/tigerbeetle/src/stack.zig +260 -0
- data/ext/tb_client/tigerbeetle/src/state_machine/auditor.zig +911 -0
- data/ext/tb_client/tigerbeetle/src/state_machine/workload.zig +2079 -0
- data/ext/tb_client/tigerbeetle/src/state_machine.zig +4872 -0
- data/ext/tb_client/tigerbeetle/src/state_machine_fuzz.zig +288 -0
- data/ext/tb_client/tigerbeetle/src/state_machine_tests.zig +3128 -0
- data/ext/tb_client/tigerbeetle/src/static_allocator.zig +82 -0
- data/ext/tb_client/tigerbeetle/src/stdx/bit_set.zig +157 -0
- data/ext/tb_client/tigerbeetle/src/stdx/bounded_array.zig +292 -0
- data/ext/tb_client/tigerbeetle/src/stdx/debug.zig +65 -0
- data/ext/tb_client/tigerbeetle/src/stdx/flags.zig +1414 -0
- data/ext/tb_client/tigerbeetle/src/stdx/mlock.zig +92 -0
- data/ext/tb_client/tigerbeetle/src/stdx/prng.zig +677 -0
- data/ext/tb_client/tigerbeetle/src/stdx/radix.zig +336 -0
- data/ext/tb_client/tigerbeetle/src/stdx/ring_buffer.zig +511 -0
- data/ext/tb_client/tigerbeetle/src/stdx/sort_test.zig +112 -0
- data/ext/tb_client/tigerbeetle/src/stdx/stdx.zig +1160 -0
- data/ext/tb_client/tigerbeetle/src/stdx/testing/low_level_hash_vectors.zig +142 -0
- data/ext/tb_client/tigerbeetle/src/stdx/testing/snaptest.zig +361 -0
- data/ext/tb_client/tigerbeetle/src/stdx/time_units.zig +275 -0
- data/ext/tb_client/tigerbeetle/src/stdx/unshare.zig +295 -0
- data/ext/tb_client/tigerbeetle/src/stdx/vendored/aegis.zig +436 -0
- data/ext/tb_client/tigerbeetle/src/stdx/windows.zig +48 -0
- data/ext/tb_client/tigerbeetle/src/stdx/zipfian.zig +402 -0
- data/ext/tb_client/tigerbeetle/src/storage.zig +489 -0
- data/ext/tb_client/tigerbeetle/src/storage_fuzz.zig +180 -0
- data/ext/tb_client/tigerbeetle/src/testing/bench.zig +146 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/grid_checker.zig +53 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/journal_checker.zig +61 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/manifest_checker.zig +76 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/message_bus.zig +110 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/network.zig +412 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/state_checker.zig +331 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster/storage_checker.zig +458 -0
- data/ext/tb_client/tigerbeetle/src/testing/cluster.zig +1198 -0
- data/ext/tb_client/tigerbeetle/src/testing/exhaustigen.zig +128 -0
- data/ext/tb_client/tigerbeetle/src/testing/fixtures.zig +181 -0
- data/ext/tb_client/tigerbeetle/src/testing/fuzz.zig +144 -0
- data/ext/tb_client/tigerbeetle/src/testing/id.zig +97 -0
- data/ext/tb_client/tigerbeetle/src/testing/io.zig +317 -0
- data/ext/tb_client/tigerbeetle/src/testing/marks.zig +126 -0
- data/ext/tb_client/tigerbeetle/src/testing/packet_simulator.zig +533 -0
- data/ext/tb_client/tigerbeetle/src/testing/reply_sequence.zig +154 -0
- data/ext/tb_client/tigerbeetle/src/testing/state_machine.zig +389 -0
- data/ext/tb_client/tigerbeetle/src/testing/storage.zig +1247 -0
- data/ext/tb_client/tigerbeetle/src/testing/table.zig +249 -0
- data/ext/tb_client/tigerbeetle/src/testing/time.zig +98 -0
- data/ext/tb_client/tigerbeetle/src/testing/tmp_tigerbeetle.zig +212 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/constants.zig +26 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/faulty_network.zig +580 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/java_driver/ci.zig +39 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/logged_process.zig +214 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/rust_driver/ci.zig +34 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/supervisor.zig +766 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/workload.zig +543 -0
- data/ext/tb_client/tigerbeetle/src/testing/vortex/zig_driver.zig +181 -0
- data/ext/tb_client/tigerbeetle/src/tidy.zig +1448 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/benchmark_driver.zig +227 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/benchmark_load.zig +1069 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/cli.zig +1422 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/inspect.zig +1658 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/inspect_integrity.zig +518 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/libtb_client.zig +36 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle/main.zig +646 -0
- data/ext/tb_client/tigerbeetle/src/tigerbeetle.zig +958 -0
- data/ext/tb_client/tigerbeetle/src/time.zig +236 -0
- data/ext/tb_client/tigerbeetle/src/trace/event.zig +745 -0
- data/ext/tb_client/tigerbeetle/src/trace/statsd.zig +462 -0
- data/ext/tb_client/tigerbeetle/src/trace.zig +556 -0
- data/ext/tb_client/tigerbeetle/src/unit_tests.zig +321 -0
- data/ext/tb_client/tigerbeetle/src/vopr.zig +1785 -0
- data/ext/tb_client/tigerbeetle/src/vortex.zig +101 -0
- data/ext/tb_client/tigerbeetle/src/vsr/checkpoint_trailer.zig +473 -0
- data/ext/tb_client/tigerbeetle/src/vsr/checksum.zig +208 -0
- data/ext/tb_client/tigerbeetle/src/vsr/checksum_benchmark.zig +43 -0
- data/ext/tb_client/tigerbeetle/src/vsr/client.zig +768 -0
- data/ext/tb_client/tigerbeetle/src/vsr/client_replies.zig +532 -0
- data/ext/tb_client/tigerbeetle/src/vsr/client_sessions.zig +338 -0
- data/ext/tb_client/tigerbeetle/src/vsr/clock.zig +1019 -0
- data/ext/tb_client/tigerbeetle/src/vsr/fault_detector.zig +279 -0
- data/ext/tb_client/tigerbeetle/src/vsr/free_set.zig +1381 -0
- data/ext/tb_client/tigerbeetle/src/vsr/free_set_fuzz.zig +315 -0
- data/ext/tb_client/tigerbeetle/src/vsr/grid.zig +1460 -0
- data/ext/tb_client/tigerbeetle/src/vsr/grid_blocks_missing.zig +757 -0
- data/ext/tb_client/tigerbeetle/src/vsr/grid_scrubber.zig +797 -0
- data/ext/tb_client/tigerbeetle/src/vsr/journal.zig +2586 -0
- data/ext/tb_client/tigerbeetle/src/vsr/marzullo.zig +308 -0
- data/ext/tb_client/tigerbeetle/src/vsr/message_header.zig +1777 -0
- data/ext/tb_client/tigerbeetle/src/vsr/multi_batch.zig +715 -0
- data/ext/tb_client/tigerbeetle/src/vsr/multi_batch_fuzz.zig +185 -0
- data/ext/tb_client/tigerbeetle/src/vsr/repair_budget.zig +333 -0
- data/ext/tb_client/tigerbeetle/src/vsr/replica.zig +12355 -0
- data/ext/tb_client/tigerbeetle/src/vsr/replica_format.zig +416 -0
- data/ext/tb_client/tigerbeetle/src/vsr/replica_reformat.zig +165 -0
- data/ext/tb_client/tigerbeetle/src/vsr/replica_test.zig +2910 -0
- data/ext/tb_client/tigerbeetle/src/vsr/routing.zig +1075 -0
- data/ext/tb_client/tigerbeetle/src/vsr/superblock.zig +1603 -0
- data/ext/tb_client/tigerbeetle/src/vsr/superblock_fuzz.zig +484 -0
- data/ext/tb_client/tigerbeetle/src/vsr/superblock_quorums.zig +405 -0
- data/ext/tb_client/tigerbeetle/src/vsr/superblock_quorums_fuzz.zig +355 -0
- data/ext/tb_client/tigerbeetle/src/vsr/sync.zig +29 -0
- data/ext/tb_client/tigerbeetle/src/vsr.zig +1727 -0
- data/lib/tb_client/shared_lib.rb +12 -5
- data/lib/tigerbeetle/client.rb +1 -1
- data/lib/tigerbeetle/platforms.rb +9 -0
- data/lib/tigerbeetle/version.rb +2 -2
- data/tigerbeetle.gemspec +22 -5
- metadata +242 -3
- data/ext/tb_client/pkg.tar.gz +0 -0
|
@@ -0,0 +1,1704 @@
|
|
|
1
|
+
//////////////////////////////////////////////////////////
|
|
2
|
+
// This file was auto-generated by spec_parser.py //
|
|
3
|
+
// Do not manually modify. //
|
|
4
|
+
//////////////////////////////////////////////////////////
|
|
5
|
+
|
|
6
|
+
const std = @import("std");
|
|
7
|
+
const stdx = @import("stdx");
|
|
8
|
+
const protocol = @import("protocol.zig");
|
|
9
|
+
const Decoder = protocol.Decoder;
|
|
10
|
+
const Encoder = protocol.Encoder;
|
|
11
|
+
const MethodHeader = protocol.MethodHeader;
|
|
12
|
+
const Channel = protocol.Channel;
|
|
13
|
+
|
|
14
|
+
pub const FRAME_METHOD = 1;
|
|
15
|
+
pub const FRAME_HEADER = 2;
|
|
16
|
+
pub const FRAME_BODY = 3;
|
|
17
|
+
pub const FRAME_HEARTBEAT = 8;
|
|
18
|
+
pub const FRAME_MIN_SIZE = 4096;
|
|
19
|
+
pub const FRAME_END = 206;
|
|
20
|
+
/// Indicates that the method completed successfully. This reply code is
|
|
21
|
+
/// reserved for future use - the current protocol design does not use positive
|
|
22
|
+
/// confirmation and reply codes are sent only in case of an error.
|
|
23
|
+
pub const REPLY_SUCCESS = 200;
|
|
24
|
+
/// The client attempted to transfer content larger than the server could accept
|
|
25
|
+
/// at the present time. The client may retry at a later time.
|
|
26
|
+
pub const SOFT_ERROR_CONTENT_TOO_LARGE = 311;
|
|
27
|
+
/// Returned when RabbitMQ sends back with 'basic.return' when a
|
|
28
|
+
/// 'mandatory' message cannot be delivered to any queue.
|
|
29
|
+
pub const SOFT_ERROR_NO_ROUTE = 312;
|
|
30
|
+
/// When the exchange cannot deliver to a consumer when the immediate flag is
|
|
31
|
+
/// set. As a result of pending data on the queue or the absence of any
|
|
32
|
+
/// consumers of the queue.
|
|
33
|
+
pub const SOFT_ERROR_NO_CONSUMERS = 313;
|
|
34
|
+
/// An operator intervened to close the connection for some reason. The client
|
|
35
|
+
/// may retry at some later date.
|
|
36
|
+
pub const HARD_ERROR_CONNECTION_FORCED = 320;
|
|
37
|
+
/// The client tried to work with an unknown virtual host.
|
|
38
|
+
pub const HARD_ERROR_INVALID_PATH = 402;
|
|
39
|
+
/// The client attempted to work with a server entity to which it has no
|
|
40
|
+
/// access due to security settings.
|
|
41
|
+
pub const SOFT_ERROR_ACCESS_REFUSED = 403;
|
|
42
|
+
/// The client attempted to work with a server entity that does not exist.
|
|
43
|
+
pub const SOFT_ERROR_NOT_FOUND = 404;
|
|
44
|
+
/// The client attempted to work with a server entity to which it has no
|
|
45
|
+
/// access because another client is working with it.
|
|
46
|
+
pub const SOFT_ERROR_RESOURCE_LOCKED = 405;
|
|
47
|
+
/// The client requested a method that was not allowed because some precondition
|
|
48
|
+
/// failed.
|
|
49
|
+
pub const SOFT_ERROR_PRECONDITION_FAILED = 406;
|
|
50
|
+
/// The sender sent a malformed frame that the recipient could not decode.
|
|
51
|
+
/// This strongly implies a programming error in the sending peer.
|
|
52
|
+
pub const HARD_ERROR_FRAME_ERROR = 501;
|
|
53
|
+
/// The sender sent a frame that contained illegal values for one or more
|
|
54
|
+
/// fields. This strongly implies a programming error in the sending peer.
|
|
55
|
+
pub const HARD_ERROR_SYNTAX_ERROR = 502;
|
|
56
|
+
/// The client sent an invalid sequence of frames, attempting to perform an
|
|
57
|
+
/// operation that was considered invalid by the server. This usually implies
|
|
58
|
+
/// a programming error in the client.
|
|
59
|
+
pub const HARD_ERROR_COMMAND_INVALID = 503;
|
|
60
|
+
/// The client attempted to work with a channel that had not been correctly
|
|
61
|
+
/// opened. This most likely indicates a fault in the client layer.
|
|
62
|
+
pub const HARD_ERROR_CHANNEL_ERROR = 504;
|
|
63
|
+
/// The peer sent a frame that was not expected, usually in the context of
|
|
64
|
+
/// a content header and body. This strongly indicates a fault in the peer's
|
|
65
|
+
/// content processing.
|
|
66
|
+
pub const HARD_ERROR_UNEXPECTED_FRAME = 505;
|
|
67
|
+
/// The server could not complete the method because it lacked sufficient
|
|
68
|
+
/// resources. This may be due to the client creating too many of some type
|
|
69
|
+
/// of entity.
|
|
70
|
+
pub const HARD_ERROR_RESOURCE_ERROR = 506;
|
|
71
|
+
/// The client tried to work with some entity in a manner that is prohibited
|
|
72
|
+
/// by the server, due to security settings or by some other criteria.
|
|
73
|
+
pub const HARD_ERROR_NOT_ALLOWED = 530;
|
|
74
|
+
/// The client tried to use functionality that is not implemented in the
|
|
75
|
+
/// server.
|
|
76
|
+
pub const HARD_ERROR_NOT_IMPLEMENTED = 540;
|
|
77
|
+
/// The server could not complete the method because of an internal error.
|
|
78
|
+
/// The server may require intervention by an operator in order to resume
|
|
79
|
+
/// normal operations.
|
|
80
|
+
pub const HARD_ERROR_INTERNAL_ERROR = 541;
|
|
81
|
+
|
|
82
|
+
/// Methods sent by the AMQP server that must be handled by the client side,
|
|
83
|
+
/// marked by the spec with `<chassis name="client" implement="MUST|MAY"/>`.
|
|
84
|
+
pub const ClientMethod = union(ClientMethod.Tag) {
|
|
85
|
+
pub const Tag = enum(u32) {
|
|
86
|
+
connection_start = @bitCast(MethodHeader{ .class = 10, .method = 10 }),
|
|
87
|
+
connection_secure = @bitCast(MethodHeader{ .class = 10, .method = 20 }),
|
|
88
|
+
connection_tune = @bitCast(MethodHeader{ .class = 10, .method = 30 }),
|
|
89
|
+
connection_open_ok = @bitCast(MethodHeader{ .class = 10, .method = 41 }),
|
|
90
|
+
connection_close = @bitCast(MethodHeader{ .class = 10, .method = 50 }),
|
|
91
|
+
connection_close_ok = @bitCast(MethodHeader{ .class = 10, .method = 51 }),
|
|
92
|
+
connection_blocked = @bitCast(MethodHeader{ .class = 10, .method = 60 }),
|
|
93
|
+
connection_unblocked = @bitCast(MethodHeader{ .class = 10, .method = 61 }),
|
|
94
|
+
connection_update_secret = @bitCast(MethodHeader{ .class = 10, .method = 70 }),
|
|
95
|
+
channel_open_ok = @bitCast(MethodHeader{ .class = 20, .method = 11 }),
|
|
96
|
+
channel_flow = @bitCast(MethodHeader{ .class = 20, .method = 20 }),
|
|
97
|
+
channel_flow_ok = @bitCast(MethodHeader{ .class = 20, .method = 21 }),
|
|
98
|
+
channel_close = @bitCast(MethodHeader{ .class = 20, .method = 40 }),
|
|
99
|
+
channel_close_ok = @bitCast(MethodHeader{ .class = 20, .method = 41 }),
|
|
100
|
+
exchange_declare_ok = @bitCast(MethodHeader{ .class = 40, .method = 11 }),
|
|
101
|
+
exchange_delete_ok = @bitCast(MethodHeader{ .class = 40, .method = 21 }),
|
|
102
|
+
exchange_bind_ok = @bitCast(MethodHeader{ .class = 40, .method = 31 }),
|
|
103
|
+
exchange_unbind_ok = @bitCast(MethodHeader{ .class = 40, .method = 51 }),
|
|
104
|
+
queue_declare_ok = @bitCast(MethodHeader{ .class = 50, .method = 11 }),
|
|
105
|
+
queue_bind_ok = @bitCast(MethodHeader{ .class = 50, .method = 21 }),
|
|
106
|
+
queue_unbind_ok = @bitCast(MethodHeader{ .class = 50, .method = 51 }),
|
|
107
|
+
queue_purge_ok = @bitCast(MethodHeader{ .class = 50, .method = 31 }),
|
|
108
|
+
queue_delete_ok = @bitCast(MethodHeader{ .class = 50, .method = 41 }),
|
|
109
|
+
basic_qos_ok = @bitCast(MethodHeader{ .class = 60, .method = 11 }),
|
|
110
|
+
basic_consume_ok = @bitCast(MethodHeader{ .class = 60, .method = 21 }),
|
|
111
|
+
basic_cancel = @bitCast(MethodHeader{ .class = 60, .method = 30 }),
|
|
112
|
+
basic_cancel_ok = @bitCast(MethodHeader{ .class = 60, .method = 31 }),
|
|
113
|
+
basic_return = @bitCast(MethodHeader{ .class = 60, .method = 50 }),
|
|
114
|
+
basic_deliver = @bitCast(MethodHeader{ .class = 60, .method = 60 }),
|
|
115
|
+
basic_get_ok = @bitCast(MethodHeader{ .class = 60, .method = 71 }),
|
|
116
|
+
basic_get_empty = @bitCast(MethodHeader{ .class = 60, .method = 72 }),
|
|
117
|
+
basic_ack = @bitCast(MethodHeader{ .class = 60, .method = 80 }),
|
|
118
|
+
basic_recover_ok = @bitCast(MethodHeader{ .class = 60, .method = 111 }),
|
|
119
|
+
basic_nack = @bitCast(MethodHeader{ .class = 60, .method = 120 }),
|
|
120
|
+
tx_select_ok = @bitCast(MethodHeader{ .class = 90, .method = 11 }),
|
|
121
|
+
tx_commit_ok = @bitCast(MethodHeader{ .class = 90, .method = 21 }),
|
|
122
|
+
tx_rollback_ok = @bitCast(MethodHeader{ .class = 90, .method = 31 }),
|
|
123
|
+
confirm_select_ok = @bitCast(MethodHeader{ .class = 85, .method = 11 }),
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/// Start connection negotiation.
|
|
127
|
+
/// This method starts the connection negotiation process by telling the client the
|
|
128
|
+
/// protocol version that the server proposes, along with a list of security mechanisms
|
|
129
|
+
/// which the client can use for authentication.
|
|
130
|
+
connection_start: struct {
|
|
131
|
+
/// Protocol major version.
|
|
132
|
+
/// The major version number can take any value from 0 to 99 as defined in the
|
|
133
|
+
/// AMQP specification.
|
|
134
|
+
version_major: u8,
|
|
135
|
+
/// Protocol minor version.
|
|
136
|
+
/// The minor version number can take any value from 0 to 99 as defined in the
|
|
137
|
+
/// AMQP specification.
|
|
138
|
+
version_minor: u8,
|
|
139
|
+
/// Server properties.
|
|
140
|
+
server_properties: Decoder.Table,
|
|
141
|
+
/// Available security mechanisms.
|
|
142
|
+
/// A list of the security mechanisms that the server supports, delimited by spaces.
|
|
143
|
+
mechanisms: []const u8,
|
|
144
|
+
/// Available message locales.
|
|
145
|
+
/// A list of the message locales that the server supports, delimited by spaces. The
|
|
146
|
+
/// locale defines the language in which the server will send reply texts.
|
|
147
|
+
locales: []const u8,
|
|
148
|
+
|
|
149
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
150
|
+
const version_major = try decoder.read_int(u8);
|
|
151
|
+
const version_minor = try decoder.read_int(u8);
|
|
152
|
+
const server_properties = try decoder.read_table();
|
|
153
|
+
const mechanisms = try decoder.read_long_string();
|
|
154
|
+
const locales = try decoder.read_long_string();
|
|
155
|
+
|
|
156
|
+
return .{
|
|
157
|
+
.version_major = version_major,
|
|
158
|
+
.version_minor = version_minor,
|
|
159
|
+
.server_properties = server_properties,
|
|
160
|
+
.mechanisms = mechanisms,
|
|
161
|
+
.locales = locales,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
/// Security mechanism challenge.
|
|
166
|
+
/// The SASL protocol works by exchanging challenges and responses until both peers have
|
|
167
|
+
/// received sufficient information to authenticate each other. This method challenges
|
|
168
|
+
/// the client to provide more information.
|
|
169
|
+
connection_secure: struct {
|
|
170
|
+
/// Security challenge data.
|
|
171
|
+
/// Challenge information, a block of opaque binary data passed to the security
|
|
172
|
+
/// mechanism.
|
|
173
|
+
challenge: []const u8,
|
|
174
|
+
|
|
175
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
176
|
+
const challenge = try decoder.read_long_string();
|
|
177
|
+
|
|
178
|
+
return .{
|
|
179
|
+
.challenge = challenge,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
/// Propose connection tuning parameters.
|
|
184
|
+
/// This method proposes a set of connection configuration values to the client. The
|
|
185
|
+
/// client can accept and/or adjust these.
|
|
186
|
+
connection_tune: struct {
|
|
187
|
+
/// Proposed maximum channels.
|
|
188
|
+
/// Specifies highest channel number that the server permits. Usable channel numbers
|
|
189
|
+
/// are in the range 1..channel-max. Zero indicates no specified limit.
|
|
190
|
+
channel_max: u16,
|
|
191
|
+
/// Proposed maximum frame size.
|
|
192
|
+
/// The largest frame size that the server proposes for the connection, including
|
|
193
|
+
/// frame header and end-byte. The client can negotiate a lower value. Zero means
|
|
194
|
+
/// that the server does not impose any specific limit but may reject very large
|
|
195
|
+
/// frames if it cannot allocate resources for them.
|
|
196
|
+
frame_max: u32,
|
|
197
|
+
/// Desired heartbeat delay.
|
|
198
|
+
/// The delay, in seconds, of the connection heartbeat that the server wants.
|
|
199
|
+
/// Zero means the server does not want a heartbeat.
|
|
200
|
+
heartbeat: u16,
|
|
201
|
+
|
|
202
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
203
|
+
const channel_max = try decoder.read_int(u16);
|
|
204
|
+
const frame_max = try decoder.read_int(u32);
|
|
205
|
+
const heartbeat = try decoder.read_int(u16);
|
|
206
|
+
|
|
207
|
+
return .{
|
|
208
|
+
.channel_max = channel_max,
|
|
209
|
+
.frame_max = frame_max,
|
|
210
|
+
.heartbeat = heartbeat,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
/// Signal that connection is ready.
|
|
215
|
+
/// This method signals to the client that the connection is ready for use.
|
|
216
|
+
connection_open_ok: struct {
|
|
217
|
+
reserved_1: []const u8,
|
|
218
|
+
|
|
219
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
220
|
+
const reserved_1 = try decoder.read_short_string();
|
|
221
|
+
|
|
222
|
+
return .{
|
|
223
|
+
.reserved_1 = reserved_1,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
/// Request a connection close.
|
|
228
|
+
/// This method indicates that the sender wants to close the connection. This may be
|
|
229
|
+
/// due to internal conditions (e.g. a forced shut-down) or due to an error handling
|
|
230
|
+
/// a specific method, i.e. an exception. When a close is due to an exception, the
|
|
231
|
+
/// sender provides the class and method id of the method which caused the exception.
|
|
232
|
+
connection_close: struct {
|
|
233
|
+
reply_code: u16,
|
|
234
|
+
reply_text: []const u8,
|
|
235
|
+
/// Failing method class.
|
|
236
|
+
/// When the close is provoked by a method exception, this is the class of the
|
|
237
|
+
/// method.
|
|
238
|
+
class_id: u16,
|
|
239
|
+
/// Failing method id.
|
|
240
|
+
/// When the close is provoked by a method exception, this is the ID of the method.
|
|
241
|
+
method_id: u16,
|
|
242
|
+
|
|
243
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
244
|
+
const reply_code = try decoder.read_int(u16);
|
|
245
|
+
const reply_text = try decoder.read_short_string();
|
|
246
|
+
const class_id = try decoder.read_int(u16);
|
|
247
|
+
const method_id = try decoder.read_int(u16);
|
|
248
|
+
|
|
249
|
+
return .{
|
|
250
|
+
.reply_code = reply_code,
|
|
251
|
+
.reply_text = reply_text,
|
|
252
|
+
.class_id = class_id,
|
|
253
|
+
.method_id = method_id,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
/// Confirm a connection close.
|
|
258
|
+
/// This method confirms a Connection.Close method and tells the recipient that it is
|
|
259
|
+
/// safe to release resources for the connection and close the socket.
|
|
260
|
+
connection_close_ok: struct {
|
|
261
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
262
|
+
_ = decoder;
|
|
263
|
+
return .{};
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
/// Indicate that connection is blocked.
|
|
267
|
+
/// This method indicates that a connection has been blocked
|
|
268
|
+
/// and does not accept new publishes.
|
|
269
|
+
connection_blocked: struct {
|
|
270
|
+
/// Block reason.
|
|
271
|
+
/// The reason the connection was blocked.
|
|
272
|
+
reason: []const u8,
|
|
273
|
+
|
|
274
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
275
|
+
const reason = try decoder.read_short_string();
|
|
276
|
+
|
|
277
|
+
return .{
|
|
278
|
+
.reason = reason,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
/// Indicate that connection is unblocked.
|
|
283
|
+
/// This method indicates that a connection has been unblocked
|
|
284
|
+
/// and now accepts publishes.
|
|
285
|
+
connection_unblocked: struct {
|
|
286
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
287
|
+
_ = decoder;
|
|
288
|
+
return .{};
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
/// Update secret.
|
|
292
|
+
/// This method updates the secret used to authenticate this connection. It is used
|
|
293
|
+
/// when secrets have an expiration date and need to be renewed, like OAuth 2 tokens.
|
|
294
|
+
connection_update_secret: struct {
|
|
295
|
+
/// New secret.
|
|
296
|
+
/// The new secret.
|
|
297
|
+
new_secret: []const u8,
|
|
298
|
+
/// Reason.
|
|
299
|
+
/// The reason for the secret update.
|
|
300
|
+
reason: []const u8,
|
|
301
|
+
|
|
302
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
303
|
+
const new_secret = try decoder.read_long_string();
|
|
304
|
+
const reason = try decoder.read_short_string();
|
|
305
|
+
|
|
306
|
+
return .{
|
|
307
|
+
.new_secret = new_secret,
|
|
308
|
+
.reason = reason,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
/// Signal that the channel is ready.
|
|
313
|
+
/// This method signals to the client that the channel is ready for use.
|
|
314
|
+
channel_open_ok: struct {
|
|
315
|
+
reserved_1: []const u8,
|
|
316
|
+
|
|
317
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
318
|
+
const reserved_1 = try decoder.read_long_string();
|
|
319
|
+
|
|
320
|
+
return .{
|
|
321
|
+
.reserved_1 = reserved_1,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
/// Enable/disable flow from peer.
|
|
326
|
+
/// This method asks the peer to pause or restart the flow of content data sent by
|
|
327
|
+
/// a consumer. This is a simple flow-control mechanism that a peer can use to avoid
|
|
328
|
+
/// overflowing its queues or otherwise finding itself receiving more messages than
|
|
329
|
+
/// it can process. Note that this method is not intended for window control. It does
|
|
330
|
+
/// not affect contents returned by Basic.Get-Ok methods.
|
|
331
|
+
channel_flow: struct {
|
|
332
|
+
/// Start/stop content frames.
|
|
333
|
+
/// If 1, the peer starts sending content frames. If 0, the peer stops sending
|
|
334
|
+
/// content frames.
|
|
335
|
+
active: bool,
|
|
336
|
+
|
|
337
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
338
|
+
const bitset_1: stdx.BitSetType(8) = .{ .bits = try decoder.read_int(u8) };
|
|
339
|
+
const active = bitset_1.is_set(0);
|
|
340
|
+
|
|
341
|
+
return .{
|
|
342
|
+
.active = active,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
/// Confirm a flow method.
|
|
347
|
+
/// Confirms to the peer that a flow command was received and processed.
|
|
348
|
+
channel_flow_ok: struct {
|
|
349
|
+
/// Current flow setting.
|
|
350
|
+
/// Confirms the setting of the processed flow method: 1 means the peer will start
|
|
351
|
+
/// sending or continue to send content frames; 0 means it will not.
|
|
352
|
+
active: bool,
|
|
353
|
+
|
|
354
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
355
|
+
const bitset_1: stdx.BitSetType(8) = .{ .bits = try decoder.read_int(u8) };
|
|
356
|
+
const active = bitset_1.is_set(0);
|
|
357
|
+
|
|
358
|
+
return .{
|
|
359
|
+
.active = active,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
/// Request a channel close.
|
|
364
|
+
/// This method indicates that the sender wants to close the channel. This may be due to
|
|
365
|
+
/// internal conditions (e.g. a forced shut-down) or due to an error handling a specific
|
|
366
|
+
/// method, i.e. an exception. When a close is due to an exception, the sender provides
|
|
367
|
+
/// the class and method id of the method which caused the exception.
|
|
368
|
+
channel_close: struct {
|
|
369
|
+
reply_code: u16,
|
|
370
|
+
reply_text: []const u8,
|
|
371
|
+
/// Failing method class.
|
|
372
|
+
/// When the close is provoked by a method exception, this is the class of the
|
|
373
|
+
/// method.
|
|
374
|
+
class_id: u16,
|
|
375
|
+
/// Failing method id.
|
|
376
|
+
/// When the close is provoked by a method exception, this is the ID of the method.
|
|
377
|
+
method_id: u16,
|
|
378
|
+
|
|
379
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
380
|
+
const reply_code = try decoder.read_int(u16);
|
|
381
|
+
const reply_text = try decoder.read_short_string();
|
|
382
|
+
const class_id = try decoder.read_int(u16);
|
|
383
|
+
const method_id = try decoder.read_int(u16);
|
|
384
|
+
|
|
385
|
+
return .{
|
|
386
|
+
.reply_code = reply_code,
|
|
387
|
+
.reply_text = reply_text,
|
|
388
|
+
.class_id = class_id,
|
|
389
|
+
.method_id = method_id,
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
/// Confirm a channel close.
|
|
394
|
+
/// This method confirms a Channel.Close method and tells the recipient that it is safe
|
|
395
|
+
/// to release resources for the channel.
|
|
396
|
+
channel_close_ok: struct {
|
|
397
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
398
|
+
_ = decoder;
|
|
399
|
+
return .{};
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
/// Confirm exchange declaration.
|
|
403
|
+
/// This method confirms a Declare method and confirms the name of the exchange,
|
|
404
|
+
/// essential for automatically-named exchanges.
|
|
405
|
+
exchange_declare_ok: struct {
|
|
406
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
407
|
+
_ = decoder;
|
|
408
|
+
return .{};
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
/// Confirm deletion of an exchange.
|
|
412
|
+
/// This method confirms the deletion of an exchange.
|
|
413
|
+
exchange_delete_ok: struct {
|
|
414
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
415
|
+
_ = decoder;
|
|
416
|
+
return .{};
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
/// Confirm bind successful.
|
|
420
|
+
/// This method confirms that the bind was successful.
|
|
421
|
+
exchange_bind_ok: struct {
|
|
422
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
423
|
+
_ = decoder;
|
|
424
|
+
return .{};
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
/// Confirm unbind successful.
|
|
428
|
+
/// This method confirms that the unbind was successful.
|
|
429
|
+
exchange_unbind_ok: struct {
|
|
430
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
431
|
+
_ = decoder;
|
|
432
|
+
return .{};
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
/// Confirms a queue definition.
|
|
436
|
+
/// This method confirms a Declare method and confirms the name of the queue, essential
|
|
437
|
+
/// for automatically-named queues.
|
|
438
|
+
queue_declare_ok: struct {
|
|
439
|
+
/// Reports the name of the queue. If the server generated a queue name, this field
|
|
440
|
+
/// contains that name.
|
|
441
|
+
queue: []const u8,
|
|
442
|
+
message_count: u32,
|
|
443
|
+
/// Number of consumers.
|
|
444
|
+
/// Reports the number of active consumers for the queue. Note that consumers can
|
|
445
|
+
/// suspend activity (Channel.Flow) in which case they do not appear in this count.
|
|
446
|
+
consumer_count: u32,
|
|
447
|
+
|
|
448
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
449
|
+
const queue = try decoder.read_short_string();
|
|
450
|
+
const message_count = try decoder.read_int(u32);
|
|
451
|
+
const consumer_count = try decoder.read_int(u32);
|
|
452
|
+
|
|
453
|
+
return .{
|
|
454
|
+
.queue = queue,
|
|
455
|
+
.message_count = message_count,
|
|
456
|
+
.consumer_count = consumer_count,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
/// Confirm bind successful.
|
|
461
|
+
/// This method confirms that the bind was successful.
|
|
462
|
+
queue_bind_ok: struct {
|
|
463
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
464
|
+
_ = decoder;
|
|
465
|
+
return .{};
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
/// Confirm unbind successful.
|
|
469
|
+
/// This method confirms that the unbind was successful.
|
|
470
|
+
queue_unbind_ok: struct {
|
|
471
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
472
|
+
_ = decoder;
|
|
473
|
+
return .{};
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
/// Confirms a queue purge.
|
|
477
|
+
/// This method confirms the purge of a queue.
|
|
478
|
+
queue_purge_ok: struct {
|
|
479
|
+
/// Reports the number of messages purged.
|
|
480
|
+
message_count: u32,
|
|
481
|
+
|
|
482
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
483
|
+
const message_count = try decoder.read_int(u32);
|
|
484
|
+
|
|
485
|
+
return .{
|
|
486
|
+
.message_count = message_count,
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
/// Confirm deletion of a queue.
|
|
491
|
+
/// This method confirms the deletion of a queue.
|
|
492
|
+
queue_delete_ok: struct {
|
|
493
|
+
/// Reports the number of messages deleted.
|
|
494
|
+
message_count: u32,
|
|
495
|
+
|
|
496
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
497
|
+
const message_count = try decoder.read_int(u32);
|
|
498
|
+
|
|
499
|
+
return .{
|
|
500
|
+
.message_count = message_count,
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
/// Confirm the requested qos.
|
|
505
|
+
/// This method tells the client that the requested QoS levels could be handled by the
|
|
506
|
+
/// server. The requested QoS applies to all active consumers until a new QoS is
|
|
507
|
+
/// defined.
|
|
508
|
+
basic_qos_ok: struct {
|
|
509
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
510
|
+
_ = decoder;
|
|
511
|
+
return .{};
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
/// Confirm a new consumer.
|
|
515
|
+
/// The server provides the client with a consumer tag, which is used by the client
|
|
516
|
+
/// for methods called on the consumer at a later stage.
|
|
517
|
+
basic_consume_ok: struct {
|
|
518
|
+
/// Holds the consumer tag specified by the client or provided by the server.
|
|
519
|
+
consumer_tag: []const u8,
|
|
520
|
+
|
|
521
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
522
|
+
const consumer_tag = try decoder.read_short_string();
|
|
523
|
+
|
|
524
|
+
return .{
|
|
525
|
+
.consumer_tag = consumer_tag,
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
/// End a queue consumer.
|
|
530
|
+
/// This method cancels a consumer. This does not affect already delivered
|
|
531
|
+
/// messages, but it does mean the server will not send any more messages for
|
|
532
|
+
/// that consumer. The client may receive an arbitrary number of messages in
|
|
533
|
+
/// between sending the cancel method and receiving the cancel-ok reply.
|
|
534
|
+
/// It may also be sent from the server to the client in the event
|
|
535
|
+
/// of the consumer being unexpectedly cancelled (i.e. cancelled
|
|
536
|
+
/// for any reason other than the server receiving the
|
|
537
|
+
/// corresponding basic.cancel from the client). This allows
|
|
538
|
+
/// clients to be notified of the loss of consumers due to events
|
|
539
|
+
/// such as queue deletion. Note that as it is not a MUST for
|
|
540
|
+
/// clients to accept this method from the server, it is advisable
|
|
541
|
+
/// for the broker to be able to identify those clients that are
|
|
542
|
+
/// capable of accepting the method, through some means of
|
|
543
|
+
/// capability negotiation.
|
|
544
|
+
basic_cancel: struct {
|
|
545
|
+
consumer_tag: []const u8,
|
|
546
|
+
no_wait: bool,
|
|
547
|
+
|
|
548
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
549
|
+
const consumer_tag = try decoder.read_short_string();
|
|
550
|
+
const bitset_1: stdx.BitSetType(8) = .{ .bits = try decoder.read_int(u8) };
|
|
551
|
+
const no_wait = bitset_1.is_set(0);
|
|
552
|
+
|
|
553
|
+
return .{
|
|
554
|
+
.consumer_tag = consumer_tag,
|
|
555
|
+
.no_wait = no_wait,
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
/// Confirm a cancelled consumer.
|
|
560
|
+
/// This method confirms that the cancellation was completed.
|
|
561
|
+
basic_cancel_ok: struct {
|
|
562
|
+
consumer_tag: []const u8,
|
|
563
|
+
|
|
564
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
565
|
+
const consumer_tag = try decoder.read_short_string();
|
|
566
|
+
|
|
567
|
+
return .{
|
|
568
|
+
.consumer_tag = consumer_tag,
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
/// Return a failed message.
|
|
573
|
+
/// This method returns an undeliverable message that was published with the "immediate"
|
|
574
|
+
/// flag set, or an unroutable message published with the "mandatory" flag set. The
|
|
575
|
+
/// reply code and text provide information about the reason that the message was
|
|
576
|
+
/// undeliverable.
|
|
577
|
+
basic_return: struct {
|
|
578
|
+
reply_code: u16,
|
|
579
|
+
reply_text: []const u8,
|
|
580
|
+
/// Specifies the name of the exchange that the message was originally published
|
|
581
|
+
/// to. May be empty, meaning the default exchange.
|
|
582
|
+
exchange: []const u8,
|
|
583
|
+
/// Message routing key.
|
|
584
|
+
/// Specifies the routing key name specified when the message was published.
|
|
585
|
+
routing_key: []const u8,
|
|
586
|
+
|
|
587
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
588
|
+
const reply_code = try decoder.read_int(u16);
|
|
589
|
+
const reply_text = try decoder.read_short_string();
|
|
590
|
+
const exchange = try decoder.read_short_string();
|
|
591
|
+
const routing_key = try decoder.read_short_string();
|
|
592
|
+
|
|
593
|
+
return .{
|
|
594
|
+
.reply_code = reply_code,
|
|
595
|
+
.reply_text = reply_text,
|
|
596
|
+
.exchange = exchange,
|
|
597
|
+
.routing_key = routing_key,
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
/// Notify the client of a consumer message.
|
|
602
|
+
/// This method delivers a message to the client, via a consumer. In the asynchronous
|
|
603
|
+
/// message delivery model, the client starts a consumer using the Consume method, then
|
|
604
|
+
/// the server responds with Deliver methods as and when messages arrive for that
|
|
605
|
+
/// consumer.
|
|
606
|
+
basic_deliver: struct {
|
|
607
|
+
consumer_tag: []const u8,
|
|
608
|
+
delivery_tag: u64,
|
|
609
|
+
redelivered: bool,
|
|
610
|
+
/// Specifies the name of the exchange that the message was originally published to.
|
|
611
|
+
/// May be empty, indicating the default exchange.
|
|
612
|
+
exchange: []const u8,
|
|
613
|
+
/// Message routing key.
|
|
614
|
+
/// Specifies the routing key name specified when the message was published.
|
|
615
|
+
routing_key: []const u8,
|
|
616
|
+
|
|
617
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
618
|
+
const consumer_tag = try decoder.read_short_string();
|
|
619
|
+
const delivery_tag = try decoder.read_int(u64);
|
|
620
|
+
const bitset_1: stdx.BitSetType(8) = .{ .bits = try decoder.read_int(u8) };
|
|
621
|
+
const redelivered = bitset_1.is_set(0);
|
|
622
|
+
const exchange = try decoder.read_short_string();
|
|
623
|
+
const routing_key = try decoder.read_short_string();
|
|
624
|
+
|
|
625
|
+
return .{
|
|
626
|
+
.consumer_tag = consumer_tag,
|
|
627
|
+
.delivery_tag = delivery_tag,
|
|
628
|
+
.redelivered = redelivered,
|
|
629
|
+
.exchange = exchange,
|
|
630
|
+
.routing_key = routing_key,
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
/// Provide client with a message.
|
|
635
|
+
/// This method delivers a message to the client following a get method. A message
|
|
636
|
+
/// delivered by 'get-ok' must be acknowledged unless the no-ack option was set in the
|
|
637
|
+
/// get method.
|
|
638
|
+
basic_get_ok: struct {
|
|
639
|
+
delivery_tag: u64,
|
|
640
|
+
redelivered: bool,
|
|
641
|
+
/// Specifies the name of the exchange that the message was originally published to.
|
|
642
|
+
/// If empty, the message was published to the default exchange.
|
|
643
|
+
exchange: []const u8,
|
|
644
|
+
/// Message routing key.
|
|
645
|
+
/// Specifies the routing key name specified when the message was published.
|
|
646
|
+
routing_key: []const u8,
|
|
647
|
+
message_count: u32,
|
|
648
|
+
|
|
649
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
650
|
+
const delivery_tag = try decoder.read_int(u64);
|
|
651
|
+
const bitset_1: stdx.BitSetType(8) = .{ .bits = try decoder.read_int(u8) };
|
|
652
|
+
const redelivered = bitset_1.is_set(0);
|
|
653
|
+
const exchange = try decoder.read_short_string();
|
|
654
|
+
const routing_key = try decoder.read_short_string();
|
|
655
|
+
const message_count = try decoder.read_int(u32);
|
|
656
|
+
|
|
657
|
+
return .{
|
|
658
|
+
.delivery_tag = delivery_tag,
|
|
659
|
+
.redelivered = redelivered,
|
|
660
|
+
.exchange = exchange,
|
|
661
|
+
.routing_key = routing_key,
|
|
662
|
+
.message_count = message_count,
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
/// Indicate no messages available.
|
|
667
|
+
/// This method tells the client that the queue has no messages available for the
|
|
668
|
+
/// client.
|
|
669
|
+
basic_get_empty: struct {
|
|
670
|
+
reserved_1: []const u8,
|
|
671
|
+
|
|
672
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
673
|
+
const reserved_1 = try decoder.read_short_string();
|
|
674
|
+
|
|
675
|
+
return .{
|
|
676
|
+
.reserved_1 = reserved_1,
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
/// Acknowledge one or more messages.
|
|
681
|
+
/// When sent by the client, this method acknowledges one or more
|
|
682
|
+
/// messages delivered via the Deliver or Get-Ok methods.
|
|
683
|
+
/// When sent by server, this method acknowledges one or more
|
|
684
|
+
/// messages published with the Publish method on a channel in
|
|
685
|
+
/// confirm mode.
|
|
686
|
+
/// The acknowledgement can be for a single message or a set of
|
|
687
|
+
/// messages up to and including a specific message.
|
|
688
|
+
basic_ack: struct {
|
|
689
|
+
delivery_tag: u64,
|
|
690
|
+
/// Acknowledge multiple messages.
|
|
691
|
+
/// If set to 1, the delivery tag is treated as "up to and
|
|
692
|
+
/// including", so that multiple messages can be acknowledged
|
|
693
|
+
/// with a single method. If set to zero, the delivery tag
|
|
694
|
+
/// refers to a single message. If the multiple field is 1, and
|
|
695
|
+
/// the delivery tag is zero, this indicates acknowledgement of
|
|
696
|
+
/// all outstanding messages.
|
|
697
|
+
multiple: bool,
|
|
698
|
+
|
|
699
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
700
|
+
const delivery_tag = try decoder.read_int(u64);
|
|
701
|
+
const bitset_1: stdx.BitSetType(8) = .{ .bits = try decoder.read_int(u8) };
|
|
702
|
+
const multiple = bitset_1.is_set(0);
|
|
703
|
+
|
|
704
|
+
return .{
|
|
705
|
+
.delivery_tag = delivery_tag,
|
|
706
|
+
.multiple = multiple,
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
/// Confirm recovery.
|
|
711
|
+
/// This method acknowledges a Basic.Recover method.
|
|
712
|
+
basic_recover_ok: struct {
|
|
713
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
714
|
+
_ = decoder;
|
|
715
|
+
return .{};
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
/// Reject one or more incoming messages.
|
|
719
|
+
/// This method allows a client to reject one or more incoming messages. It can be
|
|
720
|
+
/// used to interrupt and cancel large incoming messages, or return untreatable
|
|
721
|
+
/// messages to their original queue.
|
|
722
|
+
/// This method is also used by the server to inform publishers on channels in
|
|
723
|
+
/// confirm mode of unhandled messages. If a publisher receives this method, it
|
|
724
|
+
/// probably needs to republish the offending messages.
|
|
725
|
+
basic_nack: struct {
|
|
726
|
+
delivery_tag: u64,
|
|
727
|
+
/// Reject multiple messages.
|
|
728
|
+
/// If set to 1, the delivery tag is treated as "up to and
|
|
729
|
+
/// including", so that multiple messages can be rejected
|
|
730
|
+
/// with a single method. If set to zero, the delivery tag
|
|
731
|
+
/// refers to a single message. If the multiple field is 1, and
|
|
732
|
+
/// the delivery tag is zero, this indicates rejection of
|
|
733
|
+
/// all outstanding messages.
|
|
734
|
+
multiple: bool,
|
|
735
|
+
/// Requeue the message.
|
|
736
|
+
/// If requeue is true, the server will attempt to requeue the message. If requeue
|
|
737
|
+
/// is false or the requeue attempt fails the messages are discarded or dead-lettered.
|
|
738
|
+
/// Clients receiving the Nack methods should ignore this flag.
|
|
739
|
+
requeue: bool,
|
|
740
|
+
|
|
741
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
742
|
+
const delivery_tag = try decoder.read_int(u64);
|
|
743
|
+
const bitset_1: stdx.BitSetType(8) = .{ .bits = try decoder.read_int(u8) };
|
|
744
|
+
const multiple = bitset_1.is_set(0);
|
|
745
|
+
const requeue = bitset_1.is_set(1);
|
|
746
|
+
|
|
747
|
+
return .{
|
|
748
|
+
.delivery_tag = delivery_tag,
|
|
749
|
+
.multiple = multiple,
|
|
750
|
+
.requeue = requeue,
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
/// Confirm transaction mode.
|
|
755
|
+
/// This method confirms to the client that the channel was successfully set to use
|
|
756
|
+
/// standard transactions.
|
|
757
|
+
tx_select_ok: struct {
|
|
758
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
759
|
+
_ = decoder;
|
|
760
|
+
return .{};
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
/// Confirm a successful commit.
|
|
764
|
+
/// This method confirms to the client that the commit succeeded. Note that if a commit
|
|
765
|
+
/// fails, the server raises a channel exception.
|
|
766
|
+
tx_commit_ok: struct {
|
|
767
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
768
|
+
_ = decoder;
|
|
769
|
+
return .{};
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
/// Confirm successful rollback.
|
|
773
|
+
/// This method confirms to the client that the rollback succeeded. Note that if an
|
|
774
|
+
/// rollback fails, the server raises a channel exception.
|
|
775
|
+
tx_rollback_ok: struct {
|
|
776
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
777
|
+
_ = decoder;
|
|
778
|
+
return .{};
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
/// This method confirms to the client that the channel was successfully
|
|
782
|
+
/// set to use publisher acknowledgements.
|
|
783
|
+
confirm_select_ok: struct {
|
|
784
|
+
fn decode(decoder: *Decoder) Decoder.Error!@This() {
|
|
785
|
+
_ = decoder;
|
|
786
|
+
return .{};
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
|
|
790
|
+
pub fn method_header(self: ClientMethod) MethodHeader {
|
|
791
|
+
return @bitCast(@as(u32, @intFromEnum(self)));
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
pub fn decode(header: MethodHeader, decoder: *Decoder) Decoder.Error!ClientMethod {
|
|
795
|
+
@setEvalBranchQuota(10_000);
|
|
796
|
+
const tag: Tag = @enumFromInt(@as(u32, @bitCast(header)));
|
|
797
|
+
const value: ClientMethod = switch (tag) {
|
|
798
|
+
inline else => |tag_comptime| value: {
|
|
799
|
+
const Method = std.meta.TagPayload(ClientMethod, tag_comptime);
|
|
800
|
+
break :value @unionInit(
|
|
801
|
+
ClientMethod,
|
|
802
|
+
@tagName(tag_comptime),
|
|
803
|
+
try Method.decode(decoder),
|
|
804
|
+
);
|
|
805
|
+
},
|
|
806
|
+
};
|
|
807
|
+
try decoder.read_frame_end();
|
|
808
|
+
return value;
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
/// Methods sent by the client, marked by the spec
|
|
813
|
+
/// with `<chassis name="server" implement="MUST|MAY"/>`.
|
|
814
|
+
pub const ServerMethod = union(ServerMethod.Tag) {
|
|
815
|
+
pub const Tag = enum(u32) {
|
|
816
|
+
connection_start_ok = @bitCast(MethodHeader{ .class = 10, .method = 11 }),
|
|
817
|
+
connection_secure_ok = @bitCast(MethodHeader{ .class = 10, .method = 21 }),
|
|
818
|
+
connection_tune_ok = @bitCast(MethodHeader{ .class = 10, .method = 31 }),
|
|
819
|
+
connection_open = @bitCast(MethodHeader{ .class = 10, .method = 40 }),
|
|
820
|
+
connection_close = @bitCast(MethodHeader{ .class = 10, .method = 50 }),
|
|
821
|
+
connection_close_ok = @bitCast(MethodHeader{ .class = 10, .method = 51 }),
|
|
822
|
+
connection_blocked = @bitCast(MethodHeader{ .class = 10, .method = 60 }),
|
|
823
|
+
connection_unblocked = @bitCast(MethodHeader{ .class = 10, .method = 61 }),
|
|
824
|
+
connection_update_secret_ok = @bitCast(MethodHeader{ .class = 10, .method = 71 }),
|
|
825
|
+
channel_open = @bitCast(MethodHeader{ .class = 20, .method = 10 }),
|
|
826
|
+
channel_flow = @bitCast(MethodHeader{ .class = 20, .method = 20 }),
|
|
827
|
+
channel_flow_ok = @bitCast(MethodHeader{ .class = 20, .method = 21 }),
|
|
828
|
+
channel_close = @bitCast(MethodHeader{ .class = 20, .method = 40 }),
|
|
829
|
+
channel_close_ok = @bitCast(MethodHeader{ .class = 20, .method = 41 }),
|
|
830
|
+
exchange_declare = @bitCast(MethodHeader{ .class = 40, .method = 10 }),
|
|
831
|
+
exchange_delete = @bitCast(MethodHeader{ .class = 40, .method = 20 }),
|
|
832
|
+
exchange_bind = @bitCast(MethodHeader{ .class = 40, .method = 30 }),
|
|
833
|
+
exchange_unbind = @bitCast(MethodHeader{ .class = 40, .method = 40 }),
|
|
834
|
+
queue_declare = @bitCast(MethodHeader{ .class = 50, .method = 10 }),
|
|
835
|
+
queue_bind = @bitCast(MethodHeader{ .class = 50, .method = 20 }),
|
|
836
|
+
queue_unbind = @bitCast(MethodHeader{ .class = 50, .method = 50 }),
|
|
837
|
+
queue_purge = @bitCast(MethodHeader{ .class = 50, .method = 30 }),
|
|
838
|
+
queue_delete = @bitCast(MethodHeader{ .class = 50, .method = 40 }),
|
|
839
|
+
basic_qos = @bitCast(MethodHeader{ .class = 60, .method = 10 }),
|
|
840
|
+
basic_consume = @bitCast(MethodHeader{ .class = 60, .method = 20 }),
|
|
841
|
+
basic_cancel = @bitCast(MethodHeader{ .class = 60, .method = 30 }),
|
|
842
|
+
basic_cancel_ok = @bitCast(MethodHeader{ .class = 60, .method = 31 }),
|
|
843
|
+
basic_publish = @bitCast(MethodHeader{ .class = 60, .method = 40 }),
|
|
844
|
+
basic_get = @bitCast(MethodHeader{ .class = 60, .method = 70 }),
|
|
845
|
+
basic_ack = @bitCast(MethodHeader{ .class = 60, .method = 80 }),
|
|
846
|
+
basic_reject = @bitCast(MethodHeader{ .class = 60, .method = 90 }),
|
|
847
|
+
basic_recover_async = @bitCast(MethodHeader{ .class = 60, .method = 100 }),
|
|
848
|
+
basic_recover = @bitCast(MethodHeader{ .class = 60, .method = 110 }),
|
|
849
|
+
basic_nack = @bitCast(MethodHeader{ .class = 60, .method = 120 }),
|
|
850
|
+
tx_select = @bitCast(MethodHeader{ .class = 90, .method = 10 }),
|
|
851
|
+
tx_commit = @bitCast(MethodHeader{ .class = 90, .method = 20 }),
|
|
852
|
+
tx_rollback = @bitCast(MethodHeader{ .class = 90, .method = 30 }),
|
|
853
|
+
confirm_select = @bitCast(MethodHeader{ .class = 85, .method = 10 }),
|
|
854
|
+
};
|
|
855
|
+
|
|
856
|
+
/// Select security mechanism and locale.
|
|
857
|
+
/// This method selects a SASL security mechanism.
|
|
858
|
+
connection_start_ok: struct {
|
|
859
|
+
/// Client properties.
|
|
860
|
+
client_properties: ?Encoder.Table,
|
|
861
|
+
/// Selected security mechanism.
|
|
862
|
+
/// A single security mechanisms selected by the client, which must be one of those
|
|
863
|
+
/// specified by the server.
|
|
864
|
+
mechanism: []const u8,
|
|
865
|
+
/// Security response data.
|
|
866
|
+
/// A block of opaque data passed to the security mechanism. The contents of this
|
|
867
|
+
/// data are defined by the SASL security mechanism.
|
|
868
|
+
response: ?Encoder.Body,
|
|
869
|
+
/// Selected message locale.
|
|
870
|
+
/// A single message locale selected by the client, which must be one of those
|
|
871
|
+
/// specified by the server.
|
|
872
|
+
locale: []const u8,
|
|
873
|
+
|
|
874
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
875
|
+
encoder.write_table(self.client_properties);
|
|
876
|
+
encoder.write_short_string(self.mechanism);
|
|
877
|
+
encoder.write_long_string_body(self.response);
|
|
878
|
+
encoder.write_short_string(self.locale);
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
/// Security mechanism response.
|
|
882
|
+
/// This method attempts to authenticate, passing a block of SASL data for the security
|
|
883
|
+
/// mechanism at the server side.
|
|
884
|
+
connection_secure_ok: struct {
|
|
885
|
+
/// Security response data.
|
|
886
|
+
/// A block of opaque data passed to the security mechanism. The contents of this
|
|
887
|
+
/// data are defined by the SASL security mechanism.
|
|
888
|
+
response: ?Encoder.Body,
|
|
889
|
+
|
|
890
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
891
|
+
encoder.write_long_string_body(self.response);
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
/// Negotiate connection tuning parameters.
|
|
895
|
+
/// This method sends the client's connection tuning parameters to the server.
|
|
896
|
+
/// Certain fields are negotiated, others provide capability information.
|
|
897
|
+
connection_tune_ok: struct {
|
|
898
|
+
/// Negotiated maximum channels.
|
|
899
|
+
/// The maximum total number of channels that the client will use per connection.
|
|
900
|
+
channel_max: u16,
|
|
901
|
+
/// Negotiated maximum frame size.
|
|
902
|
+
/// The largest frame size that the client and server will use for the connection.
|
|
903
|
+
/// Zero means that the client does not impose any specific limit but may reject
|
|
904
|
+
/// very large frames if it cannot allocate resources for them. Note that the
|
|
905
|
+
/// frame-max limit applies principally to content frames, where large contents can
|
|
906
|
+
/// be broken into frames of arbitrary size.
|
|
907
|
+
frame_max: u32,
|
|
908
|
+
/// Desired heartbeat delay.
|
|
909
|
+
/// The delay, in seconds, of the connection heartbeat that the client wants. Zero
|
|
910
|
+
/// means the client does not want a heartbeat.
|
|
911
|
+
heartbeat: u16,
|
|
912
|
+
|
|
913
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
914
|
+
encoder.write_int(u16, self.channel_max);
|
|
915
|
+
encoder.write_int(u32, self.frame_max);
|
|
916
|
+
encoder.write_int(u16, self.heartbeat);
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
/// Open connection to virtual host.
|
|
920
|
+
/// This method opens a connection to a virtual host, which is a collection of
|
|
921
|
+
/// resources, and acts to separate multiple application domains within a server.
|
|
922
|
+
/// The server may apply arbitrary limits per virtual host, such as the number
|
|
923
|
+
/// of each type of entity that may be used, per connection and/or in total.
|
|
924
|
+
connection_open: struct {
|
|
925
|
+
/// Virtual host name.
|
|
926
|
+
/// The name of the virtual host to work with.
|
|
927
|
+
virtual_host: []const u8,
|
|
928
|
+
reserved_1: []const u8 = "",
|
|
929
|
+
reserved_2: bool = false,
|
|
930
|
+
|
|
931
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
932
|
+
encoder.write_short_string(self.virtual_host);
|
|
933
|
+
encoder.write_short_string(self.reserved_1);
|
|
934
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
935
|
+
bitset_1.set_value(0, self.reserved_2);
|
|
936
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
/// Request a connection close.
|
|
940
|
+
/// This method indicates that the sender wants to close the connection. This may be
|
|
941
|
+
/// due to internal conditions (e.g. a forced shut-down) or due to an error handling
|
|
942
|
+
/// a specific method, i.e. an exception. When a close is due to an exception, the
|
|
943
|
+
/// sender provides the class and method id of the method which caused the exception.
|
|
944
|
+
connection_close: struct {
|
|
945
|
+
reply_code: u16,
|
|
946
|
+
reply_text: []const u8,
|
|
947
|
+
/// Failing method class.
|
|
948
|
+
/// When the close is provoked by a method exception, this is the class of the
|
|
949
|
+
/// method.
|
|
950
|
+
class_id: u16,
|
|
951
|
+
/// Failing method id.
|
|
952
|
+
/// When the close is provoked by a method exception, this is the ID of the method.
|
|
953
|
+
method_id: u16,
|
|
954
|
+
|
|
955
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
956
|
+
encoder.write_int(u16, self.reply_code);
|
|
957
|
+
encoder.write_short_string(self.reply_text);
|
|
958
|
+
encoder.write_int(u16, self.class_id);
|
|
959
|
+
encoder.write_int(u16, self.method_id);
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
/// Confirm a connection close.
|
|
963
|
+
/// This method confirms a Connection.Close method and tells the recipient that it is
|
|
964
|
+
/// safe to release resources for the connection and close the socket.
|
|
965
|
+
connection_close_ok: struct {
|
|
966
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
967
|
+
_ = self;
|
|
968
|
+
_ = encoder;
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
/// Indicate that connection is blocked.
|
|
972
|
+
/// This method indicates that a connection has been blocked
|
|
973
|
+
/// and does not accept new publishes.
|
|
974
|
+
connection_blocked: struct {
|
|
975
|
+
/// Block reason.
|
|
976
|
+
/// The reason the connection was blocked.
|
|
977
|
+
reason: []const u8,
|
|
978
|
+
|
|
979
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
980
|
+
encoder.write_short_string(self.reason);
|
|
981
|
+
}
|
|
982
|
+
},
|
|
983
|
+
/// Indicate that connection is unblocked.
|
|
984
|
+
/// This method indicates that a connection has been unblocked
|
|
985
|
+
/// and now accepts publishes.
|
|
986
|
+
connection_unblocked: struct {
|
|
987
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
988
|
+
_ = self;
|
|
989
|
+
_ = encoder;
|
|
990
|
+
}
|
|
991
|
+
},
|
|
992
|
+
/// Update secret response.
|
|
993
|
+
/// This method confirms the updated secret is valid.
|
|
994
|
+
connection_update_secret_ok: struct {
|
|
995
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
996
|
+
_ = self;
|
|
997
|
+
_ = encoder;
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
/// Open a channel for use.
|
|
1001
|
+
/// This method opens a channel to the server.
|
|
1002
|
+
channel_open: struct {
|
|
1003
|
+
reserved_1: []const u8 = "",
|
|
1004
|
+
|
|
1005
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1006
|
+
encoder.write_short_string(self.reserved_1);
|
|
1007
|
+
}
|
|
1008
|
+
},
|
|
1009
|
+
/// Enable/disable flow from peer.
|
|
1010
|
+
/// This method asks the peer to pause or restart the flow of content data sent by
|
|
1011
|
+
/// a consumer. This is a simple flow-control mechanism that a peer can use to avoid
|
|
1012
|
+
/// overflowing its queues or otherwise finding itself receiving more messages than
|
|
1013
|
+
/// it can process. Note that this method is not intended for window control. It does
|
|
1014
|
+
/// not affect contents returned by Basic.Get-Ok methods.
|
|
1015
|
+
channel_flow: struct {
|
|
1016
|
+
/// Start/stop content frames.
|
|
1017
|
+
/// If 1, the peer starts sending content frames. If 0, the peer stops sending
|
|
1018
|
+
/// content frames.
|
|
1019
|
+
active: bool,
|
|
1020
|
+
|
|
1021
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1022
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1023
|
+
bitset_1.set_value(0, self.active);
|
|
1024
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
/// Confirm a flow method.
|
|
1028
|
+
/// Confirms to the peer that a flow command was received and processed.
|
|
1029
|
+
channel_flow_ok: struct {
|
|
1030
|
+
/// Current flow setting.
|
|
1031
|
+
/// Confirms the setting of the processed flow method: 1 means the peer will start
|
|
1032
|
+
/// sending or continue to send content frames; 0 means it will not.
|
|
1033
|
+
active: bool,
|
|
1034
|
+
|
|
1035
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1036
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1037
|
+
bitset_1.set_value(0, self.active);
|
|
1038
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
/// Request a channel close.
|
|
1042
|
+
/// This method indicates that the sender wants to close the channel. This may be due to
|
|
1043
|
+
/// internal conditions (e.g. a forced shut-down) or due to an error handling a specific
|
|
1044
|
+
/// method, i.e. an exception. When a close is due to an exception, the sender provides
|
|
1045
|
+
/// the class and method id of the method which caused the exception.
|
|
1046
|
+
channel_close: struct {
|
|
1047
|
+
reply_code: u16,
|
|
1048
|
+
reply_text: []const u8,
|
|
1049
|
+
/// Failing method class.
|
|
1050
|
+
/// When the close is provoked by a method exception, this is the class of the
|
|
1051
|
+
/// method.
|
|
1052
|
+
class_id: u16,
|
|
1053
|
+
/// Failing method id.
|
|
1054
|
+
/// When the close is provoked by a method exception, this is the ID of the method.
|
|
1055
|
+
method_id: u16,
|
|
1056
|
+
|
|
1057
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1058
|
+
encoder.write_int(u16, self.reply_code);
|
|
1059
|
+
encoder.write_short_string(self.reply_text);
|
|
1060
|
+
encoder.write_int(u16, self.class_id);
|
|
1061
|
+
encoder.write_int(u16, self.method_id);
|
|
1062
|
+
}
|
|
1063
|
+
},
|
|
1064
|
+
/// Confirm a channel close.
|
|
1065
|
+
/// This method confirms a Channel.Close method and tells the recipient that it is safe
|
|
1066
|
+
/// to release resources for the channel.
|
|
1067
|
+
channel_close_ok: struct {
|
|
1068
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1069
|
+
_ = self;
|
|
1070
|
+
_ = encoder;
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
/// Verify exchange exists, create if needed.
|
|
1074
|
+
/// This method creates an exchange if it does not already exist, and if the exchange
|
|
1075
|
+
/// exists, verifies that it is of the correct and expected class.
|
|
1076
|
+
exchange_declare: struct {
|
|
1077
|
+
reserved_1: u16 = 0,
|
|
1078
|
+
exchange: []const u8,
|
|
1079
|
+
/// Exchange type.
|
|
1080
|
+
/// Each exchange belongs to one of a set of exchange types implemented by the
|
|
1081
|
+
/// server. The exchange types define the functionality of the exchange - i.e. how
|
|
1082
|
+
/// messages are routed through it. It is not valid or meaningful to attempt to
|
|
1083
|
+
/// change the type of an existing exchange.
|
|
1084
|
+
type: []const u8,
|
|
1085
|
+
/// Do not create exchange.
|
|
1086
|
+
/// If set, the server will reply with Declare-Ok if the exchange already
|
|
1087
|
+
/// exists with the same name, and raise an error if not. The client can
|
|
1088
|
+
/// use this to check whether an exchange exists without modifying the
|
|
1089
|
+
/// server state. When set, all other method fields except name and no-wait
|
|
1090
|
+
/// are ignored. A declare with both passive and no-wait has no effect.
|
|
1091
|
+
/// Arguments are compared for semantic equivalence.
|
|
1092
|
+
passive: bool,
|
|
1093
|
+
/// Request a durable exchange.
|
|
1094
|
+
/// If set when creating a new exchange, the exchange will be marked as durable.
|
|
1095
|
+
/// Durable exchanges remain active when a server restarts. Non-durable exchanges
|
|
1096
|
+
/// (transient exchanges) are purged if/when a server restarts.
|
|
1097
|
+
durable: bool,
|
|
1098
|
+
/// Auto-delete when unused.
|
|
1099
|
+
/// If set, the exchange is deleted when all queues have
|
|
1100
|
+
/// finished using it.
|
|
1101
|
+
auto_delete: bool,
|
|
1102
|
+
/// Create internal exchange.
|
|
1103
|
+
/// If set, the exchange may not be used directly by publishers,
|
|
1104
|
+
/// but only when bound to other exchanges. Internal exchanges
|
|
1105
|
+
/// are used to construct wiring that is not visible to
|
|
1106
|
+
/// applications.
|
|
1107
|
+
internal: bool,
|
|
1108
|
+
no_wait: bool,
|
|
1109
|
+
/// Arguments for declaration.
|
|
1110
|
+
/// A set of arguments for the declaration. The syntax and semantics of these
|
|
1111
|
+
/// arguments depends on the server implementation.
|
|
1112
|
+
arguments: ?Encoder.Table,
|
|
1113
|
+
|
|
1114
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1115
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1116
|
+
encoder.write_short_string(self.exchange);
|
|
1117
|
+
encoder.write_short_string(self.type);
|
|
1118
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1119
|
+
bitset_1.set_value(0, self.passive);
|
|
1120
|
+
bitset_1.set_value(1, self.durable);
|
|
1121
|
+
bitset_1.set_value(2, self.auto_delete);
|
|
1122
|
+
bitset_1.set_value(3, self.internal);
|
|
1123
|
+
bitset_1.set_value(4, self.no_wait);
|
|
1124
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1125
|
+
encoder.write_table(self.arguments);
|
|
1126
|
+
}
|
|
1127
|
+
},
|
|
1128
|
+
/// Delete an exchange.
|
|
1129
|
+
/// This method deletes an exchange. When an exchange is deleted all queue bindings on
|
|
1130
|
+
/// the exchange are cancelled.
|
|
1131
|
+
exchange_delete: struct {
|
|
1132
|
+
reserved_1: u16 = 0,
|
|
1133
|
+
exchange: []const u8,
|
|
1134
|
+
/// Delete only if unused.
|
|
1135
|
+
/// If set, the server will only delete the exchange if it has no queue bindings. If
|
|
1136
|
+
/// the exchange has queue bindings the server does not delete it but raises a
|
|
1137
|
+
/// channel exception instead.
|
|
1138
|
+
if_unused: bool,
|
|
1139
|
+
no_wait: bool,
|
|
1140
|
+
|
|
1141
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1142
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1143
|
+
encoder.write_short_string(self.exchange);
|
|
1144
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1145
|
+
bitset_1.set_value(0, self.if_unused);
|
|
1146
|
+
bitset_1.set_value(1, self.no_wait);
|
|
1147
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
/// Bind exchange to an exchange.
|
|
1151
|
+
/// This method binds an exchange to an exchange.
|
|
1152
|
+
exchange_bind: struct {
|
|
1153
|
+
reserved_1: u16 = 0,
|
|
1154
|
+
/// Name of the destination exchange to bind to.
|
|
1155
|
+
/// Specifies the name of the destination exchange to bind.
|
|
1156
|
+
destination: []const u8,
|
|
1157
|
+
/// Name of the source exchange to bind to.
|
|
1158
|
+
/// Specifies the name of the source exchange to bind.
|
|
1159
|
+
source: []const u8,
|
|
1160
|
+
/// Message routing key.
|
|
1161
|
+
/// Specifies the routing key for the binding. The routing key
|
|
1162
|
+
/// is used for routing messages depending on the exchange
|
|
1163
|
+
/// configuration. Not all exchanges use a routing key - refer
|
|
1164
|
+
/// to the specific exchange documentation.
|
|
1165
|
+
routing_key: []const u8,
|
|
1166
|
+
no_wait: bool,
|
|
1167
|
+
/// Arguments for binding.
|
|
1168
|
+
/// A set of arguments for the binding. The syntax and semantics
|
|
1169
|
+
/// of these arguments depends on the exchange class.
|
|
1170
|
+
arguments: ?Encoder.Table,
|
|
1171
|
+
|
|
1172
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1173
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1174
|
+
encoder.write_short_string(self.destination);
|
|
1175
|
+
encoder.write_short_string(self.source);
|
|
1176
|
+
encoder.write_short_string(self.routing_key);
|
|
1177
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1178
|
+
bitset_1.set_value(0, self.no_wait);
|
|
1179
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1180
|
+
encoder.write_table(self.arguments);
|
|
1181
|
+
}
|
|
1182
|
+
},
|
|
1183
|
+
/// Unbind an exchange from an exchange.
|
|
1184
|
+
/// This method unbinds an exchange from an exchange.
|
|
1185
|
+
exchange_unbind: struct {
|
|
1186
|
+
reserved_1: u16 = 0,
|
|
1187
|
+
/// Specifies the name of the destination exchange to unbind.
|
|
1188
|
+
destination: []const u8,
|
|
1189
|
+
/// Specifies the name of the source exchange to unbind.
|
|
1190
|
+
source: []const u8,
|
|
1191
|
+
/// Routing key of binding.
|
|
1192
|
+
/// Specifies the routing key of the binding to unbind.
|
|
1193
|
+
routing_key: []const u8,
|
|
1194
|
+
no_wait: bool,
|
|
1195
|
+
/// Arguments of binding.
|
|
1196
|
+
/// Specifies the arguments of the binding to unbind.
|
|
1197
|
+
arguments: ?Encoder.Table,
|
|
1198
|
+
|
|
1199
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1200
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1201
|
+
encoder.write_short_string(self.destination);
|
|
1202
|
+
encoder.write_short_string(self.source);
|
|
1203
|
+
encoder.write_short_string(self.routing_key);
|
|
1204
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1205
|
+
bitset_1.set_value(0, self.no_wait);
|
|
1206
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1207
|
+
encoder.write_table(self.arguments);
|
|
1208
|
+
}
|
|
1209
|
+
},
|
|
1210
|
+
/// Declare queue, create if needed.
|
|
1211
|
+
/// This method creates or checks a queue. When creating a new queue the client can
|
|
1212
|
+
/// specify various properties that control the durability of the queue and its
|
|
1213
|
+
/// contents, and the level of sharing for the queue.
|
|
1214
|
+
queue_declare: struct {
|
|
1215
|
+
reserved_1: u16 = 0,
|
|
1216
|
+
queue: []const u8,
|
|
1217
|
+
/// Do not create queue.
|
|
1218
|
+
/// If set, the server will reply with Declare-Ok if the queue already
|
|
1219
|
+
/// exists with the same name, and raise an error if not. The client can
|
|
1220
|
+
/// use this to check whether a queue exists without modifying the
|
|
1221
|
+
/// server state. When set, all other method fields except name and no-wait
|
|
1222
|
+
/// are ignored. A declare with both passive and no-wait has no effect.
|
|
1223
|
+
/// Arguments are compared for semantic equivalence.
|
|
1224
|
+
passive: bool,
|
|
1225
|
+
/// Request a durable queue.
|
|
1226
|
+
/// If set when creating a new queue, the queue will be marked as durable. Durable
|
|
1227
|
+
/// queues remain active when a server restarts. Non-durable queues (transient
|
|
1228
|
+
/// queues) are purged if/when a server restarts. Note that durable queues do not
|
|
1229
|
+
/// necessarily hold persistent messages, although it does not make sense to send
|
|
1230
|
+
/// persistent messages to a transient queue.
|
|
1231
|
+
durable: bool,
|
|
1232
|
+
/// Request an exclusive queue.
|
|
1233
|
+
/// Exclusive queues may only be accessed by the current connection, and are
|
|
1234
|
+
/// deleted when that connection closes. Passive declaration of an exclusive
|
|
1235
|
+
/// queue by other connections are not allowed.
|
|
1236
|
+
exclusive: bool,
|
|
1237
|
+
/// Auto-delete queue when unused.
|
|
1238
|
+
/// If set, the queue is deleted when all consumers have finished using it. The last
|
|
1239
|
+
/// consumer can be cancelled either explicitly or because its channel is closed. If
|
|
1240
|
+
/// there was no consumer ever on the queue, it won't be deleted. Applications can
|
|
1241
|
+
/// explicitly delete auto-delete queues using the Delete method as normal.
|
|
1242
|
+
auto_delete: bool,
|
|
1243
|
+
no_wait: bool,
|
|
1244
|
+
/// Arguments for declaration.
|
|
1245
|
+
/// A set of arguments for the declaration. The syntax and semantics of these
|
|
1246
|
+
/// arguments depends on the server implementation.
|
|
1247
|
+
arguments: ?Encoder.Table,
|
|
1248
|
+
|
|
1249
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1250
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1251
|
+
encoder.write_short_string(self.queue);
|
|
1252
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1253
|
+
bitset_1.set_value(0, self.passive);
|
|
1254
|
+
bitset_1.set_value(1, self.durable);
|
|
1255
|
+
bitset_1.set_value(2, self.exclusive);
|
|
1256
|
+
bitset_1.set_value(3, self.auto_delete);
|
|
1257
|
+
bitset_1.set_value(4, self.no_wait);
|
|
1258
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1259
|
+
encoder.write_table(self.arguments);
|
|
1260
|
+
}
|
|
1261
|
+
},
|
|
1262
|
+
/// Bind queue to an exchange.
|
|
1263
|
+
/// This method binds a queue to an exchange. Until a queue is bound it will not
|
|
1264
|
+
/// receive any messages. In a classic messaging model, store-and-forward queues
|
|
1265
|
+
/// are bound to a direct exchange and subscription queues are bound to a topic
|
|
1266
|
+
/// exchange.
|
|
1267
|
+
queue_bind: struct {
|
|
1268
|
+
reserved_1: u16 = 0,
|
|
1269
|
+
/// Specifies the name of the queue to bind.
|
|
1270
|
+
queue: []const u8,
|
|
1271
|
+
/// Name of the exchange to bind to.
|
|
1272
|
+
exchange: []const u8,
|
|
1273
|
+
/// Message routing key.
|
|
1274
|
+
/// Specifies the routing key for the binding. The routing key is used for routing
|
|
1275
|
+
/// messages depending on the exchange configuration. Not all exchanges use a
|
|
1276
|
+
/// routing key - refer to the specific exchange documentation. If the queue name
|
|
1277
|
+
/// is empty, the server uses the last queue declared on the channel. If the
|
|
1278
|
+
/// routing key is also empty, the server uses this queue name for the routing
|
|
1279
|
+
/// key as well. If the queue name is provided but the routing key is empty, the
|
|
1280
|
+
/// server does the binding with that empty routing key. The meaning of empty
|
|
1281
|
+
/// routing keys depends on the exchange implementation.
|
|
1282
|
+
routing_key: []const u8,
|
|
1283
|
+
no_wait: bool,
|
|
1284
|
+
/// Arguments for binding.
|
|
1285
|
+
/// A set of arguments for the binding. The syntax and semantics of these arguments
|
|
1286
|
+
/// depends on the exchange class.
|
|
1287
|
+
arguments: ?Encoder.Table,
|
|
1288
|
+
|
|
1289
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1290
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1291
|
+
encoder.write_short_string(self.queue);
|
|
1292
|
+
encoder.write_short_string(self.exchange);
|
|
1293
|
+
encoder.write_short_string(self.routing_key);
|
|
1294
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1295
|
+
bitset_1.set_value(0, self.no_wait);
|
|
1296
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1297
|
+
encoder.write_table(self.arguments);
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
/// Unbind a queue from an exchange.
|
|
1301
|
+
/// This method unbinds a queue from an exchange.
|
|
1302
|
+
queue_unbind: struct {
|
|
1303
|
+
reserved_1: u16 = 0,
|
|
1304
|
+
/// Specifies the name of the queue to unbind.
|
|
1305
|
+
queue: []const u8,
|
|
1306
|
+
/// The name of the exchange to unbind from.
|
|
1307
|
+
exchange: []const u8,
|
|
1308
|
+
/// Routing key of binding.
|
|
1309
|
+
/// Specifies the routing key of the binding to unbind.
|
|
1310
|
+
routing_key: []const u8,
|
|
1311
|
+
/// Arguments of binding.
|
|
1312
|
+
/// Specifies the arguments of the binding to unbind.
|
|
1313
|
+
arguments: ?Encoder.Table,
|
|
1314
|
+
|
|
1315
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1316
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1317
|
+
encoder.write_short_string(self.queue);
|
|
1318
|
+
encoder.write_short_string(self.exchange);
|
|
1319
|
+
encoder.write_short_string(self.routing_key);
|
|
1320
|
+
encoder.write_table(self.arguments);
|
|
1321
|
+
}
|
|
1322
|
+
},
|
|
1323
|
+
/// Purge a queue.
|
|
1324
|
+
/// This method removes all messages from a queue which are not awaiting
|
|
1325
|
+
/// acknowledgment.
|
|
1326
|
+
queue_purge: struct {
|
|
1327
|
+
reserved_1: u16 = 0,
|
|
1328
|
+
/// Specifies the name of the queue to purge.
|
|
1329
|
+
queue: []const u8,
|
|
1330
|
+
no_wait: bool,
|
|
1331
|
+
|
|
1332
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1333
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1334
|
+
encoder.write_short_string(self.queue);
|
|
1335
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1336
|
+
bitset_1.set_value(0, self.no_wait);
|
|
1337
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1338
|
+
}
|
|
1339
|
+
},
|
|
1340
|
+
/// Delete a queue.
|
|
1341
|
+
/// This method deletes a queue. When a queue is deleted any pending messages are sent
|
|
1342
|
+
/// to a dead-letter queue if this is defined in the server configuration, and all
|
|
1343
|
+
/// consumers on the queue are cancelled.
|
|
1344
|
+
queue_delete: struct {
|
|
1345
|
+
reserved_1: u16 = 0,
|
|
1346
|
+
/// Specifies the name of the queue to delete.
|
|
1347
|
+
queue: []const u8,
|
|
1348
|
+
/// Delete only if unused.
|
|
1349
|
+
/// If set, the server will only delete the queue if it has no consumers. If the
|
|
1350
|
+
/// queue has consumers the server does does not delete it but raises a channel
|
|
1351
|
+
/// exception instead.
|
|
1352
|
+
if_unused: bool,
|
|
1353
|
+
/// Delete only if empty.
|
|
1354
|
+
/// If set, the server will only delete the queue if it has no messages.
|
|
1355
|
+
if_empty: bool,
|
|
1356
|
+
no_wait: bool,
|
|
1357
|
+
|
|
1358
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1359
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1360
|
+
encoder.write_short_string(self.queue);
|
|
1361
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1362
|
+
bitset_1.set_value(0, self.if_unused);
|
|
1363
|
+
bitset_1.set_value(1, self.if_empty);
|
|
1364
|
+
bitset_1.set_value(2, self.no_wait);
|
|
1365
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1366
|
+
}
|
|
1367
|
+
},
|
|
1368
|
+
/// Specify quality of service.
|
|
1369
|
+
/// This method requests a specific quality of service. The QoS can be specified for the
|
|
1370
|
+
/// current channel or for all channels on the connection. The particular properties and
|
|
1371
|
+
/// semantics of a qos method always depend on the content class semantics. Though the
|
|
1372
|
+
/// qos method could in principle apply to both peers, it is currently meaningful only
|
|
1373
|
+
/// for the server.
|
|
1374
|
+
basic_qos: struct {
|
|
1375
|
+
/// Prefetch window in octets.
|
|
1376
|
+
/// The client can request that messages be sent in advance so that when the client
|
|
1377
|
+
/// finishes processing a message, the following message is already held locally,
|
|
1378
|
+
/// rather than needing to be sent down the channel. Prefetching gives a performance
|
|
1379
|
+
/// improvement. This field specifies the prefetch window size in octets. The server
|
|
1380
|
+
/// will send a message in advance if it is equal to or smaller in size than the
|
|
1381
|
+
/// available prefetch size (and also falls into other prefetch limits). May be set
|
|
1382
|
+
/// to zero, meaning "no specific limit", although other prefetch limits may still
|
|
1383
|
+
/// apply. The prefetch-size is ignored if the no-ack option is set.
|
|
1384
|
+
prefetch_size: u32,
|
|
1385
|
+
/// Prefetch window in messages.
|
|
1386
|
+
/// Specifies a prefetch window in terms of whole messages. This field may be used
|
|
1387
|
+
/// in combination with the prefetch-size field; a message will only be sent in
|
|
1388
|
+
/// advance if both prefetch windows (and those at the channel and connection level)
|
|
1389
|
+
/// allow it. The prefetch-count is ignored if the no-ack option is set.
|
|
1390
|
+
prefetch_count: u16,
|
|
1391
|
+
/// Apply to entire connection.
|
|
1392
|
+
/// RabbitMQ has reinterpreted this field. The original
|
|
1393
|
+
/// specification said: "By default the QoS settings apply to
|
|
1394
|
+
/// the current channel only. If this field is set, they are
|
|
1395
|
+
/// applied to the entire connection." Instead, RabbitMQ takes
|
|
1396
|
+
/// global=false to mean that the QoS settings should apply
|
|
1397
|
+
/// per-consumer (for new consumers on the channel; existing
|
|
1398
|
+
/// ones being unaffected) and global=true to mean that the QoS
|
|
1399
|
+
/// settings should apply per-channel.
|
|
1400
|
+
global: bool,
|
|
1401
|
+
|
|
1402
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1403
|
+
encoder.write_int(u32, self.prefetch_size);
|
|
1404
|
+
encoder.write_int(u16, self.prefetch_count);
|
|
1405
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1406
|
+
bitset_1.set_value(0, self.global);
|
|
1407
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1408
|
+
}
|
|
1409
|
+
},
|
|
1410
|
+
/// Start a queue consumer.
|
|
1411
|
+
/// This method asks the server to start a "consumer", which is a transient request for
|
|
1412
|
+
/// messages from a specific queue. Consumers last as long as the channel they were
|
|
1413
|
+
/// declared on, or until the client cancels them.
|
|
1414
|
+
basic_consume: struct {
|
|
1415
|
+
reserved_1: u16 = 0,
|
|
1416
|
+
/// Specifies the name of the queue to consume from.
|
|
1417
|
+
queue: []const u8,
|
|
1418
|
+
/// Specifies the identifier for the consumer. The consumer tag is local to a
|
|
1419
|
+
/// channel, so two clients can use the same consumer tags. If this field is
|
|
1420
|
+
/// empty the server will generate a unique tag.
|
|
1421
|
+
consumer_tag: []const u8,
|
|
1422
|
+
no_local: bool,
|
|
1423
|
+
no_ack: bool,
|
|
1424
|
+
/// Request exclusive access.
|
|
1425
|
+
/// Request exclusive consumer access, meaning only this consumer can access the
|
|
1426
|
+
/// queue.
|
|
1427
|
+
exclusive: bool,
|
|
1428
|
+
no_wait: bool,
|
|
1429
|
+
/// Arguments for declaration.
|
|
1430
|
+
/// A set of arguments for the consume. The syntax and semantics of these
|
|
1431
|
+
/// arguments depends on the server implementation.
|
|
1432
|
+
arguments: ?Encoder.Table,
|
|
1433
|
+
|
|
1434
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1435
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1436
|
+
encoder.write_short_string(self.queue);
|
|
1437
|
+
encoder.write_short_string(self.consumer_tag);
|
|
1438
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1439
|
+
bitset_1.set_value(0, self.no_local);
|
|
1440
|
+
bitset_1.set_value(1, self.no_ack);
|
|
1441
|
+
bitset_1.set_value(2, self.exclusive);
|
|
1442
|
+
bitset_1.set_value(3, self.no_wait);
|
|
1443
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1444
|
+
encoder.write_table(self.arguments);
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
/// End a queue consumer.
|
|
1448
|
+
/// This method cancels a consumer. This does not affect already delivered
|
|
1449
|
+
/// messages, but it does mean the server will not send any more messages for
|
|
1450
|
+
/// that consumer. The client may receive an arbitrary number of messages in
|
|
1451
|
+
/// between sending the cancel method and receiving the cancel-ok reply.
|
|
1452
|
+
/// It may also be sent from the server to the client in the event
|
|
1453
|
+
/// of the consumer being unexpectedly cancelled (i.e. cancelled
|
|
1454
|
+
/// for any reason other than the server receiving the
|
|
1455
|
+
/// corresponding basic.cancel from the client). This allows
|
|
1456
|
+
/// clients to be notified of the loss of consumers due to events
|
|
1457
|
+
/// such as queue deletion. Note that as it is not a MUST for
|
|
1458
|
+
/// clients to accept this method from the server, it is advisable
|
|
1459
|
+
/// for the broker to be able to identify those clients that are
|
|
1460
|
+
/// capable of accepting the method, through some means of
|
|
1461
|
+
/// capability negotiation.
|
|
1462
|
+
basic_cancel: struct {
|
|
1463
|
+
consumer_tag: []const u8,
|
|
1464
|
+
no_wait: bool,
|
|
1465
|
+
|
|
1466
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1467
|
+
encoder.write_short_string(self.consumer_tag);
|
|
1468
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1469
|
+
bitset_1.set_value(0, self.no_wait);
|
|
1470
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1471
|
+
}
|
|
1472
|
+
},
|
|
1473
|
+
/// Confirm a cancelled consumer.
|
|
1474
|
+
/// This method confirms that the cancellation was completed.
|
|
1475
|
+
basic_cancel_ok: struct {
|
|
1476
|
+
consumer_tag: []const u8,
|
|
1477
|
+
|
|
1478
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1479
|
+
encoder.write_short_string(self.consumer_tag);
|
|
1480
|
+
}
|
|
1481
|
+
},
|
|
1482
|
+
/// Publish a message.
|
|
1483
|
+
/// This method publishes a message to a specific exchange. The message will be routed
|
|
1484
|
+
/// to queues as defined by the exchange configuration and distributed to any active
|
|
1485
|
+
/// consumers when the transaction, if any, is committed.
|
|
1486
|
+
basic_publish: struct {
|
|
1487
|
+
reserved_1: u16 = 0,
|
|
1488
|
+
/// Specifies the name of the exchange to publish to. The exchange name can be
|
|
1489
|
+
/// empty, meaning the default exchange. If the exchange name is specified, and that
|
|
1490
|
+
/// exchange does not exist, the server will raise a channel exception.
|
|
1491
|
+
exchange: []const u8,
|
|
1492
|
+
/// Message routing key.
|
|
1493
|
+
/// Specifies the routing key for the message. The routing key is used for routing
|
|
1494
|
+
/// messages depending on the exchange configuration.
|
|
1495
|
+
routing_key: []const u8,
|
|
1496
|
+
/// Indicate mandatory routing.
|
|
1497
|
+
/// This flag tells the server how to react if the message cannot be routed to a
|
|
1498
|
+
/// queue. If this flag is set, the server will return an unroutable message with a
|
|
1499
|
+
/// Return method. If this flag is zero, the server silently drops the message.
|
|
1500
|
+
mandatory: bool,
|
|
1501
|
+
/// Request immediate delivery.
|
|
1502
|
+
/// This flag tells the server how to react if the message cannot be routed to a
|
|
1503
|
+
/// queue consumer immediately. If this flag is set, the server will return an
|
|
1504
|
+
/// undeliverable message with a Return method. If this flag is zero, the server
|
|
1505
|
+
/// will queue the message, but with no guarantee that it will ever be consumed.
|
|
1506
|
+
immediate: bool,
|
|
1507
|
+
|
|
1508
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1509
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1510
|
+
encoder.write_short_string(self.exchange);
|
|
1511
|
+
encoder.write_short_string(self.routing_key);
|
|
1512
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1513
|
+
bitset_1.set_value(0, self.mandatory);
|
|
1514
|
+
bitset_1.set_value(1, self.immediate);
|
|
1515
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1516
|
+
}
|
|
1517
|
+
},
|
|
1518
|
+
/// Direct access to a queue.
|
|
1519
|
+
/// This method provides a direct access to the messages in a queue using a synchronous
|
|
1520
|
+
/// dialogue that is designed for specific types of application where synchronous
|
|
1521
|
+
/// functionality is more important than performance.
|
|
1522
|
+
basic_get: struct {
|
|
1523
|
+
reserved_1: u16 = 0,
|
|
1524
|
+
/// Specifies the name of the queue to get a message from.
|
|
1525
|
+
queue: []const u8,
|
|
1526
|
+
no_ack: bool,
|
|
1527
|
+
|
|
1528
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1529
|
+
encoder.write_int(u16, self.reserved_1);
|
|
1530
|
+
encoder.write_short_string(self.queue);
|
|
1531
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1532
|
+
bitset_1.set_value(0, self.no_ack);
|
|
1533
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1534
|
+
}
|
|
1535
|
+
},
|
|
1536
|
+
/// Acknowledge one or more messages.
|
|
1537
|
+
/// When sent by the client, this method acknowledges one or more
|
|
1538
|
+
/// messages delivered via the Deliver or Get-Ok methods.
|
|
1539
|
+
/// When sent by server, this method acknowledges one or more
|
|
1540
|
+
/// messages published with the Publish method on a channel in
|
|
1541
|
+
/// confirm mode.
|
|
1542
|
+
/// The acknowledgement can be for a single message or a set of
|
|
1543
|
+
/// messages up to and including a specific message.
|
|
1544
|
+
basic_ack: struct {
|
|
1545
|
+
delivery_tag: u64,
|
|
1546
|
+
/// Acknowledge multiple messages.
|
|
1547
|
+
/// If set to 1, the delivery tag is treated as "up to and
|
|
1548
|
+
/// including", so that multiple messages can be acknowledged
|
|
1549
|
+
/// with a single method. If set to zero, the delivery tag
|
|
1550
|
+
/// refers to a single message. If the multiple field is 1, and
|
|
1551
|
+
/// the delivery tag is zero, this indicates acknowledgement of
|
|
1552
|
+
/// all outstanding messages.
|
|
1553
|
+
multiple: bool,
|
|
1554
|
+
|
|
1555
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1556
|
+
encoder.write_int(u64, self.delivery_tag);
|
|
1557
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1558
|
+
bitset_1.set_value(0, self.multiple);
|
|
1559
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1560
|
+
}
|
|
1561
|
+
},
|
|
1562
|
+
/// Reject an incoming message.
|
|
1563
|
+
/// This method allows a client to reject a message. It can be used to interrupt and
|
|
1564
|
+
/// cancel large incoming messages, or return untreatable messages to their original
|
|
1565
|
+
/// queue.
|
|
1566
|
+
basic_reject: struct {
|
|
1567
|
+
delivery_tag: u64,
|
|
1568
|
+
/// Requeue the message.
|
|
1569
|
+
/// If requeue is true, the server will attempt to requeue the message. If requeue
|
|
1570
|
+
/// is false or the requeue attempt fails the messages are discarded or dead-lettered.
|
|
1571
|
+
requeue: bool,
|
|
1572
|
+
|
|
1573
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1574
|
+
encoder.write_int(u64, self.delivery_tag);
|
|
1575
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1576
|
+
bitset_1.set_value(0, self.requeue);
|
|
1577
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1578
|
+
}
|
|
1579
|
+
},
|
|
1580
|
+
/// Redeliver unacknowledged messages.
|
|
1581
|
+
/// This method asks the server to redeliver all unacknowledged messages on a
|
|
1582
|
+
/// specified channel. Zero or more messages may be redelivered. This method
|
|
1583
|
+
/// is deprecated in favour of the synchronous Recover/Recover-Ok.
|
|
1584
|
+
basic_recover_async: struct {
|
|
1585
|
+
/// Requeue the message.
|
|
1586
|
+
/// If this field is zero, the message will be redelivered to the original
|
|
1587
|
+
/// recipient. If this bit is 1, the server will attempt to requeue the message,
|
|
1588
|
+
/// potentially then delivering it to an alternative subscriber.
|
|
1589
|
+
requeue: bool,
|
|
1590
|
+
|
|
1591
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1592
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1593
|
+
bitset_1.set_value(0, self.requeue);
|
|
1594
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1595
|
+
}
|
|
1596
|
+
},
|
|
1597
|
+
/// Redeliver unacknowledged messages.
|
|
1598
|
+
/// This method asks the server to redeliver all unacknowledged messages on a
|
|
1599
|
+
/// specified channel. Zero or more messages may be redelivered. This method
|
|
1600
|
+
/// replaces the asynchronous Recover.
|
|
1601
|
+
basic_recover: struct {
|
|
1602
|
+
/// Requeue the message.
|
|
1603
|
+
/// If this field is zero, the message will be redelivered to the original
|
|
1604
|
+
/// recipient. If this bit is 1, the server will attempt to requeue the message,
|
|
1605
|
+
/// potentially then delivering it to an alternative subscriber.
|
|
1606
|
+
requeue: bool,
|
|
1607
|
+
|
|
1608
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1609
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1610
|
+
bitset_1.set_value(0, self.requeue);
|
|
1611
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
/// Reject one or more incoming messages.
|
|
1615
|
+
/// This method allows a client to reject one or more incoming messages. It can be
|
|
1616
|
+
/// used to interrupt and cancel large incoming messages, or return untreatable
|
|
1617
|
+
/// messages to their original queue.
|
|
1618
|
+
/// This method is also used by the server to inform publishers on channels in
|
|
1619
|
+
/// confirm mode of unhandled messages. If a publisher receives this method, it
|
|
1620
|
+
/// probably needs to republish the offending messages.
|
|
1621
|
+
basic_nack: struct {
|
|
1622
|
+
delivery_tag: u64,
|
|
1623
|
+
/// Reject multiple messages.
|
|
1624
|
+
/// If set to 1, the delivery tag is treated as "up to and
|
|
1625
|
+
/// including", so that multiple messages can be rejected
|
|
1626
|
+
/// with a single method. If set to zero, the delivery tag
|
|
1627
|
+
/// refers to a single message. If the multiple field is 1, and
|
|
1628
|
+
/// the delivery tag is zero, this indicates rejection of
|
|
1629
|
+
/// all outstanding messages.
|
|
1630
|
+
multiple: bool,
|
|
1631
|
+
/// Requeue the message.
|
|
1632
|
+
/// If requeue is true, the server will attempt to requeue the message. If requeue
|
|
1633
|
+
/// is false or the requeue attempt fails the messages are discarded or dead-lettered.
|
|
1634
|
+
/// Clients receiving the Nack methods should ignore this flag.
|
|
1635
|
+
requeue: bool,
|
|
1636
|
+
|
|
1637
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1638
|
+
encoder.write_int(u64, self.delivery_tag);
|
|
1639
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1640
|
+
bitset_1.set_value(0, self.multiple);
|
|
1641
|
+
bitset_1.set_value(1, self.requeue);
|
|
1642
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1643
|
+
}
|
|
1644
|
+
},
|
|
1645
|
+
/// Select standard transaction mode.
|
|
1646
|
+
/// This method sets the channel to use standard transactions. The client must use this
|
|
1647
|
+
/// method at least once on a channel before using the Commit or Rollback methods.
|
|
1648
|
+
tx_select: struct {
|
|
1649
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1650
|
+
_ = self;
|
|
1651
|
+
_ = encoder;
|
|
1652
|
+
}
|
|
1653
|
+
},
|
|
1654
|
+
/// Commit the current transaction.
|
|
1655
|
+
/// This method commits all message publications and acknowledgments performed in
|
|
1656
|
+
/// the current transaction. A new transaction starts immediately after a commit.
|
|
1657
|
+
tx_commit: struct {
|
|
1658
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1659
|
+
_ = self;
|
|
1660
|
+
_ = encoder;
|
|
1661
|
+
}
|
|
1662
|
+
},
|
|
1663
|
+
/// Abandon the current transaction.
|
|
1664
|
+
/// This method abandons all message publications and acknowledgments performed in
|
|
1665
|
+
/// the current transaction. A new transaction starts immediately after a rollback.
|
|
1666
|
+
/// Note that unacked messages will not be automatically redelivered by rollback;
|
|
1667
|
+
/// if that is required an explicit recover call should be issued.
|
|
1668
|
+
tx_rollback: struct {
|
|
1669
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1670
|
+
_ = self;
|
|
1671
|
+
_ = encoder;
|
|
1672
|
+
}
|
|
1673
|
+
},
|
|
1674
|
+
/// This method sets the channel to use publisher acknowledgements.
|
|
1675
|
+
/// The client can only use this method on a non-transactional
|
|
1676
|
+
/// channel.
|
|
1677
|
+
confirm_select: struct {
|
|
1678
|
+
nowait: bool,
|
|
1679
|
+
|
|
1680
|
+
fn encode(self: *const @This(), encoder: *Encoder) void {
|
|
1681
|
+
var bitset_1: stdx.BitSetType(8) = .{};
|
|
1682
|
+
bitset_1.set_value(0, self.nowait);
|
|
1683
|
+
encoder.write_int(u8, bitset_1.bits);
|
|
1684
|
+
}
|
|
1685
|
+
},
|
|
1686
|
+
|
|
1687
|
+
pub fn method_header(self: ServerMethod) MethodHeader {
|
|
1688
|
+
return @bitCast(@as(u32, @intFromEnum(self)));
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
pub fn encode(self: ServerMethod, channel: Channel, encoder: *Encoder) void {
|
|
1692
|
+
encoder.begin_frame(.{
|
|
1693
|
+
.type = .method,
|
|
1694
|
+
.channel = channel,
|
|
1695
|
+
});
|
|
1696
|
+
switch (self) {
|
|
1697
|
+
inline else => |method| {
|
|
1698
|
+
encoder.write_method_header(self.method_header());
|
|
1699
|
+
method.encode(encoder);
|
|
1700
|
+
},
|
|
1701
|
+
}
|
|
1702
|
+
encoder.finish_frame(.method);
|
|
1703
|
+
}
|
|
1704
|
+
};
|