Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Feature/write acknowledgment #52

Merged
merged 12 commits into from
Dec 18, 2016
Merged

Feature/write acknowledgment #52

merged 12 commits into from
Dec 18, 2016

Conversation

AlexBHarley
Copy link
Contributor

No description provided.

@AlexBHarley
Copy link
Contributor Author

Not failing due to tests but j2objc

@yasserf
Copy link
Contributor

yasserf commented Dec 16, 2016

This looks quite good!

/**
* Used when requiring write acknowledgements when setting records
*/
WRITE_SUCCESS( "WS" );
Copy link
Contributor

Choose a reason for hiding this comment

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

write acknowledgement

action names need to be constant in both server and client ( code practice )

@@ -244,6 +247,85 @@ public Record set(String path, Object value ) throws DeepstreamRecordDestroyedEx
}

/**
* Set the value for the entire record synchronously and gives acknowledgement
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the actual api we use for set? If it is we should change it to JSONObject or JSONElement since we can't set a string or number using this api

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We just have a warning that whatever is used must be serialisable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we want users to have to do gson.toJsonTree( val ) every time?

JsonElement object = this.path.get( path );

if( object != null && object.equals( value ) ) {
return new RecordSetResult(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

interesting edge case, since write never happens so is it really a successful callback?

@@ -674,6 +769,7 @@ private void sendRead() {
*/
@ObjectiveCName("sendUpdate:value:")
private void sendUpdate( String key, Object value ) {
this.version++;
Copy link
Contributor

Choose a reason for hiding this comment

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

why did this need to be moved?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because sendUpdate is called from multiple places and we always want to increase the version number. Also it is here in the js client so a bit easier to context switch

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense!

this.error = error;
}

public String getResult() {
Copy link
Contributor

Choose a reason for hiding this comment

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

documentation missing

* @param data The data to send in the request
* @param utilSingleNotifierCallback The callback to call once the request is completed
*/
public void request( String name, String[] data, UtilSingleNotifierCallback utilSingleNotifierCallback ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

i like!

Alex Harley added 2 commits December 16, 2016 17:22
@AlexBHarley
Copy link
Contributor Author

Travis build fixed in #47

@yasserf yasserf merged commit 13da906 into master Dec 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants