Skip to content

Commit

Permalink
adjust readme
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislusf committed Mar 7, 2019
1 parent 02dd17b commit e1f8a17
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,29 @@ See https://godoc.org/github.com/chrislusf/vasto/goclient/vs
## Example

```go
// create a vasto client talking to master at localhost:8278, in data center dc1
c := vs.NewVastoClient(context.Background(), "client_name", "localhost:8278")
// create a vasto client talking to master at localhost:8278
vc := vs.NewVastoClient(context.Background(), "client_name", "localhost:8278")

// create a cluster for keyspace ks1, in data center dc1, with one server, and one copy of data.
c.CreateCluster("ks1", 1, 1)
// create a cluster for keyspace ks1, with one server, and one copy of data.
vc.CreateCluster("ks1", 1, 1)

// get a cluster client for ks1
ks := c.NewClusterClient("ks1")
cc := vc.NewClusterClient("ks1")

// operate with the cluster client
var key, value []byte
cc.Put(key, value)
cc.Get(vs.Key(key))
...
ks.Put(key, value)
...

data, _, _ := ks.Get(vs.Key(key))
// change cluster size to 3 servers
vc.ResizeCluster("ks1", 3)

// operate with the existing cluster client
cc.Put(key, value)
cc.Get(vs.Key(key))
...

```


Expand Down

0 comments on commit e1f8a17

Please sign in to comment.