Skip to content

Commit

Permalink
fix: Mark parent bucket as immutable on split
Browse files Browse the repository at this point in the history
  • Loading branch information
smessie committed Oct 15, 2024
1 parent 933a8cb commit 1368d6c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/bucketizers/timebasedBucketizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export default class TimebasedBucketizer implements Bucketizer {
const newMutableLeafBuckets = [];
const parentBucket = candidateBucket;
parentBucket.empty = true;
parentBucket.immutable = true;

const recordTime = new Date(timestamp).getTime();
for (let i = 0; i < this.k; i++) {
Expand Down
40 changes: 20 additions & 20 deletions test/timebasedBucketizer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
`;

const quads = new Parser({ baseIRI: "" }).parse(quadsStr);
const output: BucketizerConfig = lens.execute({
const output: BucketizerConfig = <BucketizerConfig>lens.execute({
id: namedNode("http://example.org/Fragmentation"),
quads,
});
Expand Down Expand Up @@ -578,7 +578,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
// { id: "root", immutable: false, relations: 2 },
{
id: `root/${encodeURIComponent(b0.toISOString())}_${ts(b0, b1)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand All @@ -602,7 +602,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2,
b0_3,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand All @@ -618,7 +618,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_0,
b0_2_1,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -674,7 +674,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_0_3,
b0_2_0_4,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand All @@ -698,7 +698,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_0_3_2,
b0_2_0_3_3,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -730,7 +730,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_0_3_2_2,
b0_2_0_3_2_3,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -1029,7 +1029,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
],
);

console.log("============ futheer -----------");
console.log("============ further -----------");
// Rb2 - Rb10 should just be added.
for (let i = 1; i < 10; i++) {
output = [];
Expand Down Expand Up @@ -1110,7 +1110,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_0_3_3,
b0_2_0_3_4,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand All @@ -1126,7 +1126,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_0_3_3_1,
b0_2_0_3_3_2,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -1587,15 +1587,15 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_1,
b0_2_2,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
id: `root/${encodeURIComponent(b0_2_1_0.toISOString())}_${ts(
b0_2_1_0,
b0_2_1_1,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -1627,7 +1627,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_1_0_0,
b0_2_1_0_1,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -1659,7 +1659,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_1_0_0_0,
b0_2_1_0_0_1,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -2230,7 +2230,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_1_0_2,
b0_2_1_0_3,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -2849,15 +2849,15 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_1_2,
b0_2_1_3,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
id: `root/${encodeURIComponent(b0_2_1_2_0.toISOString())}_${ts(
b0_2_1_2_0,
b0_2_1_2_1,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -2905,7 +2905,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_1_2_0_2,
b0_2_1_2_0_3,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -3272,7 +3272,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_1_2_1,
b0_2_1_2_2,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down Expand Up @@ -3940,7 +3940,7 @@ ex:Fragmentation a tree:TimebasedFragmentation ;
b0_2_1_3,
b0_2_1_4,
)}_0`,
immutable: false,
immutable: true,
relations: 8,
},
{
Expand Down

0 comments on commit 1368d6c

Please sign in to comment.