16#include <neograph/runtime_context.h>
18#include <asio/awaitable.hpp>
27namespace neograph::program {
32 const ProgramChildRecord& child,
40 std::vector<ContextArtifact> artifacts;
44NEOGRAPH_PROGRAM_API
void validate_program_context_publication(
46NEOGRAPH_PROGRAM_API
bool is_valid_program_context_history_append(
47 const std::vector<ProgramContextPublication>& old_context,
48 const std::optional<ProgramContextPublication>& next_context);
58 const std::vector<HookOutboxEntry>& old_entries,
59 const std::vector<HookOutboxEntry>& next_entries,
64 std::vector<ProgramContextPublication> context_publications;
65 std::vector<HookOutboxEntry> hook_outbox_entries;
66 std::vector<HookOutboxEntry> inherited_hook_outbox_entries;
67 std::optional<ProgramRuntimeStateTransferReceipt> transfer_receipt;
72 const std::optional<ProgramRuntimeStateTransferReceipt>& receipt,
76 const std::vector<ProgramContextPublication>& source_contexts,
77 const std::vector<HookOutboxEntry>& source_hooks,
80 const std::optional<ProgramContextPublication>& target_context)
noexcept;
84 const std::vector<ProgramContextPublication>& source_contexts,
86 const std::optional<ProgramContextPublication>& target_context)
noexcept;
88class NEOGRAPH_PROGRAM_API ProgramEffectOutboxEntry {
90 static constexpr std::uint32_t STORAGE_SCHEMA_VERSION = 1;
93 static ProgramEffectOutboxEntry parse(std::string_view stored_bytes);
95 std::uint64_t sequence()
const noexcept;
97 const std::string& id()
const noexcept;
98 std::string serialize_canonical()
const;
102 explicit ProgramEffectOutboxEntry(std::shared_ptr<const Impl> impl);
103 std::shared_ptr<const Impl> impl_;
109 std::string run_record_id;
110 std::string journal_head;
111 std::string lineage_head_id;
114struct NEOGRAPH_PROGRAM_API ProgramTransitionPublication {
117 std::vector<ProgramEvent> events;
118 std::vector<ProgramEffectOutboxEntry> effects;
121 std::optional<MigrationPlan> migration_plan;
122 std::vector<ProgramJavaScriptCommandJournalEntry> commands;
125 std::optional<ProgramRunGeneration> run_generation;
126 std::optional<ProgramRunLineage> run_lineage;
129 std::optional<ProgramRunLineage> fork_source_lineage;
131 std::optional<ProgramContextPublication> context_publication;
133 std::vector<HookOutboxEntry> hook_outbox_entries;
134 std::vector<ProgramChildSynthesisRecord> child_synthesis_records;
136 std::optional<ProgramRecordedReplaySource> recorded_replay_source;
137 std::optional<ProgramRunLineage> recorded_replay_source_lineage;
138 static ProgramTransitionPublication parse(std::string_view stored_bytes);
139 std::string serialize_canonical()
const;
142NEOGRAPH_PROGRAM_API
bool is_valid_program_recorded_replay_allocation(
143 const ProgramTransitionPublication& publication,
144 const ProgramRunLineage& previous_source_lineage,
145 const ProgramRunRecord& source_run);
147enum class ProgramTransitionPublishResult : std::uint8_t {
157 AfterJournalSnapshot,
160 AfterContextSnapshot,
162 AfterLineageSnapshot,
176 std::optional<ProgramJavaScriptCommandJournalEntry> latest_command;
193 [[nodiscard]]
virtual asio::awaitable<std::optional<ProgramRunRecord>>
load(
194 std::string_view owner_scope,
195 std::string_view run_id)
const = 0;
196 [[nodiscard]]
virtual asio::awaitable<std::optional<ProgramJournalRecord>> latest(
197 std::string_view owner_scope,
198 std::string_view run_id)
const = 0;
207 std::string_view owner_scope,
208 std::string_view run_id)
const;
209 [[nodiscard]]
virtual asio::awaitable<std::vector<ProgramEvent>> load_events(
210 std::string_view owner_scope,
211 std::string_view run_id,
212 std::uint64_t after_sequence = 0)
const = 0;
213 [[nodiscard]]
virtual asio::awaitable<std::vector<ProgramEffectOutboxEntry>> load_effects(
214 std::string_view owner_scope,
215 std::string_view run_id,
216 std::uint64_t after_sequence = 0)
const = 0;
225 std::string_view owner_scope,
226 std::string_view run_id,
227 std::uint64_t after_sequence = 0)
const;
236 std::string_view owner_scope,
237 std::string_view run_id)
const;
240 std::string_view owner_scope,
241 std::string_view run_id,
242 std::uint64_t after_sequence = 0)
const;
245 std::string_view owner_scope,
246 std::string_view run_id)
const;
249 std::string_view owner_scope,
250 std::string_view run_id)
const;
253 std::string_view owner_scope,
254 std::string_view run_id)
const;
258 std::string_view )
const {
259 co_return std::nullopt;
262 [[nodiscard]]
virtual asio::awaitable<std::optional<ProgramRunLineage>>
load_lineage(
264 std::string_view )
const {
265 co_return std::nullopt;
269 std::string_view owner_scope,
270 std::string_view run_id)
const;
275 std::string_view )
const {
276 co_return std::nullopt;
279 [[nodiscard]]
virtual asio::awaitable<std::optional<ProgramRunGeneration>>
load_generation(
282 std::uint64_t )
const {
283 co_return std::nullopt;
289 std::uint64_t )
const;
294 std::string_view )
const {
295 co_return std::nullopt;
300 std::string_view )
const {
301 co_return std::nullopt;
309 [[nodiscard]]
virtual asio::awaitable<ProgramTransitionPublishResult>
compare_publish(
310 std::string_view owner_scope,
311 std::string_view expected_journal_head,
312 ProgramTransitionPublication publication) = 0;
315 std::string_view owner_scope,
316 std::string_view expected_journal_head,
317 ProgramTransitionPublication publication,
318 std::optional<ProgramExecutionLease> expected_lease,
319 std::optional<ProgramExecutionLease> next_lease) {
320 co_return ProgramTransitionPublishResult::Conflict;
324 std::string_view owner_scope,
325 std::string_view expected_journal_head,
326 ProgramTransitionPublication publication,
330 co_return ProgramTransitionPublishResult::Conflict;
343 virtual std::optional<ProgramRunRecord> load_sync(
344 std::string_view owner_scope,
345 std::string_view run_id)
const = 0;
346 virtual std::optional<ProgramJournalRecord> latest_sync(
347 std::string_view owner_scope,
348 std::string_view run_id)
const = 0;
349 virtual std::optional<ProgramRunPublicationHead> load_run_publication_head_sync(
350 std::string_view owner_scope,
351 std::string_view run_id)
const;
352 virtual std::vector<ProgramEvent> load_events_sync(
353 std::string_view owner_scope,
354 std::string_view run_id,
355 std::uint64_t after_sequence = 0)
const = 0;
356 virtual std::vector<ProgramEffectOutboxEntry> load_effects_sync(
357 std::string_view owner_scope,
358 std::string_view run_id,
359 std::uint64_t after_sequence = 0)
const = 0;
360 virtual std::vector<ProgramJavaScriptCommandJournalEntry> load_javascript_commands_sync(
361 std::string_view owner_scope,
362 std::string_view run_id,
363 std::uint64_t after_sequence = 0)
const;
364 virtual std::optional<ProgramCommandPublicationHead> load_command_publication_head_sync(
365 std::string_view owner_scope,
366 std::string_view run_id)
const;
367 virtual std::vector<ProgramContextPublication> load_context_publications_sync(
368 std::string_view owner_scope,
369 std::string_view run_id,
370 std::uint64_t after_sequence = 0)
const;
371 virtual std::vector<HookOutboxEntry> load_hook_outbox_entries_sync(
372 std::string_view owner_scope,
373 std::string_view run_id)
const;
375 std::string_view owner_scope,
376 std::string_view run_id)
const;
377 virtual std::vector<ProgramChildSynthesisRecord> load_child_syntheses_sync(
378 std::string_view owner_scope,
379 std::string_view run_id)
const;
380 virtual std::optional<MigrationPlan> load_migration_plan_sync(
382 std::string_view )
const {
385 virtual std::optional<ProgramRunLineage> load_lineage_sync(
387 std::string_view )
const {
390 virtual std::optional<ProgramRunLineage> load_run_lineage_sync(
391 std::string_view owner_scope,
392 std::string_view run_id)
const;
393 virtual std::optional<ProgramRunLineage> load_lineage_head_sync(
396 std::string_view )
const {
399 virtual std::optional<ProgramRunGeneration> load_generation_sync(
402 std::uint64_t )
const {
405 virtual std::optional<ProgramTransitionPublication> load_generation_initial_publication_sync(
406 std::string_view owner_scope,
407 std::string_view lineage_id,
408 std::uint64_t generation)
const;
409 virtual std::optional<GraphMigrationCapsule> load_graph_migration_capsule_sync(
412 std::string_view )
const {
415 virtual std::optional<ProgramExecutionLease> load_execution_lease_sync(
417 std::string_view )
const {
420 virtual ProgramTransitionPublishResult compare_publish_sync(
421 std::string_view owner_scope,
422 std::string_view expected_journal_head,
423 ProgramTransitionPublication publication) = 0;
424 virtual ProgramTransitionPublishResult compare_publish_execution_sync(
425 std::string_view owner_scope,
426 std::string_view expected_journal_head,
427 ProgramTransitionPublication publication,
428 std::optional<ProgramExecutionLease> expected_lease,
429 std::optional<ProgramExecutionLease> next_lease) {
430 return ProgramTransitionPublishResult::Conflict;
432 virtual ProgramTransitionPublishResult compare_publish_graph_safe_point_sync(
433 std::string_view owner_scope,
434 std::string_view expected_journal_head,
435 ProgramTransitionPublication publication,
439 return ProgramTransitionPublishResult::Conflict;
444 [[nodiscard]] asio::awaitable<std::optional<ProgramRunRecord>>
load(
445 std::string_view owner_scope,
446 std::string_view run_id)
const final;
447 [[nodiscard]] asio::awaitable<std::optional<ProgramJournalRecord>> latest(
448 std::string_view owner_scope,
449 std::string_view run_id)
const final;
451 std::string_view owner_scope,
452 std::string_view run_id)
const final;
453 [[nodiscard]] asio::awaitable<std::vector<ProgramEvent>> load_events(
454 std::string_view owner_scope,
455 std::string_view run_id,
456 std::uint64_t after_sequence = 0) const final;
457 [[nodiscard]] asio::awaitable<std::vector<ProgramEffectOutboxEntry>> load_effects(
458 std::string_view owner_scope,
459 std::string_view run_id,
460 std::uint64_t after_sequence = 0) const final;
462 std::string_view owner_scope,
463 std::string_view run_id,
464 std::uint64_t after_sequence = 0) const final;
466 std::string_view owner_scope,
467 std::string_view run_id) const final;
469 std::string_view owner_scope,
470 std::string_view run_id,
471 std::uint64_t after_sequence = 0) const final;
473 std::string_view owner_scope,
474 std::string_view run_id) const final;
476 std::string_view owner_scope,
477 std::string_view run_id) const final;
479 std::string_view owner_scope,
480 std::string_view run_id) const final;
481 [[nodiscard]] asio::awaitable<std::optional<
MigrationPlan>> load_migration_plan(
482 std::string_view owner_scope,
483 std::string_view run_id) const final;
485 std::string_view owner_scope,
486 std::string_view lineage_id) const final;
488 std::string_view owner_scope,
489 std::string_view run_id) const final;
491 std::string_view owner_scope,
492 std::string_view lineage_id,
493 std::string_view head_id) const final;
495 std::string_view owner_scope,
496 std::string_view lineage_id,
497 std::uint64_t generation) const final;
498 [[nodiscard]] asio::awaitable<std::optional<ProgramTransitionPublication>> load_generation_initial_publication(
499 std::string_view owner_scope,
500 std::string_view lineage_id,
501 std::uint64_t generation) const final;
503 std::string_view owner_scope,
504 std::string_view source_run_id,
505 std::string_view source_lineage_head_id) const final;
507 std::string_view owner_scope,
508 std::string_view run_id) const final;
509 [[nodiscard]] asio::awaitable<ProgramTransitionPublishResult> compare_publish(
510 std::string_view owner_scope,
511 std::string_view expected_journal_head,
512 ProgramTransitionPublication publication) final;
513 [[nodiscard]] asio::awaitable<ProgramTransitionPublishResult> compare_publish_execution(
514 std::string_view owner_scope,
515 std::string_view expected_journal_head,
516 ProgramTransitionPublication publication,
519 [[nodiscard]] asio::awaitable<ProgramTransitionPublishResult> compare_publish_graph_safe_point(
520 std::string_view owner_scope,
521 std::string_view expected_journal_head,
522 ProgramTransitionPublication publication,
528 bool completes_at_once() const noexcept {
return !offloads(); }
532 virtual bool offloads() const noexcept {
return false; }
546 const std::shared_ptr<ProgramTransitionStore>& store() const noexcept {
return store_; }
548 std::string process_coordination_key()
const;
549 std::optional<ProgramRunRecord> load(std::string_view owner_scope, std::string_view run_id)
const;
550 std::optional<ProgramJournalRecord> latest(
551 std::string_view owner_scope,
552 std::string_view run_id)
const;
553 std::optional<ProgramRunPublicationHead> load_run_publication_head(
554 std::string_view owner_scope,
555 std::string_view run_id)
const;
556 std::vector<ProgramEvent> load_events(
557 std::string_view owner_scope,
558 std::string_view run_id,
559 std::uint64_t after_sequence = 0)
const;
560 std::vector<ProgramEffectOutboxEntry> load_effects(
561 std::string_view owner_scope,
562 std::string_view run_id,
563 std::uint64_t after_sequence = 0)
const;
564 std::vector<ProgramJavaScriptCommandJournalEntry> load_javascript_commands(
565 std::string_view owner_scope,
566 std::string_view run_id,
567 std::uint64_t after_sequence = 0)
const;
568 std::optional<ProgramCommandPublicationHead> load_command_publication_head(
569 std::string_view owner_scope,
570 std::string_view run_id)
const;
571 std::vector<ProgramContextPublication> load_context_publications(
572 std::string_view owner_scope,
573 std::string_view run_id,
574 std::uint64_t after_sequence = 0)
const;
575 std::vector<HookOutboxEntry> load_hook_outbox_entries(
576 std::string_view owner_scope,
577 std::string_view run_id)
const;
578 ProgramEffectiveRuntimeState load_effective_runtime_state(
579 std::string_view owner_scope,
580 std::string_view run_id)
const;
581 std::vector<ProgramChildSynthesisRecord> load_child_syntheses(
582 std::string_view owner_scope,
583 std::string_view run_id)
const;
584 std::optional<MigrationPlan> load_migration_plan(
585 std::string_view owner_scope,
586 std::string_view run_id)
const;
587 std::optional<ProgramRunLineage> load_lineage(
588 std::string_view owner_scope,
589 std::string_view lineage_id)
const;
590 std::optional<ProgramRunLineage> load_run_lineage(
591 std::string_view owner_scope,
592 std::string_view run_id)
const;
593 std::optional<ProgramRunLineage> load_lineage_head(
594 std::string_view owner_scope,
595 std::string_view lineage_id,
596 std::string_view head_id)
const;
597 std::optional<ProgramRunGeneration> load_generation(
598 std::string_view owner_scope,
599 std::string_view lineage_id,
600 std::uint64_t generation)
const;
601 std::optional<ProgramTransitionPublication> load_generation_initial_publication(
602 std::string_view owner_scope,
603 std::string_view lineage_id,
604 std::uint64_t generation)
const;
605 std::optional<GraphMigrationCapsule> load_graph_migration_capsule(
606 std::string_view owner_scope,
607 std::string_view source_run_id,
608 std::string_view source_lineage_head_id)
const;
609 std::optional<ProgramExecutionLease> load_execution_lease(
610 std::string_view owner_scope,
611 std::string_view run_id)
const;
612 ProgramTransitionPublishResult compare_publish(
613 std::string_view owner_scope,
614 std::string_view expected_journal_head,
615 ProgramTransitionPublication publication)
const;
616 ProgramTransitionPublishResult compare_publish_execution(
617 std::string_view owner_scope,
618 std::string_view expected_journal_head,
619 ProgramTransitionPublication publication,
620 std::optional<ProgramExecutionLease> expected_lease,
621 std::optional<ProgramExecutionLease> next_lease)
const;
622 ProgramTransitionPublishResult compare_publish_graph_safe_point(
623 std::string_view owner_scope,
624 std::string_view expected_journal_head,
625 ProgramTransitionPublication publication,
626 const ProgramGraphSafePointEvidence& evidence,
627 const GraphMigrationCapsule& capsule,
628 const ProgramExecutionLease& execution_lease)
const;
631 std::shared_ptr<ProgramTransitionStore> store_;
632 SyncProgramTransitionStore* sync_ =
nullptr;
633 BlockingStorePolicy policy_;
636class NEOGRAPH_PROGRAM_API InMemoryProgramTransitionStore final
637 :
public SyncProgramTransitionStore {
639 InMemoryProgramTransitionStore();
640 ~InMemoryProgramTransitionStore()
override;
641 InMemoryProgramTransitionStore(InMemoryProgramTransitionStore&&) noexcept;
642 InMemoryProgramTransitionStore& operator=(InMemoryProgramTransitionStore&&) noexcept;
643 InMemoryProgramTransitionStore(const InMemoryProgramTransitionStore&) = delete;
644 InMemoryProgramTransitionStore& operator=(const InMemoryProgramTransitionStore&) = delete;
646 std::optional<ProgramRunPublicationHead> load_run_publication_head_sync(
647 std::string_view owner_scope, std::string_view run_id) const override;
649 std::optional<ProgramCommandPublicationHead> load_command_publication_head_sync(
650 std::string_view owner_scope, std::string_view run_id) const override;
652 std::optional<ProgramRunRecord> load_sync(std::string_view owner_scope,
653 std::string_view run_id) const override;
654 std::optional<ProgramJournalRecord> latest_sync(std::string_view owner_scope,
655 std::string_view run_id) const override;
656 std::vector<ProgramEvent> load_events_sync(std::string_view owner_scope,
657 std::string_view run_id,
658 std::uint64_t after_sequence = 0) const override;
659 std::vector<ProgramEffectOutboxEntry>
660 load_effects_sync(std::string_view owner_scope,
661 std::string_view run_id,
662 std::uint64_t after_sequence = 0) const override;
663 std::vector<ProgramJavaScriptCommandJournalEntry>
664 load_javascript_commands_sync(std::string_view owner_scope,
665 std::string_view run_id,
666 std::uint64_t after_sequence = 0) const override;
667 std::vector<ProgramContextPublication> load_context_publications_sync(
668 std::string_view owner_scope,
669 std::string_view run_id,
670 std::uint64_t after_sequence = 0) const override;
671 std::vector<HookOutboxEntry> load_hook_outbox_entries_sync(
672 std::string_view owner_scope, std::string_view run_id) const override;
673 std::vector<ProgramChildSynthesisRecord> load_child_syntheses_sync(
674 std::string_view owner_scope, std::string_view run_id) const override;
675 std::optional<MigrationPlan> load_migration_plan_sync(std::string_view owner_scope,
676 std::string_view run_id) const override;
677 std::optional<ProgramRunLineage> load_lineage_sync(std::string_view owner_scope,
678 std::string_view lineage_id) const override;
679 std::optional<ProgramRunLineage> load_run_lineage_sync(std::string_view owner_scope,
680 std::string_view run_id) const override;
681 std::optional<ProgramRunLineage> load_lineage_head_sync(std::string_view owner_scope,
682 std::string_view lineage_id,
683 std::string_view head_id) const override;
684 std::optional<ProgramRunGeneration> load_generation_sync(std::string_view owner_scope,
685 std::string_view lineage_id,
686 std::uint64_t generation) const override;
687 std::optional<ProgramTransitionPublication> load_generation_initial_publication_sync(
688 std::string_view owner_scope,
689 std::string_view lineage_id,
690 std::uint64_t generation) const override;
691 std::optional<GraphMigrationCapsule> load_graph_migration_capsule_sync(
692 std::string_view owner_scope,
693 std::string_view source_run_id,
694 std::string_view source_lineage_head_id) const override;
695 std::optional<ProgramExecutionLease> load_execution_lease_sync(
696 std::string_view owner_scope,
697 std::string_view run_id) const override;
698 ProgramTransitionPublishResult
699 compare_publish_sync(std::string_view owner_scope,
700 std::string_view expected_journal_head,
701 ProgramTransitionPublication publication) override;
702 ProgramTransitionPublishResult compare_publish_execution_sync(
703 std::string_view owner_scope,
704 std::string_view expected_journal_head,
705 ProgramTransitionPublication publication,
706 std::optional<ProgramExecutionLease> expected_lease,
707 std::optional<ProgramExecutionLease> next_lease) override;
708 ProgramTransitionPublishResult compare_publish_graph_safe_point_sync(
709 std::string_view owner_scope,
710 std::string_view expected_journal_head,
711 ProgramTransitionPublication publication,
712 const ProgramGraphSafePointEvidence& evidence,
713 const GraphMigrationCapsule& capsule,
714 const ProgramExecutionLease& execution_lease) override;
717 void fail_next_publication_for_testing(ProgramTransitionFaultPoint point);
720 ProgramTransitionPublishResult compare_publish_impl(
721 std::string_view owner_scope,
722 std::string_view expected_journal_head,
723 ProgramTransitionPublication publication,
724 const ProgramGraphSafePointEvidence* evidence,
725 const GraphMigrationCapsule* capsule,
726 const ProgramExecutionLease* expected_lease,
727 const ProgramExecutionLease* next_lease);
729 std::unique_ptr<Impl> impl_;
NEOGRAPH_API export/import macro for shared-library builds.
Durable, generation-scoped child synthesis.
Evidence that one normalized provider request was assembled from one exact epoch.
Immutable selection of exact RAW and derived material for provider turns.
Immutable snapshot of one logical invocation's durable outbox state.
A ProgramTransitionStore for a caller that cannot suspend: the synchronous Program API,...
BlockingProgramTransitionStore(ProgramTransitionStore &store, BlockingStorePolicy policy={})
A view of a store that outlives it.
Exact, content-addressed source evidence captured at a durable Core boundary.
Immutable proof of whether an admitted run may move to another version.
Stored grants are evidence only; recovery must reselect them through host policy.
Backend-global ownership of one migration-capable root Core dispatch.
Host-only, non-serializable evidence for one running safe-point publication.
Immutable, content-addressed command-journal value.
Immutable durable external-effect state.
Immutable identity of one admitted topology generation in a run lineage.
Immutable content-addressed head of one stable run lineage.
Deep-owned, content-addressed run snapshot used for reconnect and CAS publication.
The durable store of Program transitions, as the runtime uses it (#556).
virtual asio::awaitable< std::vector< HookOutboxEntry > > load_hook_outbox_entries(std::string_view owner_scope, std::string_view run_id) const
Current durable heads, including pending and reconciliation-required hooks.
virtual asio::awaitable< std::vector< ProgramJavaScriptCommandJournalEntry > > load_javascript_commands(std::string_view owner_scope, std::string_view run_id, std::uint64_t after_sequence=0) const
Durable yielded-command journal, ordered by append sequence.
virtual asio::awaitable< std::optional< ProgramExecutionLease > > load_execution_lease(std::string_view, std::string_view) const
Current backend-global root Core dispatch owner, when one is active.
virtual asio::awaitable< std::vector< ProgramContextPublication > > load_context_publications(std::string_view owner_scope, std::string_view run_id, std::uint64_t after_sequence=0) const
Durable provider-context evidence, ordered by ContextEpoch sequence.
virtual asio::awaitable< std::optional< ProgramTransitionPublication > > load_generation_initial_publication(std::string_view, std::string_view, std::uint64_t) const
Exact immutable publication that created one topology generation.
virtual asio::awaitable< std::optional< ProgramRunLineage > > load_lineage(std::string_view, std::string_view) const
Current immutable lineage head, when the run uses generation accounting.
virtual asio::awaitable< ProgramTransitionPublishResult > compare_publish(std::string_view owner_scope, std::string_view expected_journal_head, ProgramTransitionPublication publication)=0
Atomically publishes the run snapshot, journal head, events, effect outbox, and JavaScript command ap...
virtual asio::awaitable< ProgramTransitionPublishResult > compare_publish_graph_safe_point(std::string_view owner_scope, std::string_view expected_journal_head, ProgramTransitionPublication publication, const ProgramGraphSafePointEvidence &evidence, const GraphMigrationCapsule &capsule, const ProgramExecutionLease &execution_lease)
Host-only peer for a running source checkpoint; evidence is never serialized.
virtual asio::awaitable< std::optional< ProgramRunLineage > > load_run_lineage(std::string_view owner_scope, std::string_view run_id) const
Current lineage head associated with one run generation.
virtual asio::awaitable< std::optional< ProgramRunLineage > > load_lineage_head(std::string_view, std::string_view, std::string_view) const
One immutable historical lineage head addressed by its content identity.
virtual asio::awaitable< std::optional< MigrationPlan > > load_migration_plan(std::string_view, std::string_view) const
Durable migration proof published with a fork, if this run is a fork.
virtual asio::awaitable< std::optional< ProgramRunGeneration > > load_generation(std::string_view, std::string_view, std::uint64_t) const
One immutable topology generation retained by ordinal.
virtual asio::awaitable< std::optional< ProgramRunRecord > > load(std::string_view owner_scope, std::string_view run_id) const =0
Wrong-owner lookups are indistinguishable from absence.
virtual asio::awaitable< ProgramEffectiveRuntimeState > load_effective_runtime_state(std::string_view owner_scope, std::string_view run_id) const
Target-local state plus source-origin hook heads authorized by its generation.
virtual asio::awaitable< std::vector< ProgramChildSynthesisRecord > > load_child_syntheses(std::string_view owner_scope, std::string_view run_id) const
Current synthesis heads.
virtual std::string process_coordination_key() const
Process-local namespace used to coordinate wrappers over one backend.
virtual asio::awaitable< std::optional< ProgramCommandPublicationHead > > load_command_publication_head(std::string_view owner_scope, std::string_view run_id) const
Read one coherent run/journal head and the last command append.
virtual asio::awaitable< std::optional< ProgramRunPublicationHead > > load_run_publication_head(std::string_view owner_scope, std::string_view run_id) const
Read one coherent record/journal pair without requiring JavaScript support.
virtual asio::awaitable< std::optional< GraphMigrationCapsule > > load_graph_migration_capsule(std::string_view, std::string_view, std::string_view) const
Immutable source hold captured atomically with one graph safe point.
virtual asio::awaitable< ProgramTransitionPublishResult > compare_publish_execution(std::string_view owner_scope, std::string_view expected_journal_head, ProgramTransitionPublication publication, std::optional< ProgramExecutionLease > expected_lease, std::optional< ProgramExecutionLease > next_lease)
Atomically publishes and acquires, releases, or replaces a dispatch lease.
Base of a ProgramTransitionStore whose backend is synchronous: the in-memory store,...
asio::awaitable< std::optional< ProgramRunPublicationHead > > load_run_publication_head(std::string_view owner_scope, std::string_view run_id) const final
Read one coherent record/journal pair without requiring JavaScript support.
asio::awaitable< std::optional< ProgramRunRecord > > load(std::string_view owner_scope, std::string_view run_id) const final
Wrong-owner lookups are indistinguishable from absence.
virtual bool offloads() const noexcept
True for a backend that blocks for long: each operation then runs on a pool thread.
Durable coordinates and results for JavaScript control commands.
Ordered event envelope for one Program run attempt.
Durable hook dispatch contracts and in-memory journal.
Immutable run-generation identity and lineage budget heads.
Explicit compatibility plans between admitted Program versions.
Canonical immutable snapshot of one owner-scoped Program run.
How a Program store call is awaited, and how a synchronous caller waits for one (#556).
When a Blocking...Store may wait for a store call that does not complete at once.
One publication head and its newest command from the same committed snapshot.
Exact context evidence selected for one Program transition.
Effective runtime state for one generation, preserving source hook provenance.
Deep-owned stored journal value.
Exact source custody for a recorded replay; this is not a fresh dispatch grant.
A run record and journal from one committed publication, without optional command history.
ProgramTransitionFaultPoint
One-shot in-memory publication faults used to exercise the strong exception guarantee at each staged ...
NEOGRAPH_PROGRAM_API bool is_valid_program_runtime_state_transfer(const std::optional< ProgramRuntimeStateTransferReceipt > &receipt, const ProgramRunGeneration &source_generation, const ProgramRunLineage &source_lineage, const ProgramRunRecord &source_run, const std::vector< ProgramContextPublication > &source_contexts, const std::vector< HookOutboxEntry > &source_hooks, const ProgramRunGeneration &target_generation, const ProgramRunRecord &target_run, const std::optional< ProgramContextPublication > &target_context) noexcept
Validates exact context and unresolved-hook transfer into one successor.
NEOGRAPH_PROGRAM_API bool is_valid_program_hook_history_append(const std::vector< HookOutboxEntry > &old_entries, const std::vector< HookOutboxEntry > &next_entries, const ProgramRunRecord &run)
Validates an append-only hook-head update.
NEOGRAPH_PROGRAM_API void validate_program_hook_outbox_entry(const HookOutboxEntry &entry, const ProgramRunRecord &run)
Validates a durable hook outbox head before it is attached to a Program run.
NEOGRAPH_PROGRAM_API bool does_program_child_generation_result_bind(const ProgramRunRecord &parent, const ProgramChildRecord &child, const ProgramRunGeneration &generation, const ProgramRunLineage &lineage, const ProgramRunRecord &result_run) noexcept
Bind a child result from an admitted replacement generation to its stable relation.
NEOGRAPH_PROGRAM_API bool is_valid_program_runtime_context_clone(const std::vector< ProgramContextPublication > &source_contexts, const ProgramRunRecord &target_run, const std::optional< ProgramContextPublication > &target_context) noexcept
Validates a source snapshot cloned into an independent fork lineage.