Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
node-bigstream
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bs
node-bigstream
Commits
1d2d0cad
Commit
1d2d0cad
authored
Sep 19, 2017
by
Kamron Aroonrua
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
d15a1f6e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
8 deletions
+26
-8
objectdata.js
lib/bss/objectdata.js
+17
-3
perform.js
plugins/dt/dt-filter-duplicate/perform.js
+1
-0
index.js
plugins/dt/dt-gistda-water/index.js
+1
-1
bss_read.js
test/bss_read.js
+7
-4
No files found.
lib/bss/objectdata.js
View file @
1d2d0cad
...
@@ -57,7 +57,8 @@ ObjectData.prototype.readMeta = function(opt,cb){
...
@@ -57,7 +57,8 @@ ObjectData.prototype.readMeta = function(opt,cb){
fd
.
bufferedRead
(
oStart
,
oLen
,
function
(
err
,
buff
){
fd
.
bufferedRead
(
oStart
,
oLen
,
function
(
err
,
buff
){
if
(
!
err
){
if
(
!
err
){
cb
(
null
,
BSON
.
parse
(
buff
));
//cb(null,BSON.parse(buff));
cb
(
null
,
safe_parse_bson
(
buff
));
}
else
{
}
else
{
cb
(
err
);
cb
(
err
);
}
}
...
@@ -104,7 +105,8 @@ ObjectData.prototype.readObject = function(opt,cb){
...
@@ -104,7 +105,8 @@ ObjectData.prototype.readObject = function(opt,cb){
if
(
!
err
){
if
(
!
err
){
var
obj
=
{
var
obj
=
{
header
:
self
.
header
,
header
:
self
.
header
,
meta
:
BSON
.
parse
(
buff
.
slice
(
0
,
self
.
header
.
MZ
)),
//meta : BSON.parse(buff.slice(0,self.header.MZ)),
meta
:
safe_parse_bson
(
buff
.
slice
(
0
,
self
.
header
.
MZ
)),
data
:
parse_data
(
buff
.
slice
(
self
.
header
.
MZ
,
self
.
header
.
MZ
+
self
.
header
.
DZ
),
self
.
header
.
TY
),
data
:
parse_data
(
buff
.
slice
(
self
.
header
.
MZ
,
self
.
header
.
MZ
+
self
.
header
.
DZ
),
self
.
header
.
TY
),
}
}
...
@@ -120,12 +122,24 @@ var parse_data = function(buffer,ty){
...
@@ -120,12 +122,24 @@ var parse_data = function(buffer,ty){
if
(
ty
==
STRING_TYPE
){
if
(
ty
==
STRING_TYPE
){
return
buffer
.
toString
(
'utf8'
);
return
buffer
.
toString
(
'utf8'
);
}
else
if
(
ty
==
OBJECT_TYPE
){
}
else
if
(
ty
==
OBJECT_TYPE
){
return
BSON
.
parse
(
buffer
);
//return BSON.parse(buffer);
return
safe_parse_bson
(
buffer
);
}
else
{
}
else
{
return
buffer
;
return
buffer
;
}
}
}
}
var
safe_parse_bson
=
function
(
buffer
)
{
var
ret
=
{};
try
{
ret
=
BSON
.
parse
(
buffer
);
}
catch
(
err
){
ret
=
{};
}
return
ret
;
}
ObjectData
.
prototype
.
write
=
function
(
addr
,
cb
){
ObjectData
.
prototype
.
write
=
function
(
addr
,
cb
){
var
address
=
this
.
header
.
AD
;
var
address
=
this
.
header
.
AD
;
...
...
plugins/dt/dt-filter-duplicate/perform.js
View file @
1d2d0cad
...
@@ -37,6 +37,7 @@ function perform_function(context,request,response){
...
@@ -37,6 +37,7 @@ function perform_function(context,request,response){
memstore
.
getItem
(
prm_name
,
function
(
err
,
value
){
memstore
.
getItem
(
prm_name
,
function
(
err
,
value
){
if
(
value
&&
value
==
hash_key
)
if
(
value
&&
value
==
hash_key
)
{
{
memstore
.
setItem
(
prm_name
,
hash_key
,
function
(
err
){})
response
.
reject
();
response
.
reject
();
}
else
{
}
else
{
memstore
.
setItem
(
prm_name
,
hash_key
,
function
(
err
){})
memstore
.
setItem
(
prm_name
,
hash_key
,
function
(
err
){})
...
...
plugins/dt/dt-gistda-water/index.js
View file @
1d2d0cad
...
@@ -4,7 +4,7 @@ var DTPlugin = require('../dt-plugin');
...
@@ -4,7 +4,7 @@ var DTPlugin = require('../dt-plugin');
function
DTTask
(
context
,
request
){
function
DTTask
(
context
,
request
){
DTPlugin
.
call
(
this
,
context
,
request
);
DTPlugin
.
call
(
this
,
context
,
request
);
this
.
name
=
"
noop
"
;
this
.
name
=
"
gistda-water
"
;
this
.
output_type
=
""
;
this
.
output_type
=
""
;
}
}
util
.
inherits
(
DTTask
,
DTPlugin
);
util
.
inherits
(
DTTask
,
DTPlugin
);
...
...
test/bss_read.js
View file @
1d2d0cad
...
@@ -3,7 +3,7 @@ var async = require('async');
...
@@ -3,7 +3,7 @@ var async = require('async');
var
BinStream
=
ctx
.
getLib
(
'lib/bss/binarystream_v1_1'
);
var
BinStream
=
ctx
.
getLib
(
'lib/bss/binarystream_v1_1'
);
var
FNAME
=
"D:/testfile/
env
.bss"
;
var
FNAME
=
"D:/testfile/
agritronics
.bss"
;
// BinStream.open(FNAME,function(err,bss){
// BinStream.open(FNAME,function(err,bss){
...
@@ -54,10 +54,13 @@ BinStream.open(FNAME,function(err,bss){
...
@@ -54,10 +54,13 @@ BinStream.open(FNAME,function(err,bss){
cont
=
false
;
cont
=
false
;
callback
();
callback
();
}
else
{
}
else
{
obj
.
readMeta
(
function
(
err
,
meta
){
obj
.
readMeta
(
function
(
err
,
obj
){
idx
++
;
idx
++
;
if
(
idx
%
100000
==
0
){
if
(
idx
%
10000
==
0
){
console
.
log
(
meta
);
console
.
log
(
obj
);
}
if
(
idx
==
86639
){
console
.
log
(
obj
);
}
}
callback
();
callback
();
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment