Merge branch 'release-5.0' into merge-release-5.0
This commit is contained in:
commit
780405f670
|
@ -18,6 +18,18 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
"use strict";
|
||||
|
||||
var util = require('util');
|
||||
|
||||
var buffer = require('./bufferConversion');
|
||||
var future = require('./future');
|
||||
var transactional = require('./retryDecorator');
|
||||
var tuple = require('./tuple');
|
||||
var Subspace = require('./subspace');
|
||||
var fdbUtil = require('./fdbUtil');
|
||||
|
||||
/*************
|
||||
* Utilities *
|
||||
*************/
|
||||
|
|
|
@ -18,3 +18,87 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
"use strict";
|
||||
|
||||
var buffer = require('./bufferConversion');
|
||||
var future = require('./future');
|
||||
|
||||
var strinc = function(str) {
|
||||
var buf = buffer(str);
|
||||
|
||||
var lastNonFFByte;
|
||||
for(lastNonFFByte = buf.length-1; lastNonFFByte >= 0; --lastNonFFByte)
|
||||
if(buf[lastNonFFByte] != 0xFF)
|
||||
break;
|
||||
|
||||
if(lastNonFFByte < 0)
|
||||
throw new Error('invalid argument \'' + str + '\': prefix must have at least one byte not equal to 0xFF');
|
||||
|
||||
var copy = new Buffer(lastNonFFByte + 1);
|
||||
str.copy(copy, 0, 0, copy.length);
|
||||
++copy[lastNonFFByte];
|
||||
|
||||
return copy;
|
||||
};
|
||||
|
||||
var whileLoop = function(func, cb) {
|
||||
return future.create(function(futureCb) {
|
||||
var calledCallback = true;
|
||||
function outer(err, res) {
|
||||
if(err || typeof(res) !== 'undefined') {
|
||||
futureCb(err, res);
|
||||
}
|
||||
else if(!calledCallback) {
|
||||
calledCallback = true;
|
||||
}
|
||||
else {
|
||||
while(calledCallback) {
|
||||
calledCallback = false;
|
||||
func(outer);
|
||||
}
|
||||
|
||||
calledCallback = true;
|
||||
}
|
||||
}
|
||||
|
||||
outer();
|
||||
}, cb);
|
||||
};
|
||||
|
||||
var keyToBuffer = function(key) {
|
||||
if(typeof(key.asFoundationDBKey) == 'function')
|
||||
return buffer(key.asFoundationDBKey());
|
||||
|
||||
return buffer(key);
|
||||
};
|
||||
|
||||
var valueToBuffer = function(val) {
|
||||
if(typeof(val.asFoundationDBValue) == 'function')
|
||||
return buffer(val.asFoundationDBValue());
|
||||
|
||||
return buffer(val);
|
||||
};
|
||||
|
||||
var buffersEqual = function(buf1, buf2) {
|
||||
if(!buf1 || !buf2)
|
||||
return buf1 === buf2;
|
||||
|
||||
if(buf1.length !== buf2.length)
|
||||
return false;
|
||||
|
||||
for(var i = 0; i < buf1.length; ++i)
|
||||
if(buf1[i] !== buf2[i])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
strinc: strinc,
|
||||
whileLoop: whileLoop,
|
||||
keyToBuffer: keyToBuffer,
|
||||
valueToBuffer: valueToBuffer,
|
||||
buffersEqual: buffersEqual
|
||||
};
|
||||
|
||||
|
|
|
@ -18,3 +18,68 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
"use strict";
|
||||
|
||||
var buffer = require('./bufferConversion');
|
||||
var fdbUtil = require('./fdbUtil');
|
||||
var tuple = require('./tuple');
|
||||
|
||||
var Subspace = function(prefixArray, rawPrefix) {
|
||||
if(typeof rawPrefix === 'undefined')
|
||||
rawPrefix = new Buffer(0);
|
||||
if(typeof prefixArray === 'undefined')
|
||||
prefixArray = [];
|
||||
|
||||
rawPrefix = fdbUtil.keyToBuffer(rawPrefix);
|
||||
var packed = tuple.pack(prefixArray);
|
||||
|
||||
this.rawPrefix = Buffer.concat([rawPrefix, packed], rawPrefix.length + packed.length);
|
||||
};
|
||||
|
||||
Subspace.prototype.key = function() {
|
||||
return this.rawPrefix;
|
||||
};
|
||||
|
||||
Subspace.prototype.pack = function(arr) {
|
||||
var packed = tuple.pack(arr);
|
||||
return Buffer.concat([this.rawPrefix, packed], this.rawPrefix.length + packed.length) ;
|
||||
};
|
||||
|
||||
Subspace.prototype.unpack = function(key) {
|
||||
key = fdbUtil.keyToBuffer(key);
|
||||
if(!this.contains(key))
|
||||
throw new Error('Cannot unpack key that is not in subspace.');
|
||||
|
||||
return tuple.unpack(key.slice(this.rawPrefix.length));
|
||||
};
|
||||
|
||||
Subspace.prototype.range = function(arr) {
|
||||
if(typeof arr === 'undefined')
|
||||
arr = [];
|
||||
|
||||
var range = tuple.range(arr);
|
||||
return {
|
||||
begin: Buffer.concat([this.rawPrefix, range.begin], this.rawPrefix.length + range.begin.length),
|
||||
end: Buffer.concat([this.rawPrefix, range.end], this.rawPrefix.length + range.end.length)
|
||||
};
|
||||
};
|
||||
|
||||
Subspace.prototype.contains = function(key) {
|
||||
key = fdbUtil.keyToBuffer(key);
|
||||
return key.length >= this.rawPrefix.length && fdbUtil.buffersEqual(key.slice(0, this.rawPrefix.length), this.rawPrefix);
|
||||
};
|
||||
|
||||
Subspace.prototype.get = function(item) {
|
||||
return this.subspace([item]);
|
||||
};
|
||||
|
||||
Subspace.prototype.subspace = function(arr) {
|
||||
return new Subspace(arr, this.rawPrefix);
|
||||
};
|
||||
|
||||
Subspace.prototype.asFoundationDBKey = function() {
|
||||
return this.key();
|
||||
};
|
||||
|
||||
module.exports = Subspace;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
* promise_aplus_test.js
|
||||
*
|
||||
|
@ -18,8 +20,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#!/usr/bin/env node
|
||||
|
||||
"use strict";
|
||||
|
||||
var promisesAplusTests = require('promises-aplus-tests');
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
* tester.js
|
||||
*
|
||||
|
@ -18,8 +20,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#!/usr/bin/env node
|
||||
|
||||
"use strict";
|
||||
|
||||
//cmd line: node tester.js <test_prefix> <optional_cluster_file>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#encoding: BINARY
|
||||
|
||||
#
|
||||
# fdbdirectory.rb
|
||||
#
|
||||
|
@ -18,8 +20,6 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
#encoding: BINARY
|
||||
|
||||
# FoundationDB Ruby API
|
||||
|
||||
# Documentation for this API can be found at
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#encoding: BINARY
|
||||
|
||||
#
|
||||
# fdbimpl.rb
|
||||
#
|
||||
|
@ -18,8 +20,6 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
#encoding: BINARY
|
||||
|
||||
# FoundationDB Ruby API
|
||||
|
||||
# Documentation for this API can be found at
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#encoding: BINARY
|
||||
|
||||
#
|
||||
# fdblocality.rb
|
||||
#
|
||||
|
@ -18,8 +20,6 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
#encoding: BINARY
|
||||
|
||||
# FoundationDB Ruby API
|
||||
|
||||
# Documentation for this API can be found at
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#encoding: BINARY
|
||||
|
||||
#
|
||||
# fdbsubspace.rb
|
||||
#
|
||||
|
@ -18,8 +20,6 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
#encoding: BINARY
|
||||
|
||||
# FoundationDB Ruby API
|
||||
|
||||
# Documentation for this API can be found at
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#encoding: BINARY
|
||||
|
||||
#
|
||||
# fdbtuple.rb
|
||||
#
|
||||
|
@ -18,8 +20,6 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
#encoding: BINARY
|
||||
|
||||
# FoundationDB Ruby API
|
||||
|
||||
# Documentation for this API can be found at
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#encoding:BINARY
|
||||
|
||||
#
|
||||
# directory_extension.rb
|
||||
#
|
||||
|
@ -18,7 +20,6 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
#encoding:BINARY
|
||||
require 'fdb'
|
||||
|
||||
module DirectoryExtension
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
#encoding:BINARY
|
||||
|
||||
#
|
||||
# tester.rb
|
||||
#
|
||||
|
@ -19,8 +21,6 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
#encoding:BINARY
|
||||
|
||||
require 'thread'
|
||||
|
||||
$:.unshift( File.join( File.dirname(__FILE__), "../lib" ) )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30501.0
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "actorcompiler", "flow\actorcompiler\actorcompiler.csproj", "{0ECC1314-3FC2-458D-8E41-B50B4EA24E51}"
|
||||
EndProject
|
||||
|
@ -47,8 +47,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fdb_c", "bindings\c\fdb_c.v
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vexillographer", "fdbclient\vexillographer\vexillographer.csproj", "{E0780196-FFC8-49BA-9451-44EAD3E3CB10}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sql", "layers\sql\sql.vcxproj", "{AAD12EDB-7E0D-4094-BB8A-F697FA6DF9F0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fdbmonitor", "fdbmonitor\fdbmonitor.vcxproj", "{9A1D17A1-1B56-44D8-90C8-56F1726C1C4C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fdbservice", "fdbservice\fdbservice.vcxproj", "{0C938D09-39F6-48C0-9C6A-45D3ADBDCFB7}"
|
||||
|
@ -116,10 +114,6 @@ Global
|
|||
{00AC9086-0377-4871-9991-DF267CF12ACA}.Debug|X64.Build.0 = Debug|X64
|
||||
{00AC9086-0377-4871-9991-DF267CF12ACA}.Release|X64.ActiveCfg = Release|X64
|
||||
{00AC9086-0377-4871-9991-DF267CF12ACA}.Release|X64.Build.0 = Release|X64
|
||||
{2C34B5C9-F634-4CBF-BDBD-71675E34079B}.Debug|X64.ActiveCfg = Debug|Any CPU
|
||||
{2C34B5C9-F634-4CBF-BDBD-71675E34079B}.Debug|X64.Build.0 = Debug|Any CPU
|
||||
{2C34B5C9-F634-4CBF-BDBD-71675E34079B}.Release|X64.ActiveCfg = Release|Any CPU
|
||||
{2C34B5C9-F634-4CBF-BDBD-71675E34079B}.Release|X64.Build.0 = Release|Any CPU
|
||||
{664A9ABB-3ED2-4088-8C95-FF6B5414F0AD}.Debug|X64.ActiveCfg = Debug|Any CPU
|
||||
{664A9ABB-3ED2-4088-8C95-FF6B5414F0AD}.Debug|X64.Build.0 = Debug|Any CPU
|
||||
{664A9ABB-3ED2-4088-8C95-FF6B5414F0AD}.Release|X64.ActiveCfg = Release|Any CPU
|
||||
|
@ -136,14 +130,10 @@ Global
|
|||
{8E959DA5-5925-45CE-BFC4-C84EB632A29A}.Debug|X64.Build.0 = Debug|X64
|
||||
{8E959DA5-5925-45CE-BFC4-C84EB632A29A}.Release|X64.ActiveCfg = Release|X64
|
||||
{8E959DA5-5925-45CE-BFC4-C84EB632A29A}.Release|X64.Build.0 = Release|X64
|
||||
{6A6B7D20-EB7E-4768-BDE2-21FE0C32F17A}.Debug|X64.ActiveCfg = Debug|Any CPU
|
||||
{6A6B7D20-EB7E-4768-BDE2-21FE0C32F17A}.Release|X64.ActiveCfg = Release|Any CPU
|
||||
{4631CC93-52A3-4537-9BE9-6B237A3AC6B2}.Debug|X64.ActiveCfg = Debug|x64
|
||||
{4631CC93-52A3-4537-9BE9-6B237A3AC6B2}.Debug|X64.Build.0 = Debug|x64
|
||||
{4631CC93-52A3-4537-9BE9-6B237A3AC6B2}.Release|X64.ActiveCfg = Release|x64
|
||||
{4631CC93-52A3-4537-9BE9-6B237A3AC6B2}.Release|X64.Build.0 = Release|x64
|
||||
{832FB631-F93F-4BE9-BAA5-479952116DFF}.Debug|X64.ActiveCfg = Debug|X64
|
||||
{832FB631-F93F-4BE9-BAA5-479952116DFF}.Release|X64.ActiveCfg = Release|X64
|
||||
{CACB2C8E-3E55-4309-A411-2A9C56C6C1CB}.Debug|X64.ActiveCfg = Debug|x64
|
||||
{CACB2C8E-3E55-4309-A411-2A9C56C6C1CB}.Debug|X64.Build.0 = Debug|x64
|
||||
{CACB2C8E-3E55-4309-A411-2A9C56C6C1CB}.Release|X64.ActiveCfg = Release|x64
|
||||
|
@ -152,12 +142,6 @@ Global
|
|||
{E0780196-FFC8-49BA-9451-44EAD3E3CB10}.Debug|X64.Build.0 = Debug|Any CPU
|
||||
{E0780196-FFC8-49BA-9451-44EAD3E3CB10}.Release|X64.ActiveCfg = Release|Any CPU
|
||||
{E0780196-FFC8-49BA-9451-44EAD3E3CB10}.Release|X64.Build.0 = Release|Any CPU
|
||||
{1FA45F13-1015-403C-9115-CEFFDD522B20}.Debug|X64.ActiveCfg = Debug|Any CPU
|
||||
{1FA45F13-1015-403C-9115-CEFFDD522B20}.Debug|X64.Build.0 = Debug|Any CPU
|
||||
{1FA45F13-1015-403C-9115-CEFFDD522B20}.Release|X64.ActiveCfg = Release|Any CPU
|
||||
{1FA45F13-1015-403C-9115-CEFFDD522B20}.Release|X64.Build.0 = Release|Any CPU
|
||||
{AAD12EDB-7E0D-4094-BB8A-F697FA6DF9F0}.Debug|X64.ActiveCfg = Debug|X64
|
||||
{AAD12EDB-7E0D-4094-BB8A-F697FA6DF9F0}.Release|X64.ActiveCfg = Release|X64
|
||||
{9A1D17A1-1B56-44D8-90C8-56F1726C1C4C}.Debug|X64.ActiveCfg = Debug|x64
|
||||
{9A1D17A1-1B56-44D8-90C8-56F1726C1C4C}.Release|X64.ActiveCfg = Release|x64
|
||||
{0C938D09-39F6-48C0-9C6A-45D3ADBDCFB7}.Debug|X64.ActiveCfg = Debug|x64
|
||||
|
@ -180,8 +164,6 @@ Global
|
|||
{9463CB25-DCA0-9D45-C46E-0A8E68EE7FAE}.Debug|X64.Build.0 = Debug|x64
|
||||
{9463CB25-DCA0-9D45-C46E-0A8E68EE7FAE}.Release|X64.ActiveCfg = Release|x64
|
||||
{9463CB25-DCA0-9D45-C46E-0A8E68EE7FAE}.Release|X64.Build.0 = Release|x64
|
||||
{9E9FA126-64DB-45CF-81D3-982D71BF975A}.Debug|X64.ActiveCfg = Debug|x64
|
||||
{9E9FA126-64DB-45CF-81D3-982D71BF975A}.Release|X64.ActiveCfg = Release|x64
|
||||
{2BA0A5E2-EB4C-4A32-948C-CBAABD77AF87}.Debug|X64.ActiveCfg = Debug|X64
|
||||
{2BA0A5E2-EB4C-4A32-948C-CBAABD77AF87}.Debug|X64.Build.0 = Debug|X64
|
||||
{2BA0A5E2-EB4C-4A32-948C-CBAABD77AF87}.Release|X64.ActiveCfg = Release|X64
|
||||
|
|
Loading…
Reference in New Issue