Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Mark parent bucket as immutable on split #68

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 9 additions & 9 deletions test/bucketizer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("Bucketizer configs", () => {
tree:fragmentationPath (<b> <c>).
`;
const quads = new Parser({ baseIRI: "" }).parse(quadsStr);
const output: BucketizerConfig = lens.execute({
const output: BucketizerConfig = <BucketizerConfig>lens.execute({
id: namedNode("a"),
quads,
});
Expand Down Expand Up @@ -67,7 +67,7 @@ describe("Bucketizer configs", () => {
tree:fragmentationPath <b>.
`;
const quads = new Parser({ baseIRI: "" }).parse(quadsStr);
const output: BucketizerConfig = lens.execute({
const output: BucketizerConfig = <BucketizerConfig>lens.execute({
id: namedNode("a"),
quads,
});
Expand Down Expand Up @@ -99,7 +99,7 @@ describe("Bucketizer configs", () => {
tree:minBucketSpan 3600.
`;
const quads = new Parser({ baseIRI: "" }).parse(quadsStr);
const output: BucketizerConfig = lens.execute({
const output: BucketizerConfig = <BucketizerConfig>lens.execute({
id: namedNode("a"),
quads,
});
Expand Down Expand Up @@ -131,7 +131,7 @@ describe("Bucketizer configs", () => {
tree:pageSize 42.
`;
const quads = new Parser({ baseIRI: "" }).parse(quadsStr);
const output: BucketizerConfig = lens.execute({
const output: BucketizerConfig = <BucketizerConfig>lens.execute({
id: namedNode("a"),
quads,
});
Expand Down Expand Up @@ -161,7 +161,7 @@ describe("Bucketizer behavior", () => {
tree:pageSize 2.
`;
const quads = new Parser({ baseIRI: "" }).parse(quadsStr);
const output: BucketizerConfig = lens.execute({
const output: BucketizerConfig = <BucketizerConfig>lens.execute({
id: namedNode("a"),
quads,
});
Expand Down Expand Up @@ -209,7 +209,7 @@ describe("Bucketizer behavior", () => {
tree:fragmentationPath ( ).
`;
const quads = new Parser({ baseIRI: "" }).parse(quadsStr);
const output: BucketizerConfig = lens.execute({
const output: BucketizerConfig = <BucketizerConfig>lens.execute({
id: namedNode("a"),
quads,
});
Expand Down Expand Up @@ -257,7 +257,7 @@ describe("Bucketizer behavior", () => {
tree:fragmentationPathName ex:test.
`;
const quads = new Parser({ baseIRI: "" }).parse(quadsStr);
const output: BucketizerConfig = lens.execute({
const output: BucketizerConfig = <BucketizerConfig>lens.execute({
id: namedNode("a"),
quads,
});
Expand Down Expand Up @@ -326,11 +326,11 @@ describe("Bucketizer behavior", () => {
tree:pageSize 2.
`;
const quads = new Parser({ baseIRI: "" }).parse(quadsStr);
const config1: BucketizerConfig = lens.execute({
const config1: BucketizerConfig = <BucketizerConfig>lens.execute({
id: namedNode("a"),
quads,
});
const config2: BucketizerConfig = lens.execute({
const config2: BucketizerConfig = <BucketizerConfig>lens.execute({
id: namedNode("b"),
quads,
});
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
Loading