Skip to content

Commit 90eb038

Browse files
ArgId
1 parent 3d7a395 commit 90eb038

File tree

9 files changed

+17
-6
lines changed

9 files changed

+17
-6
lines changed

crates/datastore/src/locking_tx_datastore/mut_tx.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use spacetimedb_lib::{
3939
ConnectionId, Identity,
4040
};
4141
use spacetimedb_primitives::{
42-
col_list, ColId, ColList, ColSet, ConstraintId, IndexId, ScheduleId, SequenceId, TableId, ViewId,
42+
col_list, ArgId, ColId, ColList, ColSet, ConstraintId, IndexId, ScheduleId, SequenceId, TableId, ViewId,
4343
};
4444
use spacetimedb_sats::{
4545
bsatn::{self, to_writer, DecodeError, Deserializer},
@@ -1796,7 +1796,7 @@ impl MutTxId {
17961796
}
17971797

17981798
/// Is anyone is subscribed to the view arguments identified by `arg_id`?
1799-
fn is_identity_subscribed_to_view_args(&self, view_id: ViewId, arg_id: u64, sender: Identity) -> Result<bool> {
1799+
fn is_identity_subscribed_to_view_args(&self, view_id: ViewId, arg_id: ArgId, sender: Identity) -> Result<bool> {
18001800
Ok(self
18011801
.iter_by_col_eq(
18021802
ST_VIEW_CLIENT_ID,
@@ -1828,7 +1828,7 @@ impl MutTxId {
18281828
}
18291829

18301830
/// Deletes the rows of a view subscribed to by `sender`.
1831-
fn delete_view_rows_for_identity(&mut self, view_id: ViewId, arg_id: u64, sender: Identity) -> Result<()> {
1831+
fn delete_view_rows_for_identity(&mut self, view_id: ViewId, arg_id: ArgId, sender: Identity) -> Result<()> {
18321832
if let Some((table_id, is_anonymous)) = self.get_table_id_for_view(view_id)? {
18331833
let value = if is_anonymous {
18341834
let none_sender = AlgebraicValue::OptionNone();

crates/datastore/src/system_tables.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ pub struct StViewParamRow {
932932
#[sats(crate = spacetimedb_lib)]
933933
pub struct StViewClientRow {
934934
pub view_id: ViewId,
935-
pub arg_id: u64,
935+
pub arg_id: ArgId,
936936
pub identity: IdentityViaU256,
937937
pub connection_id: ConnectionIdViaU128,
938938
}

crates/primitives/src/ids.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ system_id! {
8484
}
8585
auto_inc_system_id!(ViewId);
8686

87+
system_id! {
88+
/// An identifier for a list of arguments passed to a view.
89+
pub struct ArgId(pub u64);
90+
}
91+
auto_inc_system_id!(ArgId);
92+
8793
system_id! {
8894
/// An identifier for a sequence, unique within a database.
8995
pub struct SequenceId(pub u32);

crates/primitives/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod ids;
88
pub use attr::{AttributeKind, ColumnAttribute, ConstraintKind, Constraints};
99
pub use col_list::{ColList, ColOrCols, ColSet};
1010
pub use ids::{
11-
ColId, ConstraintId, FunctionId, IndexId, ProcedureId, ReducerId, ScheduleId, SequenceId, TableId, ViewId,
11+
ArgId, ColId, ConstraintId, FunctionId, IndexId, ProcedureId, ReducerId, ScheduleId, SequenceId, TableId, ViewId,
1212
};
1313

1414
/// The minimum size of a chunk yielded by a wasm abi RowIter.

crates/sats/src/convert.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::sum_value::SumTag;
22
use crate::{i256, u256};
33
use crate::{AlgebraicType, AlgebraicValue, ProductType, ProductValue};
4-
use spacetimedb_primitives::{ColId, ConstraintId, IndexId, ScheduleId, SequenceId, TableId, ViewId};
4+
use spacetimedb_primitives::{ArgId, ColId, ConstraintId, IndexId, ScheduleId, SequenceId, TableId, ViewId};
55

66
impl crate::Value for AlgebraicValue {
77
type Type = AlgebraicType;
@@ -63,6 +63,7 @@ macro_rules! system_id {
6363
}
6464
};
6565
}
66+
system_id!(ArgId);
6667
system_id!(TableId);
6768
system_id!(ViewId);
6869
system_id!(ColId);

crates/sats/src/de/impls.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ impl FieldNameVisitor<'_> for TupleNameVisitor<'_> {
741741
}
742742
}
743743

744+
impl_deserialize!([] spacetimedb_primitives::ArgId, de => u64::deserialize(de).map(Self));
744745
impl_deserialize!([] spacetimedb_primitives::TableId, de => u32::deserialize(de).map(Self));
745746
impl_deserialize!([] spacetimedb_primitives::ViewId, de => u32::deserialize(de).map(Self));
746747
impl_deserialize!([] spacetimedb_primitives::SequenceId, de => u32::deserialize(de).map(Self));

crates/sats/src/ser/impls.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ impl_serialize!([] ValueWithType<'_, ArrayValue>, (self, ser) => {
257257
}
258258
});
259259

260+
impl_serialize!([] spacetimedb_primitives::ArgId, (self, ser) => ser.serialize_u64(self.0));
260261
impl_serialize!([] spacetimedb_primitives::TableId, (self, ser) => ser.serialize_u32(self.0));
261262
impl_serialize!([] spacetimedb_primitives::ViewId, (self, ser) => ser.serialize_u32(self.0));
262263
impl_serialize!([] spacetimedb_primitives::SequenceId, (self, ser) => ser.serialize_u32(self.0));

crates/sats/src/typespace.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ impl_st!([T] Vec<T>, ts => <[T]>::make_type(ts));
410410
impl_st!([T, const N: usize] SmallVec<[T; N]>, ts => <[T]>::make_type(ts));
411411
impl_st!([T] Option<T>, ts => AlgebraicType::option(T::make_type(ts)));
412412

413+
impl_st!([] spacetimedb_primitives::ArgId, AlgebraicType::U64);
413414
impl_st!([] spacetimedb_primitives::ColId, AlgebraicType::U16);
414415
impl_st!([] spacetimedb_primitives::TableId, AlgebraicType::U32);
415416
impl_st!([] spacetimedb_primitives::ViewId, AlgebraicType::U32);

crates/table/src/read_column.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ macro_rules! impl_read_column_via_from {
325325
}
326326

327327
impl_read_column_via_from! {
328+
u64 => spacetimedb_primitives::ArgId;
328329
u16 => spacetimedb_primitives::ColId;
329330
u32 => spacetimedb_primitives::ViewId;
330331
u32 => spacetimedb_primitives::TableId;

0 commit comments

Comments
 (0)