Skip to content

Commit 57241d9

Browse files
authored
Merge pull request #37 from werf/fix-readme
docs: fix README examples
2 parents fd4df31 + 0d2bea1 commit 57241d9

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,15 @@ This locker allows distributed locking over multiple hosts.
7171
Create a Kubernetes locker as follows:
7272

7373
```
74-
import "github.com/werf/lockgate"
74+
import (
75+
"github.com/werf/lockgate"
76+
"github.com/werf/lockgate/pkg/distributed_locker"
77+
)
7578
7679
...
7780
7881
// Initialize kubeDynamicClient from https://github.com/kubernetes/client-go.
79-
locker, err := lockgate.NewKubernetesLocker(
82+
locker, err := distributed_locker.NewKubernetesLocker(
8083
kubeDynamicClient, schema.GroupVersionResource{
8184
Group: "",
8285
Version: "v1",
@@ -94,11 +97,14 @@ This locker uses lockgate HTTP server to organize locks and allows distributed l
9497
Create a HTTP locker as follows:
9598

9699
```
97-
import "github.com/werf/lockgate"
100+
import (
101+
"github.com/werf/lockgate"
102+
"github.com/werf/lockgate/pkg/distributed_locker"
103+
)
98104
99105
...
100106
101-
locker := lockgate.NewHttpLocker("http://localhost:55589")
107+
locker := distributed_locker.NewHttpLocker("http://localhost:55589")
102108
```
103109

104110
All cooperating processes should use the same URL endpoint of the lockgate HTTP lock server. In this example, there should be a lockgate HTTP lock server available at `localhost:55589` address. See below how to run such a server.
@@ -113,9 +119,11 @@ Lockgate HTTP server can use memory-storage or kubernetes-storage:
113119
Run a lockgate HTTP lock server as follows:
114120

115121
```
116-
import "github.com/werf/lockgate"
117-
import "github.com/werf/lockgate/pkg/distributed_locker"
118-
import "github.com/werf/lockgate/pkg/distributed_locker/optimistic_locking_store"
122+
import (
123+
"github.com/werf/lockgate"
124+
"github.com/werf/lockgate/pkg/distributed_locker"
125+
"github.com/werf/lockgate/pkg/distributed_locker/optimistic_locking_store"
126+
)
119127
120128
...
121129
store := optimistic_locking_store.NewInMemoryStore()
@@ -136,7 +144,10 @@ distributed_locker.RunHttpBackendServer("0.0.0.0", "55589", backend)
136144
In the following example, a `locker` object instance is created using one of the ways documented above — user should select the required locker implementation. The rest of the sample uses generic `lockgate.Locker` interface to acquire and release locks.
137145

138146
```
139-
import "github.com/werf/lockgate"
147+
import (
148+
"github.com/werf/lockgate"
149+
"github.com/werf/lockgate/pkg/distributed_locker"
150+
)
140151
141152
func main() {
142153
// Create Kubernetes based locker in ns/mynamespace cm/myconfigmap.

0 commit comments

Comments
 (0)