1
0
Fork 0

[DEV-6730] Store concluding_save with the reverse delta

master
Austin Schaffer 2020-01-14 13:01:17 -05:00
parent 103c06da39
commit 61b66c24a3
7 changed files with 59 additions and 35 deletions

View File

@ -55,6 +55,7 @@ export type DeltaResult<T> = { [K in keyof T]: DeltaDatum<T[K]> | null };
export type Delta<T> = {
type: DeltaType,
timestamp: UnixTimestamp,
concluding_save: boolean,
data: DeltaResult<T>,
}

View File

@ -1147,6 +1147,7 @@ module.exports = Class( 'Server' )
var rdelta_data;
var parsed_data = JSON.parse( post_data.data );
var bucket = quote.getBucket();
const concluding_save = post_data.concluding_save;
const { filtered, dapis, meta_clear, rdiff } =
server._dataProcessor.processDiff(
@ -1159,6 +1160,7 @@ module.exports = Class( 'Server' )
rdelta_data = {
"rdelta.data": {
data: rdiff,
concluding_save: ( concluding_save === 'true' ),
timestamp: Math.round(
new Date().getTime() / 1000
),

View File

@ -265,7 +265,8 @@ export class RatingService
const rdelta_data = {
"rdelta.ratedata": {
data: this._createDelta( data, quote_data ),
timestamp: cur_date
concluding_save: false,
timestamp: cur_date,
},
};

View File

@ -105,12 +105,26 @@ export class V1MessageWriter implements MessageWriter
const last_update_ms = { "long": meta.lastUpdate * 1000 };
const ts_ms = ts * 1000;
let step = null;
if( delta.concluding_save === true )
{
step = {
EventStep: {
transition: 'END',
src: '',
dest: '',
}
}
}
return {
event: {
id: event_id,
ts: ts_ms,
actor: 'SERVER',
step: null,
step: step,
},
document: {
id: meta.id,

View File

@ -468,6 +468,7 @@ function getStubs()
data: {
_unavailable_all: [ undefined ]
},
concluding_save: false,
timestamp: 123
}
};

View File

@ -462,6 +462,7 @@ describe( 'system.DeltaProcessor', () =>
data: { foo: [ 'first_bar' ] },
timestamp: <UnixTimestamp>123123,
type: 'data',
concluding_save: false,
}
],
ratedata: [],
@ -586,6 +587,7 @@ describe( 'system.DeltaProcessor', () =>
data: { foo: [ 'first_bar' ] },
timestamp: <UnixTimestamp>123123,
type: 'data',
concluding_save: false,
}
],
ratedata: [],
@ -606,6 +608,7 @@ describe( 'system.DeltaProcessor', () =>
data: { foo: [ 'first_bar' ] },
timestamp: <UnixTimestamp>123123,
type: 'data',
concluding_save: false,
}
],
ratedata: [],

View File

@ -189,17 +189,12 @@ describe( 'system.V1MessageWriter', () =>
if ( valid )
{
// return expect( result ).to.eventually.deep.equal(
// Buffer.from( '' )
// )
// .then( b =>
// {
// expect( typeof(b) ).to.equal( 'object' );
// } );
return result.catch( e =>
return expect( result ).to.eventually.deep.equal(
Buffer.from( '' )
)
.then( b =>
{
console.log( 'avroerror: ', e );
expect.fail();
expect( typeof(b) ).to.equal( 'object' );
} );
}
else
@ -399,6 +394,7 @@ describe( 'system.V1MessageWriter', () =>
type: <DeltaType>'data',
timestamp: <UnixTimestamp>123123123,
data: <DeltaResult<any>>{},
concluding_save: true,
};
const expected = {
@ -406,7 +402,13 @@ describe( 'system.V1MessageWriter', () =>
id: 'STEP_SAVE',
ts: ts * 1000,
actor: 'SERVER',
step: null,
step: {
EventStep: {
transition: 'END',
src: '',
dest: '',
},
},
},
document: {
id: doc_id,