MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / __call_view_anon__

Method __call_view_anon__

crates/bindings-cpp/src/internal/Module.cpp:555–578  ·  view source on GitHub ↗

Dispatch function for views with AnonymousViewContext (no sender)

Source from the content-addressed store, hash-verified

553
554// Dispatch function for views with AnonymousViewContext (no sender)
555int16_t Module::__call_view_anon__(
556 uint32_t id,
557 BytesSource args_source,
558 BytesSink result_sink
559) {
560 // Check if view ID is valid
561 if (id >= g_view_anon_handlers.size()) {
562 fprintf(stderr, "ERROR: Invalid anonymous view ID %u (have %zu anonymous views)\n",
563 id, g_view_anon_handlers.size());
564 return -1; // NO_SUCH_VIEW
565 }
566
567 // Create anonymous view context
568 AnonymousViewContext ctx;
569
570 // Get the handler
571 const auto& handler_info = g_view_anon_handlers[id];
572
573 // Call the view handler - returns fully serialized result data, including the header byte.
574 std::vector<uint8_t> result_data = handler_info.handler(ctx, args_source);
575 WriteBytes(result_sink, result_data);
576
577 return 2; // Success with data
578}
579
580// Dispatch function for procedures
581int16_t Module::__call_procedure__(

Callers

nothing calls this directly

Calls 2

WriteBytesFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected