Skip to content

Commit

Permalink
Add simple Golang client docs
Browse files Browse the repository at this point in the history
  • Loading branch information
buraksezer committed Aug 22, 2019
1 parent b74e793 commit a38e2bd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,31 @@ Otherwise you can get a timeout error.

The `Flush` method returns errors along with success messages. Furhermore, you need to know the command order to match responses with requests.

## Golang Client
This repo contains the official Golang client for Olric. It implements Olric Binary Protocol(OBP). With this client,
you can access to Olric clusters in your Golang programs. In order to create a client instance:
```go
var clientConfig = &client.Config{
Addrs: []string{"localhost:3320"},
DialTimeout: 10 * time.Second,
KeepAlive: 10 * time.Second,
MaxConn: 100,
}

client, err := client.New(clientConfig)
if err != nil {
return err
}

dm := client.NewDMap("foobar")
err := dm.Put("key", "value")
// Handle this error
```

This implementation supports TCP connection pooling. So it recycles the opened TCP connections to avoid wasting resources.
The requests distributes among available TCP connections using an algorithm called `round-robin`. In order to see detailed list of
configuration parameters, see [Olric documentation on GoDoc.org](https://godoc.org/github.com/buraksezer/olric).

## Configuration

[memberlist configuration](https://godoc.org/github.com/hashicorp/memberlist#Config) can be tricky and and the default configuration set should be tuned for your environment. A detailed deployment and configuration guide will be prepared before stable release.
Expand Down

0 comments on commit a38e2bd

Please sign in to comment.