distributed-lock-manager
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "distributed-lock-manager", | ||
"version": "1.0.1", | ||
"description": "A distributed lock manager (DLM) runs in every machine in a cluster, with an identical copy of a cluster-wide lock database.", | ||
"version": "1.0.2", | ||
"description": "The DLM maintains a list of system resources and provides locking mechanisms to control allocation and modification of resources.", | ||
"main": "gulpfile.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
# Distributed Lock Manager | ||
A distributed lock manager (DLM) runs in every machine in a cluster, with an identical copy of a cluster-wide lock database. | ||
The DLM maintains a list of system resources and provides locking mechanisms to control allocation and modification of resources. | ||
@@ -37,97 +37,6 @@ ## Installation | ||
## HTTP Interface | ||
## Client Libraries | ||
### CSharp | ||
* [DistributedLockManager.NET](https://www.nuget.org/packages/DistributedLockManager.NET) | ||
```CSharp | ||
var client = new RestClient(); | ||
client.BaseUrl = new Uri("http://localhost:5000"); | ||
var request = new RestRequest(Method.POST); | ||
request.AddParameter("text/text", "acquire mylock\r\n", ParameterType.RequestBody); | ||
IRestResponse response = client.Execute(request); | ||
if (response.Content == "TRUE\r\n") | ||
{ | ||
Console.WriteLine("Lock acquired"); | ||
} | ||
else | ||
{ | ||
Console.WriteLine("Failed to acquire lock"); | ||
} | ||
``` | ||
### Node.js | ||
```javascript | ||
const rp = require('request-promise'); | ||
const response = await rp({ | ||
body: `acquire mylock\r\n`, | ||
method: 'POST', | ||
uri: 'http://localhost:5000', | ||
}); | ||
if (response === 'TRUE\r\n') { | ||
console.log('Lock acquired'); | ||
} else { | ||
console.log('Failed to acquire lock'); | ||
} | ||
``` | ||
## TCP Interface | ||
### CSharp | ||
```CSharp | ||
var client = new TcpClient("127.0.0.1", 5001); | ||
var stream = client.GetStream(); | ||
var messageSend = Encoding.ASCII.GetBytes("acquire mylock\r\n"); | ||
stream.Write(messageSend, 0, messageSend.Length); | ||
byte[] bytesReceived = new byte[100]; | ||
int numberOfBytesReceived = stream.Read(bytesReceived, 0, 100); | ||
var messageReceived = ''; | ||
for (int index = 0; index < numberOfBytesReceived; index++) | ||
{ | ||
messageReceived += (char)bytesReceived[index]; | ||
} | ||
if (messageReceived == "TRUE\r\n") | ||
{ | ||
Console.WriteLine("Lock acquired"); | ||
} else | ||
{ | ||
Console.WriteLine("Failed to acquire lock"); | ||
} | ||
stream.Close(); | ||
client.Close(); | ||
``` | ||
### Node.js | ||
```javascript | ||
const net = require('net'); | ||
const client = new net.Socket(); | ||
client.connect(5001, '127.0.0.1', () => { | ||
client.write(`acquire mylock\r\n`); | ||
}); | ||
client.on('data', (data) => { | ||
if (data.toString() === 'TRUE\r\n') { | ||
console.log('Lock acquired'); | ||
} else { | ||
console.log('Failed to acquire lock'); | ||
} | ||
client.destroy(); | ||
}); | ||
``` | ||
## Performance | ||
@@ -134,0 +43,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48911
56