feat: workerize external generation
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user