Skip to content
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

Optimistic Locking Support; SDK Parity #11

Merged
merged 3 commits into from
Jun 7, 2017
Merged

Conversation

m4dc4p
Copy link
Contributor

@m4dc4p m4dc4p commented Jun 5, 2017

  • Added version header to Meta structure, to support safe update endpoint.
  • Added Update method to client
  • Modified Write so it creates a record (similar to Ruby SDK). Removed NewRecord as it's no longer necessary.
  • Updated version (CLI) to 2.0.0-rc1.

Records can only be created via the Write method;
removed the NewRecord method.
@m4dc4p m4dc4p requested review from ericmann and jamesjb June 5, 2017 20:41
@coveralls
Copy link

coveralls commented Jun 5, 2017

Coverage Status

Coverage increased (+2.2%) to 53.488% when pulling 156a2d6 on jgbailey/optimistic-locking into f57d7cc on master.

@m4dc4p m4dc4p force-pushed the jgbailey/optimistic-locking branch from 156a2d6 to dc0f45d Compare June 5, 2017 20:43
@coveralls
Copy link

coveralls commented Jun 5, 2017

Coverage Status

Coverage increased (+2.2%) to 53.488% when pulling dc0f45d on jgbailey/optimistic-locking into f57d7cc on master.

client.go Outdated
@@ -77,6 +77,7 @@ type Meta struct {
Plain map[string]string `json:"plain"`
Created time.Time `json:"created"`
LastModified time.Time `json:"last_modified"`
Version string `json:"version,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

gofmt ... please align struct definitions.

client.go Outdated
return &Record{
// Write writes a new encrypted record to the database. Returns the new record (with
// the original, unencrypted data)
func (c *Client) Write(ctx context.Context, recordType string, data *map[string]string, plain *map[string]string) (*Record, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need to pass pointers to maps here, since maps are already reference types:

func (c *Client) Write(ctx context.Context, recordType string, data, plain map[string]string) (*Record, error)

You can still pass nil as a map[string]string, like you would with an error.

client.go Outdated
} else {
plainMap = *plain
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can go away if plain becomes a map[string]string?

@coveralls
Copy link

coveralls commented Jun 7, 2017

Coverage Status

Coverage increased (+2.1%) to 53.385% when pulling 15be2af on jgbailey/optimistic-locking into f57d7cc on master.

@m4dc4p m4dc4p merged commit df21979 into master Jun 7, 2017
@m4dc4p m4dc4p deleted the jgbailey/optimistic-locking branch June 7, 2017 19:36
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.

None yet

4 participants