-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entity state api #662
Entity state api #662
Conversation
102c8c9
to
0129f44
Compare
7467842
to
741a23e
Compare
741a23e
to
861d99e
Compare
861d99e
to
35c2294
Compare
bb4b8f0
to
96f686c
Compare
96f686c
to
d02cd25
Compare
d02cd25
to
c659378
Compare
c659378
to
de4377f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m having trouble following this schema design; let’s chat. This could also use some tests.
priv/repo/migrations/20230129061701_add_entity_create_messages_table.exs
Outdated
Show resolved
Hide resolved
priv/repo/migrations/20230129061719_add_entity_update_messages_table.exs
Outdated
Show resolved
Hide resolved
priv/repo/migrations/20230129061719_add_entity_update_messages_table.exs
Outdated
Show resolved
Hide resolved
360bdf7
to
f836e24
Compare
fn %{entity: entity} -> | ||
Enum.map(updates, &SubEntity.for_bulk_insert(hub, entity, &1)) | ||
end | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m fairly certain this whole create_entity/2
function is achievable with a single Repo.insert/1
sans the Multi
. Ecto.Changeset.cast_assoc/3
is the key. We can chat.
This is looking really good! It’s almost there! |
f836e24
to
9477943
Compare
ff02aa4
to
77a67cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
Entities
andSubEntities
.Each
Entity
is composed of:create_message
, which tells clients how to spawn the entity (hierarchy) in the game world, andSubEntities
, which tell the client how to configure the components of spawned sub-entities.Four
Entity
-related apis are added to theHubChannel
:list_entities
save_entity_state
pin_objects
Entity
(for the givennid
) already existsupdate_entity_state
pin_objects
Entity
(for the givenroot_nid
) does not already existdelete_entity_state
pin_objects
Entity
(for the givennid
) does not already existClients refer to
Entities
(andSubEntities
) vianid
s, which are shared, client-generated string IDs.Clients only care about the embedded
CreateMessage
s (ofEntities
) andUpdateMessage
s (ofSubEntities)
, soEntityView
returns this data exclusively.Client changes: Hubs-Foundation/hubs#5904