Skip to content

sample: add counter using ReplicatedEntity#26

Merged
patriknw merged 5 commits intomainfrom
wip-replicatedentity-sample-patriknw
Jun 16, 2021
Merged

sample: add counter using ReplicatedEntity#26
patriknw merged 5 commits intomainfrom
wip-replicatedentity-sample-patriknw

Conversation

@patriknw
Copy link
Copy Markdown
Contributor

  • based on the valueentity-counter but using ReplicatedEntity
  • using codegen like classes, but codegen for ReplicatedEntity doesn't exist yet

I will use this as baseline when trying out SDK API changes for ReplicatedEntity. We can merge this first.

patriknw added 2 commits June 11, 2021 12:28
* based on the valueentity-counter but using ReplicatedEntity
* using codegen like classes, but codegen for ReplicatedEntity doesn't exist yet

public CounterImpl(ReplicatedEntityCreationContext context) { // <2>
this.entityId = context.entityId();
this.counter = context.state(PNCounter.class).orElseGet(context::newPNCounter);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By mistake I first used GCounter here, strange that it worked with decrement. Anyway, changed to PNCounter

octonato pushed a commit that referenced this pull request Jun 11, 2021
Clarify which goal to use
Copy link
Copy Markdown
Member

@pvlugter pvlugter left a comment

Choose a reason for hiding this comment

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

Cool, LGTM.

Should GCounter be removed in this PR though?

@@ -0,0 +1,335 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should the dependency-reduced-pom.xml file be committed, or gitignored?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's generated by the maven plugin, I removed it again and added to gitignore

@patriknw patriknw force-pushed the wip-replicatedentity-sample-patriknw branch from cbbe580 to e222801 Compare June 14, 2021 06:03
@patriknw
Copy link
Copy Markdown
Contributor Author

Should GCounter be removed in this PR though?

thanks, that was supposed to be in another PR, reverted

Comment thread samples/replicatedentity-counter/README.md Outdated
Co-authored-by: Peter Vlugter <pvlugter@users.noreply.github.com>
@patriknw patriknw merged commit 2be0d89 into main Jun 16, 2021
@patriknw patriknw deleted the wip-replicatedentity-sample-patriknw branch June 16, 2021 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants