feat: workerize external generation
This commit is contained in:
129
server-rs/crates/spacetime-client/src/external_generation.rs
Normal file
129
server-rs/crates/spacetime-client/src/external_generation.rs
Normal file
@@ -0,0 +1,129 @@
|
||||
use super::*;
|
||||
use crate::mapper::*;
|
||||
|
||||
impl SpacetimeClient {
|
||||
pub async fn enqueue_external_generation_job(
|
||||
&self,
|
||||
input: ExternalGenerationJobEnqueueRecordInput,
|
||||
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(
|
||||
"enqueue_external_generation_job_and_return",
|
||||
move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.enqueue_external_generation_job_and_return_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_external_generation_job_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn claim_external_generation_jobs(
|
||||
&self,
|
||||
input: ExternalGenerationJobClaimRecordInput,
|
||||
) -> Result<Vec<ExternalGenerationJobRecord>, SpacetimeClientError> {
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(
|
||||
"claim_external_generation_jobs_and_return",
|
||||
move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.claim_external_generation_jobs_and_return_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_external_generation_job_claim_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn complete_external_generation_job(
|
||||
&self,
|
||||
input: ExternalGenerationJobCompleteRecordInput,
|
||||
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(
|
||||
"complete_external_generation_job_and_return",
|
||||
move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.complete_external_generation_job_and_return_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_external_generation_job_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn renew_external_generation_job_lease(
|
||||
&self,
|
||||
input: ExternalGenerationJobRenewLeaseRecordInput,
|
||||
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(
|
||||
"renew_external_generation_job_lease_and_return",
|
||||
move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.renew_external_generation_job_lease_and_return_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_external_generation_job_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn fail_external_generation_job(
|
||||
&self,
|
||||
input: ExternalGenerationJobFailRecordInput,
|
||||
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(
|
||||
"fail_external_generation_job_and_return",
|
||||
move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.fail_external_generation_job_and_return_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_external_generation_job_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
@@ -30,12 +30,15 @@ pub use mapper::{
|
||||
CustomWorldPublishGateRecord, CustomWorldPublishWorldRecord,
|
||||
CustomWorldPublishWorldRecordInput, CustomWorldPublishedProfileCompileRecord,
|
||||
CustomWorldResultPreviewBlockerRecord, CustomWorldSupportedActionRecord,
|
||||
CustomWorldWorkSummaryRecord, JumpHopActionRequest, JumpHopActionResponse, JumpHopActionType,
|
||||
JumpHopCharacterAsset, JumpHopDifficulty, JumpHopDraftResponse, JumpHopGalleryCardResponse,
|
||||
JumpHopGalleryDetailResponse, JumpHopGalleryResponse, JumpHopGenerationStatus,
|
||||
JumpHopJumpRequest, JumpHopJumpResponse, JumpHopJumpResult, JumpHopLastJump, JumpHopPath,
|
||||
JumpHopPlatform, JumpHopRestartRunRequest, JumpHopRunResponse, JumpHopRunStatus,
|
||||
JumpHopRuntimeRunSnapshotResponse, JumpHopScoring, JumpHopSessionResponse,
|
||||
CustomWorldWorkSummaryRecord, ExternalGenerationJobClaimRecordInput,
|
||||
ExternalGenerationJobCompleteRecordInput, ExternalGenerationJobEnqueueRecordInput,
|
||||
ExternalGenerationJobFailRecordInput, ExternalGenerationJobRecord,
|
||||
ExternalGenerationJobRenewLeaseRecordInput, JumpHopActionRequest, JumpHopActionResponse,
|
||||
JumpHopActionType, JumpHopCharacterAsset, JumpHopDifficulty, JumpHopDraftResponse,
|
||||
JumpHopGalleryCardResponse, JumpHopGalleryDetailResponse, JumpHopGalleryResponse,
|
||||
JumpHopGenerationStatus, JumpHopJumpRequest, JumpHopJumpResponse, JumpHopJumpResult,
|
||||
JumpHopLastJump, JumpHopPath, JumpHopPlatform, JumpHopRestartRunRequest, JumpHopRunResponse,
|
||||
JumpHopRunStatus, JumpHopRuntimeRunSnapshotResponse, JumpHopScoring, JumpHopSessionResponse,
|
||||
JumpHopSessionSnapshotResponse, JumpHopStartRunRequest, JumpHopStylePreset, JumpHopTileAsset,
|
||||
JumpHopTileType, JumpHopWorkDetailResponse, JumpHopWorkMutationResponse,
|
||||
JumpHopWorkProfileResponse, JumpHopWorkSummaryResponse, JumpHopWorksResponse,
|
||||
@@ -55,13 +58,13 @@ pub use mapper::{
|
||||
PuzzleCreatorIntentRecord, PuzzleDraftCompileFailureRecordInput, PuzzleDraftLevelRecord,
|
||||
PuzzleFormDraftRecord, PuzzleFormDraftSaveRecordInput, PuzzleGalleryCardRecord,
|
||||
PuzzleGeneratedImageCandidateRecord, PuzzleGeneratedImagesSaveRecordInput,
|
||||
PuzzleLeaderboardEntryRecord, PuzzleLeaderboardSubmitRecordInput, PuzzleMergedGroupRecord,
|
||||
PuzzlePieceStateRecord, PuzzlePublishRecordInput, PuzzleRecommendedNextWorkRecord,
|
||||
PuzzleResultDraftRecord, PuzzleResultPreviewBlockerRecord, PuzzleResultPreviewFindingRecord,
|
||||
PuzzleResultPreviewRecord, PuzzleRunDragRecordInput, PuzzleRunNextLevelRecordInput,
|
||||
PuzzleRunPauseRecordInput, PuzzleRunPropRecordInput, PuzzleRunRecord,
|
||||
PuzzleRunStartRecordInput, PuzzleRunSwapRecordInput, PuzzleRuntimeLevelRecord,
|
||||
PuzzleSelectCoverImageRecordInput, PuzzleUiBackgroundSaveRecordInput,
|
||||
PuzzleLeaderboardEntryRecord, PuzzleLeaderboardSubmitRecordInput,
|
||||
PuzzleLevelGenerationFailureRecordInput, PuzzleMergedGroupRecord, PuzzlePieceStateRecord,
|
||||
PuzzlePublishRecordInput, PuzzleRecommendedNextWorkRecord, PuzzleResultDraftRecord,
|
||||
PuzzleResultPreviewBlockerRecord, PuzzleResultPreviewFindingRecord, PuzzleResultPreviewRecord,
|
||||
PuzzleRunDragRecordInput, PuzzleRunNextLevelRecordInput, PuzzleRunPauseRecordInput,
|
||||
PuzzleRunPropRecordInput, PuzzleRunRecord, PuzzleRunStartRecordInput, PuzzleRunSwapRecordInput,
|
||||
PuzzleRuntimeLevelRecord, PuzzleSelectCoverImageRecordInput, PuzzleUiBackgroundSaveRecordInput,
|
||||
PuzzleWorkLikeReportRecordInput, PuzzleWorkPointIncentiveClaimRecordInput,
|
||||
PuzzleWorkProfileRecord, PuzzleWorkRemixRecordInput, PuzzleWorkUpsertRecordInput,
|
||||
ResolveCombatActionRecord, ResolveNpcBattleInteractionInput,
|
||||
@@ -103,6 +106,7 @@ pub use bark_battle::{
|
||||
pub mod big_fish;
|
||||
pub mod combat;
|
||||
pub mod custom_world;
|
||||
pub mod external_generation;
|
||||
pub mod inventory;
|
||||
pub mod jump_hop;
|
||||
pub mod match3d;
|
||||
|
||||
@@ -8,6 +8,7 @@ mod big_fish;
|
||||
mod combat;
|
||||
mod common;
|
||||
mod custom_world;
|
||||
mod external_generation;
|
||||
mod inventory;
|
||||
mod jump_hop;
|
||||
mod match3d;
|
||||
@@ -67,6 +68,11 @@ pub use self::common::{
|
||||
VisualNovelRunSnapshotRecordInput, VisualNovelRunStartRecordInput,
|
||||
VisualNovelWorkCompileRecordInput,
|
||||
};
|
||||
pub use self::external_generation::{
|
||||
ExternalGenerationJobClaimRecordInput, ExternalGenerationJobCompleteRecordInput,
|
||||
ExternalGenerationJobEnqueueRecordInput, ExternalGenerationJobFailRecordInput,
|
||||
ExternalGenerationJobRecord, ExternalGenerationJobRenewLeaseRecordInput,
|
||||
};
|
||||
pub use self::jump_hop::{
|
||||
JumpHopActionRequest, JumpHopActionResponse, JumpHopActionType, JumpHopCharacterAsset,
|
||||
JumpHopDifficulty, JumpHopDraftResponse, JumpHopGalleryCardResponse,
|
||||
@@ -104,13 +110,13 @@ pub use self::puzzle::{
|
||||
PuzzleCreatorIntentRecord, PuzzleDraftCompileFailureRecordInput, PuzzleDraftLevelRecord,
|
||||
PuzzleFormDraftRecord, PuzzleFormDraftSaveRecordInput, PuzzleGalleryCardRecord,
|
||||
PuzzleGeneratedImageCandidateRecord, PuzzleGeneratedImagesSaveRecordInput,
|
||||
PuzzleLeaderboardEntryRecord, PuzzleLeaderboardSubmitRecordInput, PuzzleMergedGroupRecord,
|
||||
PuzzlePieceStateRecord, PuzzlePublishRecordInput, PuzzleRecommendedNextWorkRecord,
|
||||
PuzzleResultDraftRecord, PuzzleResultPreviewBlockerRecord, PuzzleResultPreviewFindingRecord,
|
||||
PuzzleResultPreviewRecord, PuzzleRunDragRecordInput, PuzzleRunNextLevelRecordInput,
|
||||
PuzzleRunPauseRecordInput, PuzzleRunPropRecordInput, PuzzleRunRecord,
|
||||
PuzzleRunStartRecordInput, PuzzleRunSwapRecordInput, PuzzleRuntimeLevelRecord,
|
||||
PuzzleSelectCoverImageRecordInput, PuzzleUiBackgroundSaveRecordInput,
|
||||
PuzzleLeaderboardEntryRecord, PuzzleLeaderboardSubmitRecordInput,
|
||||
PuzzleLevelGenerationFailureRecordInput, PuzzleMergedGroupRecord, PuzzlePieceStateRecord,
|
||||
PuzzlePublishRecordInput, PuzzleRecommendedNextWorkRecord, PuzzleResultDraftRecord,
|
||||
PuzzleResultPreviewBlockerRecord, PuzzleResultPreviewFindingRecord, PuzzleResultPreviewRecord,
|
||||
PuzzleRunDragRecordInput, PuzzleRunNextLevelRecordInput, PuzzleRunPauseRecordInput,
|
||||
PuzzleRunPropRecordInput, PuzzleRunRecord, PuzzleRunStartRecordInput, PuzzleRunSwapRecordInput,
|
||||
PuzzleRuntimeLevelRecord, PuzzleSelectCoverImageRecordInput, PuzzleUiBackgroundSaveRecordInput,
|
||||
PuzzleWorkLikeReportRecordInput, PuzzleWorkPointIncentiveClaimRecordInput,
|
||||
PuzzleWorkProfileRecord, PuzzleWorkRemixRecordInput, PuzzleWorkUpsertRecordInput,
|
||||
};
|
||||
@@ -165,6 +171,9 @@ pub(crate) use self::custom_world::{
|
||||
parse_rpg_agent_operation_status_record, parse_rpg_agent_operation_type_record,
|
||||
parse_rpg_agent_stage_record,
|
||||
};
|
||||
pub(crate) use self::external_generation::{
|
||||
map_external_generation_job_claim_result, map_external_generation_job_procedure_result,
|
||||
};
|
||||
pub(crate) use self::inventory::{
|
||||
map_runtime_inventory_state_procedure_result, map_runtime_item_reward_item_snapshot,
|
||||
map_runtime_item_reward_item_snapshot_back,
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
use super::*;
|
||||
|
||||
impl From<ExternalGenerationJobEnqueueRecordInput> for ExternalGenerationJobEnqueueInput {
|
||||
fn from(input: ExternalGenerationJobEnqueueRecordInput) -> Self {
|
||||
Self {
|
||||
job_id: input.job_id,
|
||||
dedupe_key: input.dedupe_key,
|
||||
job_kind: input.job_kind,
|
||||
owner_user_id: input.owner_user_id,
|
||||
source_module: input.source_module,
|
||||
source_entity_id: input.source_entity_id,
|
||||
request_label: input.request_label,
|
||||
request_payload_json: input.request_payload_json,
|
||||
max_attempts: input.max_attempts,
|
||||
available_at_micros: input.available_at_micros,
|
||||
created_at_micros: input.created_at_micros,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ExternalGenerationJobClaimRecordInput> for ExternalGenerationJobClaimInput {
|
||||
fn from(input: ExternalGenerationJobClaimRecordInput) -> Self {
|
||||
Self {
|
||||
worker_id: input.worker_id,
|
||||
limit: input.limit,
|
||||
lease_expires_at_micros: input.lease_expires_at_micros,
|
||||
claimed_at_micros: input.claimed_at_micros,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ExternalGenerationJobCompleteRecordInput> for ExternalGenerationJobCompleteInput {
|
||||
fn from(input: ExternalGenerationJobCompleteRecordInput) -> Self {
|
||||
Self {
|
||||
job_id: input.job_id,
|
||||
worker_id: input.worker_id,
|
||||
lease_token: input.lease_token,
|
||||
result_payload_json: input.result_payload_json,
|
||||
completed_at_micros: input.completed_at_micros,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ExternalGenerationJobRenewLeaseRecordInput> for ExternalGenerationJobRenewLeaseInput {
|
||||
fn from(input: ExternalGenerationJobRenewLeaseRecordInput) -> Self {
|
||||
Self {
|
||||
job_id: input.job_id,
|
||||
worker_id: input.worker_id,
|
||||
lease_token: input.lease_token,
|
||||
lease_expires_at_micros: input.lease_expires_at_micros,
|
||||
renewed_at_micros: input.renewed_at_micros,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ExternalGenerationJobFailRecordInput> for ExternalGenerationJobFailInput {
|
||||
fn from(input: ExternalGenerationJobFailRecordInput) -> Self {
|
||||
Self {
|
||||
job_id: input.job_id,
|
||||
worker_id: input.worker_id,
|
||||
lease_token: input.lease_token,
|
||||
error_message: input.error_message,
|
||||
retry_after_micros: input.retry_after_micros,
|
||||
failed_at_micros: input.failed_at_micros,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn map_external_generation_job_procedure_result(
|
||||
result: ExternalGenerationJobProcedureResult,
|
||||
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
|
||||
if !result.ok {
|
||||
return Err(SpacetimeClientError::procedure_failed(result.error_message));
|
||||
}
|
||||
|
||||
let job = result
|
||||
.job
|
||||
.ok_or_else(|| SpacetimeClientError::missing_snapshot("external_generation_job 快照"))?;
|
||||
|
||||
Ok(map_external_generation_job_snapshot(job))
|
||||
}
|
||||
|
||||
pub(crate) fn map_external_generation_job_claim_result(
|
||||
result: ExternalGenerationJobProcedureResult,
|
||||
) -> Result<Vec<ExternalGenerationJobRecord>, SpacetimeClientError> {
|
||||
if !result.ok {
|
||||
return Err(SpacetimeClientError::procedure_failed(result.error_message));
|
||||
}
|
||||
|
||||
Ok(result
|
||||
.jobs
|
||||
.into_iter()
|
||||
.map(map_external_generation_job_snapshot)
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn map_external_generation_job_snapshot(
|
||||
snapshot: ExternalGenerationJobSnapshot,
|
||||
) -> ExternalGenerationJobRecord {
|
||||
ExternalGenerationJobRecord {
|
||||
job_id: snapshot.job_id,
|
||||
dedupe_key: snapshot.dedupe_key,
|
||||
job_kind: snapshot.job_kind,
|
||||
owner_user_id: snapshot.owner_user_id,
|
||||
source_module: snapshot.source_module,
|
||||
source_entity_id: snapshot.source_entity_id,
|
||||
request_label: snapshot.request_label,
|
||||
request_payload_json: snapshot.request_payload_json,
|
||||
status: snapshot.status,
|
||||
attempt: snapshot.attempt,
|
||||
max_attempts: snapshot.max_attempts,
|
||||
last_error_message: snapshot.last_error_message,
|
||||
worker_id: snapshot.worker_id,
|
||||
lease_expires_at: snapshot
|
||||
.lease_expires_at_micros
|
||||
.map(format_timestamp_micros),
|
||||
available_at: format_timestamp_micros(snapshot.available_at_micros),
|
||||
result_payload_json: snapshot.result_payload_json,
|
||||
created_at: format_timestamp_micros(snapshot.created_at_micros),
|
||||
started_at: snapshot.started_at_micros.map(format_timestamp_micros),
|
||||
completed_at: snapshot.completed_at_micros.map(format_timestamp_micros),
|
||||
updated_at: format_timestamp_micros(snapshot.updated_at_micros),
|
||||
lease_token: snapshot.lease_token,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct ExternalGenerationJobEnqueueRecordInput {
|
||||
pub job_id: String,
|
||||
pub dedupe_key: String,
|
||||
pub job_kind: String,
|
||||
pub owner_user_id: String,
|
||||
pub source_module: String,
|
||||
pub source_entity_id: String,
|
||||
pub request_label: String,
|
||||
pub request_payload_json: String,
|
||||
pub max_attempts: u32,
|
||||
pub available_at_micros: i64,
|
||||
pub created_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct ExternalGenerationJobClaimRecordInput {
|
||||
pub worker_id: String,
|
||||
pub limit: u32,
|
||||
pub lease_expires_at_micros: i64,
|
||||
pub claimed_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct ExternalGenerationJobCompleteRecordInput {
|
||||
pub job_id: String,
|
||||
pub worker_id: String,
|
||||
pub lease_token: String,
|
||||
pub result_payload_json: Option<String>,
|
||||
pub completed_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct ExternalGenerationJobRenewLeaseRecordInput {
|
||||
pub job_id: String,
|
||||
pub worker_id: String,
|
||||
pub lease_token: String,
|
||||
pub lease_expires_at_micros: i64,
|
||||
pub renewed_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct ExternalGenerationJobFailRecordInput {
|
||||
pub job_id: String,
|
||||
pub worker_id: String,
|
||||
pub lease_token: String,
|
||||
pub error_message: String,
|
||||
pub retry_after_micros: i64,
|
||||
pub failed_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct ExternalGenerationJobRecord {
|
||||
pub job_id: String,
|
||||
pub dedupe_key: String,
|
||||
pub job_kind: String,
|
||||
pub owner_user_id: String,
|
||||
pub source_module: String,
|
||||
pub source_entity_id: String,
|
||||
pub request_label: String,
|
||||
pub request_payload_json: String,
|
||||
pub status: String,
|
||||
pub attempt: u32,
|
||||
pub max_attempts: u32,
|
||||
pub last_error_message: Option<String>,
|
||||
pub worker_id: Option<String>,
|
||||
pub lease_expires_at: Option<String>,
|
||||
pub available_at: String,
|
||||
pub result_payload_json: Option<String>,
|
||||
pub created_at: String,
|
||||
pub started_at: Option<String>,
|
||||
pub completed_at: Option<String>,
|
||||
pub updated_at: String,
|
||||
pub lease_token: Option<String>,
|
||||
}
|
||||
@@ -642,6 +642,22 @@ pub struct PuzzleDraftCompileFailureRecordInput {
|
||||
pub owner_user_id: String,
|
||||
pub error_message: String,
|
||||
pub failed_at_micros: i64,
|
||||
pub external_generation_job_id: String,
|
||||
pub external_generation_worker_id: String,
|
||||
pub external_generation_lease_token: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PuzzleLevelGenerationFailureRecordInput {
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub level_id: Option<String>,
|
||||
pub levels_json: Option<String>,
|
||||
pub error_message: String,
|
||||
pub failed_at_micros: i64,
|
||||
pub external_generation_job_id: String,
|
||||
pub external_generation_worker_id: String,
|
||||
pub external_generation_lease_token: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -652,6 +668,9 @@ pub struct PuzzleGeneratedImagesSaveRecordInput {
|
||||
pub levels_json: Option<String>,
|
||||
pub candidates_json: String,
|
||||
pub saved_at_micros: i64,
|
||||
pub external_generation_job_id: String,
|
||||
pub external_generation_worker_id: String,
|
||||
pub external_generation_lease_token: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -664,6 +683,9 @@ pub struct PuzzleUiBackgroundSaveRecordInput {
|
||||
pub image_src: String,
|
||||
pub image_object_key: Option<String>,
|
||||
pub saved_at_micros: i64,
|
||||
pub external_generation_job_id: String,
|
||||
pub external_generation_worker_id: String,
|
||||
pub external_generation_lease_token: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
|
||||
@@ -201,6 +201,7 @@ pub mod chapter_progression_snapshot_type;
|
||||
pub mod chapter_progression_table;
|
||||
pub mod chapter_progression_type;
|
||||
pub mod checkpoint_wooden_fish_run_procedure;
|
||||
pub mod claim_external_generation_jobs_and_return_procedure;
|
||||
pub mod claim_profile_task_reward_and_return_procedure;
|
||||
pub mod claim_puzzle_work_point_incentive_procedure;
|
||||
pub mod clear_database_migration_import_chunks_procedure;
|
||||
@@ -217,6 +218,7 @@ pub mod compile_visual_novel_work_profile_procedure;
|
||||
pub mod compile_wooden_fish_draft_procedure;
|
||||
pub mod complete_ai_stage_and_return_procedure;
|
||||
pub mod complete_ai_task_and_return_procedure;
|
||||
pub mod complete_external_generation_job_and_return_procedure;
|
||||
pub mod confirm_asset_object_and_return_procedure;
|
||||
pub mod confirm_asset_object_reducer;
|
||||
pub mod consume_inventory_item_input_type;
|
||||
@@ -335,12 +337,23 @@ pub mod delete_square_hole_work_procedure;
|
||||
pub mod delete_visual_novel_work_procedure;
|
||||
pub mod drag_puzzle_piece_or_group_procedure;
|
||||
pub mod drop_square_hole_shape_procedure;
|
||||
pub mod enqueue_external_generation_job_and_return_procedure;
|
||||
pub mod ensure_analytics_date_dimension_for_date_reducer;
|
||||
pub mod equip_inventory_item_input_type;
|
||||
pub mod execute_custom_world_agent_action_procedure;
|
||||
pub mod export_auth_store_snapshot_from_tables_procedure;
|
||||
pub mod export_database_migration_to_file_procedure;
|
||||
pub mod external_generation_job_claim_input_type;
|
||||
pub mod external_generation_job_complete_input_type;
|
||||
pub mod external_generation_job_enqueue_input_type;
|
||||
pub mod external_generation_job_fail_input_type;
|
||||
pub mod external_generation_job_procedure_result_type;
|
||||
pub mod external_generation_job_renew_lease_input_type;
|
||||
pub mod external_generation_job_snapshot_type;
|
||||
pub mod external_generation_job_table;
|
||||
pub mod external_generation_job_type;
|
||||
pub mod fail_ai_task_and_return_procedure;
|
||||
pub mod fail_external_generation_job_and_return_procedure;
|
||||
pub mod finalize_big_fish_agent_message_turn_procedure;
|
||||
pub mod finalize_custom_world_agent_message_turn_procedure;
|
||||
pub mod finalize_match_3_d_agent_message_turn_procedure;
|
||||
@@ -475,6 +488,7 @@ pub mod list_visual_novel_works_procedure;
|
||||
pub mod list_wooden_fish_works_procedure;
|
||||
pub mod mark_profile_recharge_order_paid_and_return_procedure;
|
||||
pub mod mark_puzzle_draft_generation_failed_procedure;
|
||||
pub mod mark_puzzle_level_generation_failed_procedure;
|
||||
pub mod match_3_d_agent_message_finalize_input_type;
|
||||
pub mod match_3_d_agent_message_row_type;
|
||||
pub mod match_3_d_agent_message_snapshot_type;
|
||||
@@ -625,6 +639,7 @@ pub mod puzzle_leaderboard_entry_row_type;
|
||||
pub mod puzzle_leaderboard_entry_table;
|
||||
pub mod puzzle_leaderboard_entry_type;
|
||||
pub mod puzzle_leaderboard_submit_input_type;
|
||||
pub mod puzzle_level_generation_failure_input_type;
|
||||
pub mod puzzle_merged_group_state_type;
|
||||
pub mod puzzle_piece_state_type;
|
||||
pub mod puzzle_publication_status_type;
|
||||
@@ -708,6 +723,7 @@ pub mod refund_profile_wallet_points_and_return_procedure;
|
||||
pub mod remix_big_fish_work_procedure;
|
||||
pub mod remix_custom_world_profile_procedure;
|
||||
pub mod remix_puzzle_work_procedure;
|
||||
pub mod renew_external_generation_job_lease_and_return_procedure;
|
||||
pub mod resolve_combat_action_and_return_procedure;
|
||||
pub mod resolve_combat_action_input_type;
|
||||
pub mod resolve_combat_action_procedure_result_type;
|
||||
@@ -1242,6 +1258,7 @@ pub use chapter_progression_snapshot_type::ChapterProgressionSnapshot;
|
||||
pub use chapter_progression_table::*;
|
||||
pub use chapter_progression_type::ChapterProgression;
|
||||
pub use checkpoint_wooden_fish_run_procedure::checkpoint_wooden_fish_run;
|
||||
pub use claim_external_generation_jobs_and_return_procedure::claim_external_generation_jobs_and_return;
|
||||
pub use claim_profile_task_reward_and_return_procedure::claim_profile_task_reward_and_return;
|
||||
pub use claim_puzzle_work_point_incentive_procedure::claim_puzzle_work_point_incentive;
|
||||
pub use clear_database_migration_import_chunks_procedure::clear_database_migration_import_chunks;
|
||||
@@ -1258,6 +1275,7 @@ pub use compile_visual_novel_work_profile_procedure::compile_visual_novel_work_p
|
||||
pub use compile_wooden_fish_draft_procedure::compile_wooden_fish_draft;
|
||||
pub use complete_ai_stage_and_return_procedure::complete_ai_stage_and_return;
|
||||
pub use complete_ai_task_and_return_procedure::complete_ai_task_and_return;
|
||||
pub use complete_external_generation_job_and_return_procedure::complete_external_generation_job_and_return;
|
||||
pub use confirm_asset_object_and_return_procedure::confirm_asset_object_and_return;
|
||||
pub use confirm_asset_object_reducer::confirm_asset_object;
|
||||
pub use consume_inventory_item_input_type::ConsumeInventoryItemInput;
|
||||
@@ -1376,12 +1394,23 @@ pub use delete_square_hole_work_procedure::delete_square_hole_work;
|
||||
pub use delete_visual_novel_work_procedure::delete_visual_novel_work;
|
||||
pub use drag_puzzle_piece_or_group_procedure::drag_puzzle_piece_or_group;
|
||||
pub use drop_square_hole_shape_procedure::drop_square_hole_shape;
|
||||
pub use enqueue_external_generation_job_and_return_procedure::enqueue_external_generation_job_and_return;
|
||||
pub use ensure_analytics_date_dimension_for_date_reducer::ensure_analytics_date_dimension_for_date;
|
||||
pub use equip_inventory_item_input_type::EquipInventoryItemInput;
|
||||
pub use execute_custom_world_agent_action_procedure::execute_custom_world_agent_action;
|
||||
pub use export_auth_store_snapshot_from_tables_procedure::export_auth_store_snapshot_from_tables;
|
||||
pub use export_database_migration_to_file_procedure::export_database_migration_to_file;
|
||||
pub use external_generation_job_claim_input_type::ExternalGenerationJobClaimInput;
|
||||
pub use external_generation_job_complete_input_type::ExternalGenerationJobCompleteInput;
|
||||
pub use external_generation_job_enqueue_input_type::ExternalGenerationJobEnqueueInput;
|
||||
pub use external_generation_job_fail_input_type::ExternalGenerationJobFailInput;
|
||||
pub use external_generation_job_procedure_result_type::ExternalGenerationJobProcedureResult;
|
||||
pub use external_generation_job_renew_lease_input_type::ExternalGenerationJobRenewLeaseInput;
|
||||
pub use external_generation_job_snapshot_type::ExternalGenerationJobSnapshot;
|
||||
pub use external_generation_job_table::*;
|
||||
pub use external_generation_job_type::ExternalGenerationJob;
|
||||
pub use fail_ai_task_and_return_procedure::fail_ai_task_and_return;
|
||||
pub use fail_external_generation_job_and_return_procedure::fail_external_generation_job_and_return;
|
||||
pub use finalize_big_fish_agent_message_turn_procedure::finalize_big_fish_agent_message_turn;
|
||||
pub use finalize_custom_world_agent_message_turn_procedure::finalize_custom_world_agent_message_turn;
|
||||
pub use finalize_match_3_d_agent_message_turn_procedure::finalize_match_3_d_agent_message_turn;
|
||||
@@ -1516,6 +1545,7 @@ pub use list_visual_novel_works_procedure::list_visual_novel_works;
|
||||
pub use list_wooden_fish_works_procedure::list_wooden_fish_works;
|
||||
pub use mark_profile_recharge_order_paid_and_return_procedure::mark_profile_recharge_order_paid_and_return;
|
||||
pub use mark_puzzle_draft_generation_failed_procedure::mark_puzzle_draft_generation_failed;
|
||||
pub use mark_puzzle_level_generation_failed_procedure::mark_puzzle_level_generation_failed;
|
||||
pub use match_3_d_agent_message_finalize_input_type::Match3DAgentMessageFinalizeInput;
|
||||
pub use match_3_d_agent_message_row_type::Match3DAgentMessageRow;
|
||||
pub use match_3_d_agent_message_snapshot_type::Match3DAgentMessageSnapshot;
|
||||
@@ -1666,6 +1696,7 @@ pub use puzzle_leaderboard_entry_row_type::PuzzleLeaderboardEntryRow;
|
||||
pub use puzzle_leaderboard_entry_table::*;
|
||||
pub use puzzle_leaderboard_entry_type::PuzzleLeaderboardEntry;
|
||||
pub use puzzle_leaderboard_submit_input_type::PuzzleLeaderboardSubmitInput;
|
||||
pub use puzzle_level_generation_failure_input_type::PuzzleLevelGenerationFailureInput;
|
||||
pub use puzzle_merged_group_state_type::PuzzleMergedGroupState;
|
||||
pub use puzzle_piece_state_type::PuzzlePieceState;
|
||||
pub use puzzle_publication_status_type::PuzzlePublicationStatus;
|
||||
@@ -1749,6 +1780,7 @@ pub use refund_profile_wallet_points_and_return_procedure::refund_profile_wallet
|
||||
pub use remix_big_fish_work_procedure::remix_big_fish_work;
|
||||
pub use remix_custom_world_profile_procedure::remix_custom_world_profile;
|
||||
pub use remix_puzzle_work_procedure::remix_puzzle_work;
|
||||
pub use renew_external_generation_job_lease_and_return_procedure::renew_external_generation_job_lease_and_return;
|
||||
pub use resolve_combat_action_and_return_procedure::resolve_combat_action_and_return;
|
||||
pub use resolve_combat_action_input_type::ResolveCombatActionInput;
|
||||
pub use resolve_combat_action_procedure_result_type::ResolveCombatActionProcedureResult;
|
||||
@@ -2399,6 +2431,7 @@ pub struct DbUpdate {
|
||||
custom_world_session: __sdk::TableUpdate<CustomWorldSession>,
|
||||
database_migration_import_chunk: __sdk::TableUpdate<DatabaseMigrationImportChunk>,
|
||||
database_migration_operator: __sdk::TableUpdate<DatabaseMigrationOperator>,
|
||||
external_generation_job: __sdk::TableUpdate<ExternalGenerationJob>,
|
||||
inventory_slot: __sdk::TableUpdate<InventorySlot>,
|
||||
jump_hop_agent_session: __sdk::TableUpdate<JumpHopAgentSessionRow>,
|
||||
jump_hop_event: __sdk::TableUpdate<JumpHopEventRow>,
|
||||
@@ -2603,6 +2636,9 @@ impl TryFrom<__ws::v2::TransactionUpdate> for DbUpdate {
|
||||
"database_migration_operator" => db_update.database_migration_operator.append(
|
||||
database_migration_operator_table::parse_table_update(table_update)?,
|
||||
),
|
||||
"external_generation_job" => db_update.external_generation_job.append(
|
||||
external_generation_job_table::parse_table_update(table_update)?,
|
||||
),
|
||||
"inventory_slot" => db_update
|
||||
.inventory_slot
|
||||
.append(inventory_slot_table::parse_table_update(table_update)?),
|
||||
@@ -3035,6 +3071,12 @@ impl __sdk::DbUpdate for DbUpdate {
|
||||
&self.database_migration_operator,
|
||||
)
|
||||
.with_updates_by_pk(|row| &row.operator_identity);
|
||||
diff.external_generation_job = cache
|
||||
.apply_diff_to_table::<ExternalGenerationJob>(
|
||||
"external_generation_job",
|
||||
&self.external_generation_job,
|
||||
)
|
||||
.with_updates_by_pk(|row| &row.job_id);
|
||||
diff.inventory_slot = cache
|
||||
.apply_diff_to_table::<InventorySlot>("inventory_slot", &self.inventory_slot)
|
||||
.with_updates_by_pk(|row| &row.slot_id);
|
||||
@@ -3517,6 +3559,9 @@ impl __sdk::DbUpdate for DbUpdate {
|
||||
"database_migration_operator" => db_update
|
||||
.database_migration_operator
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"external_generation_job" => db_update
|
||||
.external_generation_job
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"inventory_slot" => db_update
|
||||
.inventory_slot
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
@@ -3860,6 +3905,9 @@ impl __sdk::DbUpdate for DbUpdate {
|
||||
"database_migration_operator" => db_update
|
||||
.database_migration_operator
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"external_generation_job" => db_update
|
||||
.external_generation_job
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"inventory_slot" => db_update
|
||||
.inventory_slot
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
@@ -4129,6 +4177,7 @@ pub struct AppliedDiff<'r> {
|
||||
custom_world_session: __sdk::TableAppliedDiff<'r, CustomWorldSession>,
|
||||
database_migration_import_chunk: __sdk::TableAppliedDiff<'r, DatabaseMigrationImportChunk>,
|
||||
database_migration_operator: __sdk::TableAppliedDiff<'r, DatabaseMigrationOperator>,
|
||||
external_generation_job: __sdk::TableAppliedDiff<'r, ExternalGenerationJob>,
|
||||
inventory_slot: __sdk::TableAppliedDiff<'r, InventorySlot>,
|
||||
jump_hop_agent_session: __sdk::TableAppliedDiff<'r, JumpHopAgentSessionRow>,
|
||||
jump_hop_event: __sdk::TableAppliedDiff<'r, JumpHopEventRow>,
|
||||
@@ -4401,6 +4450,11 @@ impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {
|
||||
&self.database_migration_operator,
|
||||
event,
|
||||
);
|
||||
callbacks.invoke_table_row_callbacks::<ExternalGenerationJob>(
|
||||
"external_generation_job",
|
||||
&self.external_generation_job,
|
||||
event,
|
||||
);
|
||||
callbacks.invoke_table_row_callbacks::<InventorySlot>(
|
||||
"inventory_slot",
|
||||
&self.inventory_slot,
|
||||
@@ -5443,6 +5497,7 @@ impl __sdk::SpacetimeModule for RemoteModule {
|
||||
custom_world_session_table::register_table(client_cache);
|
||||
database_migration_import_chunk_table::register_table(client_cache);
|
||||
database_migration_operator_table::register_table(client_cache);
|
||||
external_generation_job_table::register_table(client_cache);
|
||||
inventory_slot_table::register_table(client_cache);
|
||||
jump_hop_agent_session_table::register_table(client_cache);
|
||||
jump_hop_event_table::register_table(client_cache);
|
||||
@@ -5555,6 +5610,7 @@ impl __sdk::SpacetimeModule for RemoteModule {
|
||||
"custom_world_session",
|
||||
"database_migration_import_chunk",
|
||||
"database_migration_operator",
|
||||
"external_generation_job",
|
||||
"inventory_slot",
|
||||
"jump_hop_agent_session",
|
||||
"jump_hop_event",
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::external_generation_job_claim_input_type::ExternalGenerationJobClaimInput;
|
||||
use super::external_generation_job_procedure_result_type::ExternalGenerationJobProcedureResult;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct ClaimExternalGenerationJobsAndReturnArgs {
|
||||
pub input: ExternalGenerationJobClaimInput,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ClaimExternalGenerationJobsAndReturnArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the procedure `claim_external_generation_jobs_and_return`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait claim_external_generation_jobs_and_return {
|
||||
fn claim_external_generation_jobs_and_return(&self, input: ExternalGenerationJobClaimInput) {
|
||||
self.claim_external_generation_jobs_and_return_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn claim_external_generation_jobs_and_return_then(
|
||||
&self,
|
||||
input: ExternalGenerationJobClaimInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
impl claim_external_generation_jobs_and_return for super::RemoteProcedures {
|
||||
fn claim_external_generation_jobs_and_return_then(
|
||||
&self,
|
||||
input: ExternalGenerationJobClaimInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, ExternalGenerationJobProcedureResult>(
|
||||
"claim_external_generation_jobs_and_return",
|
||||
ClaimExternalGenerationJobsAndReturnArgs { input },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::external_generation_job_complete_input_type::ExternalGenerationJobCompleteInput;
|
||||
use super::external_generation_job_procedure_result_type::ExternalGenerationJobProcedureResult;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct CompleteExternalGenerationJobAndReturnArgs {
|
||||
pub input: ExternalGenerationJobCompleteInput,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for CompleteExternalGenerationJobAndReturnArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the procedure `complete_external_generation_job_and_return`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait complete_external_generation_job_and_return {
|
||||
fn complete_external_generation_job_and_return(
|
||||
&self,
|
||||
input: ExternalGenerationJobCompleteInput,
|
||||
) {
|
||||
self.complete_external_generation_job_and_return_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn complete_external_generation_job_and_return_then(
|
||||
&self,
|
||||
input: ExternalGenerationJobCompleteInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
impl complete_external_generation_job_and_return for super::RemoteProcedures {
|
||||
fn complete_external_generation_job_and_return_then(
|
||||
&self,
|
||||
input: ExternalGenerationJobCompleteInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, ExternalGenerationJobProcedureResult>(
|
||||
"complete_external_generation_job_and_return",
|
||||
CompleteExternalGenerationJobAndReturnArgs { input },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::external_generation_job_enqueue_input_type::ExternalGenerationJobEnqueueInput;
|
||||
use super::external_generation_job_procedure_result_type::ExternalGenerationJobProcedureResult;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct EnqueueExternalGenerationJobAndReturnArgs {
|
||||
pub input: ExternalGenerationJobEnqueueInput,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for EnqueueExternalGenerationJobAndReturnArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the procedure `enqueue_external_generation_job_and_return`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait enqueue_external_generation_job_and_return {
|
||||
fn enqueue_external_generation_job_and_return(&self, input: ExternalGenerationJobEnqueueInput) {
|
||||
self.enqueue_external_generation_job_and_return_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn enqueue_external_generation_job_and_return_then(
|
||||
&self,
|
||||
input: ExternalGenerationJobEnqueueInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
impl enqueue_external_generation_job_and_return for super::RemoteProcedures {
|
||||
fn enqueue_external_generation_job_and_return_then(
|
||||
&self,
|
||||
input: ExternalGenerationJobEnqueueInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, ExternalGenerationJobProcedureResult>(
|
||||
"enqueue_external_generation_job_and_return",
|
||||
EnqueueExternalGenerationJobAndReturnArgs { input },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct ExternalGenerationJobClaimInput {
|
||||
pub worker_id: String,
|
||||
pub limit: u32,
|
||||
pub lease_expires_at_micros: i64,
|
||||
pub claimed_at_micros: i64,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ExternalGenerationJobClaimInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct ExternalGenerationJobCompleteInput {
|
||||
pub job_id: String,
|
||||
pub worker_id: String,
|
||||
pub lease_token: String,
|
||||
pub result_payload_json: Option<String>,
|
||||
pub completed_at_micros: i64,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ExternalGenerationJobCompleteInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct ExternalGenerationJobEnqueueInput {
|
||||
pub job_id: String,
|
||||
pub dedupe_key: String,
|
||||
pub job_kind: String,
|
||||
pub owner_user_id: String,
|
||||
pub source_module: String,
|
||||
pub source_entity_id: String,
|
||||
pub request_label: String,
|
||||
pub request_payload_json: String,
|
||||
pub max_attempts: u32,
|
||||
pub available_at_micros: i64,
|
||||
pub created_at_micros: i64,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ExternalGenerationJobEnqueueInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct ExternalGenerationJobFailInput {
|
||||
pub job_id: String,
|
||||
pub worker_id: String,
|
||||
pub lease_token: String,
|
||||
pub error_message: String,
|
||||
pub retry_after_micros: i64,
|
||||
pub failed_at_micros: i64,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ExternalGenerationJobFailInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::external_generation_job_snapshot_type::ExternalGenerationJobSnapshot;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct ExternalGenerationJobProcedureResult {
|
||||
pub ok: bool,
|
||||
pub job: Option<ExternalGenerationJobSnapshot>,
|
||||
pub jobs: Vec<ExternalGenerationJobSnapshot>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ExternalGenerationJobProcedureResult {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct ExternalGenerationJobRenewLeaseInput {
|
||||
pub job_id: String,
|
||||
pub worker_id: String,
|
||||
pub lease_token: String,
|
||||
pub lease_expires_at_micros: i64,
|
||||
pub renewed_at_micros: i64,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ExternalGenerationJobRenewLeaseInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct ExternalGenerationJobSnapshot {
|
||||
pub job_id: String,
|
||||
pub dedupe_key: String,
|
||||
pub job_kind: String,
|
||||
pub owner_user_id: String,
|
||||
pub source_module: String,
|
||||
pub source_entity_id: String,
|
||||
pub request_label: String,
|
||||
pub request_payload_json: String,
|
||||
pub status: String,
|
||||
pub attempt: u32,
|
||||
pub max_attempts: u32,
|
||||
pub last_error_message: Option<String>,
|
||||
pub worker_id: Option<String>,
|
||||
pub lease_expires_at_micros: Option<i64>,
|
||||
pub available_at_micros: i64,
|
||||
pub result_payload_json: Option<String>,
|
||||
pub created_at_micros: i64,
|
||||
pub started_at_micros: Option<i64>,
|
||||
pub completed_at_micros: Option<i64>,
|
||||
pub updated_at_micros: i64,
|
||||
pub lease_token: Option<String>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ExternalGenerationJobSnapshot {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use super::external_generation_job_type::ExternalGenerationJob;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `external_generation_job`.
|
||||
///
|
||||
/// Obtain a handle from the [`ExternalGenerationJobTableAccess::external_generation_job`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.external_generation_job()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.external_generation_job().on_insert(...)`.
|
||||
pub struct ExternalGenerationJobTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<ExternalGenerationJob>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `external_generation_job`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait ExternalGenerationJobTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`ExternalGenerationJobTableHandle`], which mediates access to the table `external_generation_job`.
|
||||
fn external_generation_job(&self) -> ExternalGenerationJobTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl ExternalGenerationJobTableAccess for super::RemoteTables {
|
||||
fn external_generation_job(&self) -> ExternalGenerationJobTableHandle<'_> {
|
||||
ExternalGenerationJobTableHandle {
|
||||
imp: self
|
||||
.imp
|
||||
.get_table::<ExternalGenerationJob>("external_generation_job"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ExternalGenerationJobInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct ExternalGenerationJobDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for ExternalGenerationJobTableHandle<'ctx> {
|
||||
type Row = ExternalGenerationJob;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = ExternalGenerationJob> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = ExternalGenerationJobInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> ExternalGenerationJobInsertCallbackId {
|
||||
ExternalGenerationJobInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: ExternalGenerationJobInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = ExternalGenerationJobDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> ExternalGenerationJobDeleteCallbackId {
|
||||
ExternalGenerationJobDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: ExternalGenerationJobDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ExternalGenerationJobUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for ExternalGenerationJobTableHandle<'ctx> {
|
||||
type UpdateCallbackId = ExternalGenerationJobUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> ExternalGenerationJobUpdateCallbackId {
|
||||
ExternalGenerationJobUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: ExternalGenerationJobUpdateCallbackId) {
|
||||
self.imp.remove_on_update(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `job_id` unique index on the table `external_generation_job`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`ExternalGenerationJobJobIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.external_generation_job().job_id().find(...)`.
|
||||
pub struct ExternalGenerationJobJobIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<ExternalGenerationJob, String>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> ExternalGenerationJobTableHandle<'ctx> {
|
||||
/// Get a handle on the `job_id` unique index on the table `external_generation_job`.
|
||||
pub fn job_id(&self) -> ExternalGenerationJobJobIdUnique<'ctx> {
|
||||
ExternalGenerationJobJobIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<String>("job_id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> ExternalGenerationJobJobIdUnique<'ctx> {
|
||||
/// Find the subscribed row whose `job_id` column value is equal to `col_val`,
|
||||
/// if such a row is present in the client cache.
|
||||
pub fn find(&self, col_val: &String) -> Option<ExternalGenerationJob> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `dedupe_key` unique index on the table `external_generation_job`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`ExternalGenerationJobDedupeKeyUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.external_generation_job().dedupe_key().find(...)`.
|
||||
pub struct ExternalGenerationJobDedupeKeyUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<ExternalGenerationJob, String>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> ExternalGenerationJobTableHandle<'ctx> {
|
||||
/// Get a handle on the `dedupe_key` unique index on the table `external_generation_job`.
|
||||
pub fn dedupe_key(&self) -> ExternalGenerationJobDedupeKeyUnique<'ctx> {
|
||||
ExternalGenerationJobDedupeKeyUnique {
|
||||
imp: self.imp.get_unique_constraint::<String>("dedupe_key"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> ExternalGenerationJobDedupeKeyUnique<'ctx> {
|
||||
/// Find the subscribed row whose `dedupe_key` column value is equal to `col_val`,
|
||||
/// if such a row is present in the client cache.
|
||||
pub fn find(&self, col_val: &String) -> Option<ExternalGenerationJob> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache.get_or_make_table::<ExternalGenerationJob>("external_generation_job");
|
||||
_table.add_unique_constraint::<String>("job_id", |row| &row.job_id);
|
||||
_table.add_unique_constraint::<String>("dedupe_key", |row| &row.dedupe_key);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<ExternalGenerationJob>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse("TableUpdate<ExternalGenerationJob>", "TableUpdate")
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `ExternalGenerationJob`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait external_generation_jobQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `ExternalGenerationJob`.
|
||||
fn external_generation_job(&self) -> __sdk::__query_builder::Table<ExternalGenerationJob>;
|
||||
}
|
||||
|
||||
impl external_generation_jobQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn external_generation_job(&self) -> __sdk::__query_builder::Table<ExternalGenerationJob> {
|
||||
__sdk::__query_builder::Table::new("external_generation_job")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct ExternalGenerationJob {
|
||||
pub job_id: String,
|
||||
pub dedupe_key: String,
|
||||
pub job_kind: String,
|
||||
pub owner_user_id: String,
|
||||
pub source_module: String,
|
||||
pub source_entity_id: String,
|
||||
pub request_label: String,
|
||||
pub request_payload_json: String,
|
||||
pub status: String,
|
||||
pub attempt: u32,
|
||||
pub max_attempts: u32,
|
||||
pub last_error_message: Option<String>,
|
||||
pub worker_id: Option<String>,
|
||||
pub lease_expires_at: Option<__sdk::Timestamp>,
|
||||
pub available_at: __sdk::Timestamp,
|
||||
pub result_payload_json: Option<String>,
|
||||
pub created_at: __sdk::Timestamp,
|
||||
pub started_at: Option<__sdk::Timestamp>,
|
||||
pub completed_at: Option<__sdk::Timestamp>,
|
||||
pub updated_at: __sdk::Timestamp,
|
||||
pub lease_token: Option<String>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ExternalGenerationJob {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `ExternalGenerationJob`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct ExternalGenerationJobCols {
|
||||
pub job_id: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
|
||||
pub dedupe_key: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
|
||||
pub job_kind: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
|
||||
pub owner_user_id: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
|
||||
pub source_module: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
|
||||
pub source_entity_id: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
|
||||
pub request_label: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
|
||||
pub request_payload_json: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
|
||||
pub status: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
|
||||
pub attempt: __sdk::__query_builder::Col<ExternalGenerationJob, u32>,
|
||||
pub max_attempts: __sdk::__query_builder::Col<ExternalGenerationJob, u32>,
|
||||
pub last_error_message: __sdk::__query_builder::Col<ExternalGenerationJob, Option<String>>,
|
||||
pub worker_id: __sdk::__query_builder::Col<ExternalGenerationJob, Option<String>>,
|
||||
pub lease_expires_at:
|
||||
__sdk::__query_builder::Col<ExternalGenerationJob, Option<__sdk::Timestamp>>,
|
||||
pub available_at: __sdk::__query_builder::Col<ExternalGenerationJob, __sdk::Timestamp>,
|
||||
pub result_payload_json: __sdk::__query_builder::Col<ExternalGenerationJob, Option<String>>,
|
||||
pub created_at: __sdk::__query_builder::Col<ExternalGenerationJob, __sdk::Timestamp>,
|
||||
pub started_at: __sdk::__query_builder::Col<ExternalGenerationJob, Option<__sdk::Timestamp>>,
|
||||
pub completed_at: __sdk::__query_builder::Col<ExternalGenerationJob, Option<__sdk::Timestamp>>,
|
||||
pub updated_at: __sdk::__query_builder::Col<ExternalGenerationJob, __sdk::Timestamp>,
|
||||
pub lease_token: __sdk::__query_builder::Col<ExternalGenerationJob, Option<String>>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for ExternalGenerationJob {
|
||||
type Cols = ExternalGenerationJobCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
ExternalGenerationJobCols {
|
||||
job_id: __sdk::__query_builder::Col::new(table_name, "job_id"),
|
||||
dedupe_key: __sdk::__query_builder::Col::new(table_name, "dedupe_key"),
|
||||
job_kind: __sdk::__query_builder::Col::new(table_name, "job_kind"),
|
||||
owner_user_id: __sdk::__query_builder::Col::new(table_name, "owner_user_id"),
|
||||
source_module: __sdk::__query_builder::Col::new(table_name, "source_module"),
|
||||
source_entity_id: __sdk::__query_builder::Col::new(table_name, "source_entity_id"),
|
||||
request_label: __sdk::__query_builder::Col::new(table_name, "request_label"),
|
||||
request_payload_json: __sdk::__query_builder::Col::new(
|
||||
table_name,
|
||||
"request_payload_json",
|
||||
),
|
||||
status: __sdk::__query_builder::Col::new(table_name, "status"),
|
||||
attempt: __sdk::__query_builder::Col::new(table_name, "attempt"),
|
||||
max_attempts: __sdk::__query_builder::Col::new(table_name, "max_attempts"),
|
||||
last_error_message: __sdk::__query_builder::Col::new(table_name, "last_error_message"),
|
||||
worker_id: __sdk::__query_builder::Col::new(table_name, "worker_id"),
|
||||
lease_expires_at: __sdk::__query_builder::Col::new(table_name, "lease_expires_at"),
|
||||
available_at: __sdk::__query_builder::Col::new(table_name, "available_at"),
|
||||
result_payload_json: __sdk::__query_builder::Col::new(
|
||||
table_name,
|
||||
"result_payload_json",
|
||||
),
|
||||
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
|
||||
started_at: __sdk::__query_builder::Col::new(table_name, "started_at"),
|
||||
completed_at: __sdk::__query_builder::Col::new(table_name, "completed_at"),
|
||||
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
|
||||
lease_token: __sdk::__query_builder::Col::new(table_name, "lease_token"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `ExternalGenerationJob`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct ExternalGenerationJobIxCols {
|
||||
pub dedupe_key: __sdk::__query_builder::IxCol<ExternalGenerationJob, String>,
|
||||
pub job_id: __sdk::__query_builder::IxCol<ExternalGenerationJob, String>,
|
||||
pub owner_user_id: __sdk::__query_builder::IxCol<ExternalGenerationJob, String>,
|
||||
pub worker_id: __sdk::__query_builder::IxCol<ExternalGenerationJob, Option<String>>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for ExternalGenerationJob {
|
||||
type IxCols = ExternalGenerationJobIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
ExternalGenerationJobIxCols {
|
||||
dedupe_key: __sdk::__query_builder::IxCol::new(table_name, "dedupe_key"),
|
||||
job_id: __sdk::__query_builder::IxCol::new(table_name, "job_id"),
|
||||
owner_user_id: __sdk::__query_builder::IxCol::new(table_name, "owner_user_id"),
|
||||
worker_id: __sdk::__query_builder::IxCol::new(table_name, "worker_id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for ExternalGenerationJob {}
|
||||
@@ -0,0 +1,59 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::external_generation_job_fail_input_type::ExternalGenerationJobFailInput;
|
||||
use super::external_generation_job_procedure_result_type::ExternalGenerationJobProcedureResult;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct FailExternalGenerationJobAndReturnArgs {
|
||||
pub input: ExternalGenerationJobFailInput,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for FailExternalGenerationJobAndReturnArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the procedure `fail_external_generation_job_and_return`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait fail_external_generation_job_and_return {
|
||||
fn fail_external_generation_job_and_return(&self, input: ExternalGenerationJobFailInput) {
|
||||
self.fail_external_generation_job_and_return_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn fail_external_generation_job_and_return_then(
|
||||
&self,
|
||||
input: ExternalGenerationJobFailInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
impl fail_external_generation_job_and_return for super::RemoteProcedures {
|
||||
fn fail_external_generation_job_and_return_then(
|
||||
&self,
|
||||
input: ExternalGenerationJobFailInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, ExternalGenerationJobProcedureResult>(
|
||||
"fail_external_generation_job_and_return",
|
||||
FailExternalGenerationJobAndReturnArgs { input },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::puzzle_agent_session_procedure_result_type::PuzzleAgentSessionProcedureResult;
|
||||
use super::puzzle_level_generation_failure_input_type::PuzzleLevelGenerationFailureInput;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct MarkPuzzleLevelGenerationFailedArgs {
|
||||
pub input: PuzzleLevelGenerationFailureInput,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for MarkPuzzleLevelGenerationFailedArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the procedure `mark_puzzle_level_generation_failed`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait mark_puzzle_level_generation_failed {
|
||||
fn mark_puzzle_level_generation_failed(&self, input: PuzzleLevelGenerationFailureInput) {
|
||||
self.mark_puzzle_level_generation_failed_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn mark_puzzle_level_generation_failed_then(
|
||||
&self,
|
||||
input: PuzzleLevelGenerationFailureInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<PuzzleAgentSessionProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
impl mark_puzzle_level_generation_failed for super::RemoteProcedures {
|
||||
fn mark_puzzle_level_generation_failed_then(
|
||||
&self,
|
||||
input: PuzzleLevelGenerationFailureInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<PuzzleAgentSessionProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, PuzzleAgentSessionProcedureResult>(
|
||||
"mark_puzzle_level_generation_failed",
|
||||
MarkPuzzleLevelGenerationFailedArgs { input },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@ pub struct PuzzleDraftCompileFailureInput {
|
||||
pub owner_user_id: String,
|
||||
pub error_message: String,
|
||||
pub failed_at_micros: i64,
|
||||
pub external_generation_job_id: String,
|
||||
pub external_generation_worker_id: String,
|
||||
pub external_generation_lease_token: String,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PuzzleDraftCompileFailureInput {
|
||||
|
||||
@@ -10,6 +10,9 @@ pub struct PuzzleDraftCompileInput {
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub compiled_at_micros: i64,
|
||||
pub external_generation_job_id: Option<String>,
|
||||
pub external_generation_worker_id: Option<String>,
|
||||
pub external_generation_lease_token: Option<String>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PuzzleDraftCompileInput {
|
||||
|
||||
@@ -13,6 +13,9 @@ pub struct PuzzleGeneratedImagesSaveInput {
|
||||
pub levels_json: Option<String>,
|
||||
pub candidates_json: String,
|
||||
pub saved_at_micros: i64,
|
||||
pub external_generation_job_id: String,
|
||||
pub external_generation_worker_id: String,
|
||||
pub external_generation_lease_token: String,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PuzzleGeneratedImagesSaveInput {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct PuzzleLevelGenerationFailureInput {
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub level_id: Option<String>,
|
||||
pub levels_json: Option<String>,
|
||||
pub error_message: String,
|
||||
pub failed_at_micros: i64,
|
||||
pub external_generation_job_id: String,
|
||||
pub external_generation_worker_id: String,
|
||||
pub external_generation_lease_token: String,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PuzzleLevelGenerationFailureInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -15,6 +15,9 @@ pub struct PuzzleUiBackgroundSaveInput {
|
||||
pub image_src: String,
|
||||
pub image_object_key: Option<String>,
|
||||
pub saved_at_micros: i64,
|
||||
pub external_generation_job_id: String,
|
||||
pub external_generation_worker_id: String,
|
||||
pub external_generation_lease_token: String,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PuzzleUiBackgroundSaveInput {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::external_generation_job_procedure_result_type::ExternalGenerationJobProcedureResult;
|
||||
use super::external_generation_job_renew_lease_input_type::ExternalGenerationJobRenewLeaseInput;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct RenewExternalGenerationJobLeaseAndReturnArgs {
|
||||
pub input: ExternalGenerationJobRenewLeaseInput,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for RenewExternalGenerationJobLeaseAndReturnArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the procedure `renew_external_generation_job_lease_and_return`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait renew_external_generation_job_lease_and_return {
|
||||
fn renew_external_generation_job_lease_and_return(
|
||||
&self,
|
||||
input: ExternalGenerationJobRenewLeaseInput,
|
||||
) {
|
||||
self.renew_external_generation_job_lease_and_return_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn renew_external_generation_job_lease_and_return_then(
|
||||
&self,
|
||||
input: ExternalGenerationJobRenewLeaseInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
impl renew_external_generation_job_lease_and_return for super::RemoteProcedures {
|
||||
fn renew_external_generation_job_lease_and_return_then(
|
||||
&self,
|
||||
input: ExternalGenerationJobRenewLeaseInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, ExternalGenerationJobProcedureResult>(
|
||||
"renew_external_generation_job_lease_and_return",
|
||||
RenewExternalGenerationJobLeaseAndReturnArgs { input },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -147,10 +147,55 @@ impl SpacetimeClient {
|
||||
owner_user_id: String,
|
||||
compiled_at_micros: i64,
|
||||
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
|
||||
self.compile_puzzle_agent_draft_inner(session_id, owner_user_id, compiled_at_micros, None)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn compile_puzzle_agent_draft_with_external_generation_guard(
|
||||
&self,
|
||||
session_id: String,
|
||||
owner_user_id: String,
|
||||
compiled_at_micros: i64,
|
||||
external_generation_job_id: String,
|
||||
external_generation_worker_id: String,
|
||||
external_generation_lease_token: String,
|
||||
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
|
||||
self.compile_puzzle_agent_draft_inner(
|
||||
session_id,
|
||||
owner_user_id,
|
||||
compiled_at_micros,
|
||||
Some((
|
||||
external_generation_job_id,
|
||||
external_generation_worker_id,
|
||||
external_generation_lease_token,
|
||||
)),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn compile_puzzle_agent_draft_inner(
|
||||
&self,
|
||||
session_id: String,
|
||||
owner_user_id: String,
|
||||
compiled_at_micros: i64,
|
||||
external_generation_guard: Option<(String, String, String)>,
|
||||
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
|
||||
let (
|
||||
external_generation_job_id,
|
||||
external_generation_worker_id,
|
||||
external_generation_lease_token,
|
||||
) = external_generation_guard
|
||||
.map(|(job_id, worker_id, lease_token)| {
|
||||
(Some(job_id), Some(worker_id), Some(lease_token))
|
||||
})
|
||||
.unwrap_or((None, None, None));
|
||||
let procedure_input = PuzzleDraftCompileInput {
|
||||
session_id,
|
||||
owner_user_id,
|
||||
compiled_at_micros,
|
||||
external_generation_job_id,
|
||||
external_generation_worker_id,
|
||||
external_generation_lease_token,
|
||||
};
|
||||
|
||||
self.call_after_connect("compile_puzzle_agent_draft", move |connection, sender| {
|
||||
@@ -176,6 +221,9 @@ impl SpacetimeClient {
|
||||
owner_user_id: input.owner_user_id,
|
||||
error_message: input.error_message,
|
||||
failed_at_micros: input.failed_at_micros,
|
||||
external_generation_job_id: input.external_generation_job_id,
|
||||
external_generation_worker_id: input.external_generation_worker_id,
|
||||
external_generation_lease_token: input.external_generation_lease_token,
|
||||
};
|
||||
|
||||
self.call_after_connect(
|
||||
@@ -194,6 +242,38 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn mark_puzzle_level_generation_failed(
|
||||
&self,
|
||||
input: PuzzleLevelGenerationFailureRecordInput,
|
||||
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
|
||||
let procedure_input = PuzzleLevelGenerationFailureInput {
|
||||
session_id: input.session_id,
|
||||
owner_user_id: input.owner_user_id,
|
||||
level_id: input.level_id,
|
||||
levels_json: input.levels_json,
|
||||
error_message: input.error_message,
|
||||
failed_at_micros: input.failed_at_micros,
|
||||
external_generation_job_id: input.external_generation_job_id,
|
||||
external_generation_worker_id: input.external_generation_worker_id,
|
||||
external_generation_lease_token: input.external_generation_lease_token,
|
||||
};
|
||||
|
||||
self.call_after_connect(
|
||||
"mark_puzzle_level_generation_failed",
|
||||
move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.mark_puzzle_level_generation_failed_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_puzzle_agent_session_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
});
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn save_puzzle_generated_images(
|
||||
&self,
|
||||
input: PuzzleGeneratedImagesSaveRecordInput,
|
||||
@@ -205,6 +285,9 @@ impl SpacetimeClient {
|
||||
levels_json: input.levels_json,
|
||||
candidates_json: input.candidates_json,
|
||||
saved_at_micros: input.saved_at_micros,
|
||||
external_generation_job_id: input.external_generation_job_id,
|
||||
external_generation_worker_id: input.external_generation_worker_id,
|
||||
external_generation_lease_token: input.external_generation_lease_token,
|
||||
};
|
||||
|
||||
self.call_after_connect("save_puzzle_generated_images", move |connection, sender| {
|
||||
@@ -234,6 +317,9 @@ impl SpacetimeClient {
|
||||
image_src: input.image_src,
|
||||
image_object_key: input.image_object_key,
|
||||
saved_at_micros: input.saved_at_micros,
|
||||
external_generation_job_id: input.external_generation_job_id,
|
||||
external_generation_worker_id: input.external_generation_worker_id,
|
||||
external_generation_lease_token: input.external_generation_lease_token,
|
||||
};
|
||||
|
||||
self.call_after_connect("save_puzzle_ui_background", move |connection, sender| {
|
||||
|
||||
Reference in New Issue
Block a user