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

api.Client: support isolated read-after-write #12814

Merged
merged 8 commits into from Oct 14, 2021

Conversation

benashz
Copy link
Contributor

@benashz benashz commented Oct 13, 2021

This PR adds the ability for a Client to track all cluster replication states. The new ReplicationStateStore provides response and request callback methods to the Client, and can be used across Client clones.

import  (
        "log"

        "github.com/hashicorp/vault/api"
)

func main() {                        
        config := api.DefaultConfig()  
        config.ReadYourWrites = true     
        client, err := api.NewClient(config)
        if err != nil {                           
                log.Fatal(err)
        }

        [...]    
}

Related PR: hashicorp/terraform-provider-vault#1188

api/go.mod Outdated Show resolved Hide resolved
api/client.go Outdated Show resolved Hide resolved
api/client.go Outdated Show resolved Hide resolved
api/client.go Outdated Show resolved Hide resolved
api/client.go Outdated Show resolved Hide resolved
api/client.go Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview – vault-storybook October 13, 2021 17:56 Inactive
@vercel vercel bot temporarily deployed to Preview – vault October 13, 2021 17:56 Inactive
@benashz benashz changed the title Vault 3157/shared triple c state api.Client: Add support for preventing stale reads Oct 13, 2021
@benashz benashz force-pushed the VAULT-3157/shared-triple-c-state branch from 768ead6 to 8a6dc86 Compare October 13, 2021 18:02
@vercel vercel bot temporarily deployed to Preview – vault October 13, 2021 18:02 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook October 13, 2021 18:02 Inactive
api/client.go Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview – vault-storybook October 13, 2021 18:30 Inactive
@vercel vercel bot temporarily deployed to Preview – vault October 13, 2021 18:30 Inactive
@vercel vercel bot temporarily deployed to Preview – vault October 13, 2021 19:08 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook October 13, 2021 19:08 Inactive
api/client.go Show resolved Hide resolved
api/client.go Outdated Show resolved Hide resolved
api/client_test.go Show resolved Hide resolved
api/client.go Outdated Show resolved Hide resolved
api/client_test.go Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview – vault October 13, 2021 20:05 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook October 13, 2021 20:05 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook October 13, 2021 20:14 Inactive
@vercel vercel bot temporarily deployed to Preview – vault October 13, 2021 20:14 Inactive
api/client.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ncabatoff ncabatoff left a comment

Choose a reason for hiding this comment

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

I'm going to approve because the only thing still being worked out is the name for the config option, and I'm happy to go with whatever Brian and Ben agree on.

@vercel vercel bot temporarily deployed to Preview – vault October 14, 2021 17:31 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook October 14, 2021 17:31 Inactive
- The SharedReplicationStateStore provides cluster replication state
  storage that is easily integrated in the Client's response/request
  callback chains.
- no longer rely in response/request callbacks for updating the
  replication state store
- make setting up the store simpler by adding a configuration directive
- address other comments.
- revert go version changes go.mod
@benashz benashz force-pushed the VAULT-3157/shared-triple-c-state branch from 48fbd3f to d8c472e Compare October 14, 2021 17:46
@vercel vercel bot temporarily deployed to Preview – vault October 14, 2021 17:46 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook October 14, 2021 17:46 Inactive
@benashz benashz merged commit e24037f into main Oct 14, 2021
@benashz benashz deleted the VAULT-3157/shared-triple-c-state branch October 14, 2021 18:51
@benashz benashz changed the title api.Client: Add support for preventing stale reads api.Client: support isolated read-after-write Oct 14, 2021
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