Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Typed command ids #1372

Merged
merged 7 commits into from
May 22, 2020
Merged

Typed command ids #1372

merged 7 commits into from
May 22, 2020

Conversation

zeroZshadow
Copy link
Contributor

@zeroZshadow zeroZshadow commented May 22, 2020

Description

Make command request ID's typed.
Split interfaces for commands into their own files.

Small drive-by on making comparer classes sealed.

Documentation

  • Changelog
  • Upgrade Guide

@improbable-prow-robot improbable-prow-robot added jira/no-ticket Indicates a PR has no corresponding JIRA ticket size/XL Denotes a PR that changes 300-599 lines, ignoring generated files. labels May 22, 2020
@improbable-prow-robot improbable-prow-robot added A: core Area: Core GDK A: player-lifecycle Area: Player lifecycle feature module labels May 22, 2020
}
}

public readonly struct InternalCommandRequestId : IEquatable<InternalCommandRequestId>, IComparable<InternalCommandRequestId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between InternalCommandRequestId and CommandRequestId? Is it that they're two different wrappers for two different types of commands and could theoretically deviate from each other? Or are you trying to create type safety?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are the same data wise, but 1 is an id the GDK generates when you schedule a command to be send. And the internal ID is the ID the worker SDK returns when the command is actually send over the network.
Using 2 different types here ensures they aren't accidentally mixed up,

@@ -65,11 +65,16 @@ private void SendPlayerCreatorEntityQuery()

private void HandleEntityQueryResponses()
{
if (!playerCreatorEntityQueryId.HasValue)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it not having a value mean has happened? How has that changed with the rest of the code, or is this something you found because of the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously a check was done if(long? == long) which worked because there is an implicit conversion there. This implicit conversion is gone.

If there is no Value in that nullable nothing is supposed to happen, so I changed it to an early out.

{
public readonly struct CommandRequestId : IEquatable<CommandRequestId>, IComparable<CommandRequestId>
{
public readonly long Raw;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So... does this need to be public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For us no, but I wanted to keep this public in case someone used the command ID's for something.

Copy link
Contributor

@jamiebrynes7 jamiebrynes7 May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then they can use this right? It has equality and comparison operators. Like why would you want the raw number over the wrapper struct?

UPGRADE_GUIDE.md Outdated Show resolved Hide resolved
UPGRADE_GUIDE.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
zeroZshadow and others added 2 commits May 22, 2020 15:09
Split file with multiple interfaces into multiple files
Fix sonar code smells
@improbable-prow-robot improbable-prow-robot added size/XXL Denotes a PR that changes 600+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 300-599 lines, ignoring generated files. labels May 22, 2020
@sonarcloud
Copy link

sonarcloud bot commented May 22, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@zeroZshadow zeroZshadow merged commit c50e13b into develop May 22, 2020
@improbable-prow-robot improbable-prow-robot deleted the feature/typed-command-ids branch May 22, 2020 16:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A: core Area: Core GDK A: player-lifecycle Area: Player lifecycle feature module jira/no-ticket Indicates a PR has no corresponding JIRA ticket size/XXL Denotes a PR that changes 600+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants