Skip to content

Commit 4dc7a8a

Browse files
committed
Adjust Views API
The tests are failing though.
1 parent 3eb3b97 commit 4dc7a8a

File tree

3 files changed

+53
-51
lines changed

3 files changed

+53
-51
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

1010
### Changed
1111

12-
- Changed experimental Views API `ArangoSearchViewConsolidationType`
12+
- Changed Views API to match 3.4 GA implementation
1313

14-
This release updates the experimental support for the Views API to the version
15-
implemented in the current ArangoDB 3.4 release candidate. Please note that this API
16-
is still subject to change and may indeed still change until the 3.4.0 GA release.
14+
This release updates the Views API to the version implemented in the final
15+
ArangoDB 3.4 GA release. Please note that these changes may break code
16+
written for earlier ArangoDB 3.4 release candidates.
1717

1818
### Added
1919

src/test/26-manipulating-views.ts

Lines changed: 23 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,54 +51,38 @@ describe34("Manipulating views", function() {
5151
});
5252
describe("view.setProperties", () => {
5353
it("should change properties", async () => {
54+
const initial = await view.properties();
55+
expect(initial.cleanupIntervalStep).to.equal(10);
56+
expect(initial.writebufferIdle).to.equal(64);
57+
const oldProps = await view.setProperties({
58+
cleanupIntervalStep: 20,
59+
writebufferIdle: 48
60+
});
61+
expect(oldProps.cleanupIntervalStep).to.equal(20);
62+
expect(oldProps.writebufferIdle).to.equal(48);
5463
const properties = await view.setProperties({
55-
consolidationPolicy: {
56-
type: "tier",
57-
threshold: 0.123
58-
}
64+
writebufferIdle: 32
5965
});
60-
expect(properties).to.have.property("name", view.name);
61-
expect(properties).to.have.property("links");
62-
expect(properties).to.have.property("consolidationPolicy");
63-
expect(properties.consolidationPolicy).to.have.property("type", "tier");
64-
expect(properties.consolidationPolicy).to.have.property("threshold");
65-
expect(properties.consolidationPolicy.threshold.toFixed(3)).to.equal(
66-
"0.123"
67-
);
66+
expect(properties.cleanupIntervalStep).to.equal(20);
67+
expect(properties.writebufferIdle).to.equal(32);
6868
});
6969
});
7070
describe("view.replaceProperties", () => {
7171
it("should change properties", async () => {
7272
const initial = await view.properties();
73-
expect(initial.consolidationPolicy).to.have.property("threshold");
74-
const oldProps = await view.replaceProperties({
75-
consolidationPolicy: {
76-
type: "bytes_accum",
77-
threshold: 0.123
78-
}
73+
expect(initial.cleanupIntervalStep).to.equal(10);
74+
expect(initial.writebufferIdle).to.equal(64);
75+
const oldProps = await view.setProperties({
76+
cleanupIntervalStep: 20,
77+
writebufferIdle: 48
7978
});
80-
expect(oldProps.consolidationPolicy).to.have.property("threshold");
81-
expect(oldProps.consolidationPolicy.threshold.toFixed(3)).to.equal(
82-
"0.123"
83-
);
84-
expect(oldProps.consolidationPolicy).to.have.property(
85-
"type",
86-
"bytes_accum"
87-
);
88-
const properties = await view.replaceProperties({
89-
consolidationPolicy: {
90-
type: "tier",
91-
threshold: 0.456
92-
}
79+
expect(oldProps.cleanupIntervalStep).to.equal(20);
80+
expect(oldProps.writebufferIdle).to.equal(48);
81+
const properties = await view.setProperties({
82+
writebufferIdle: 32
9383
});
94-
expect(properties).to.have.property("name", view.name);
95-
expect(properties).to.have.property("links");
96-
expect(properties).to.have.property("consolidationPolicy");
97-
expect(properties.consolidationPolicy).to.have.property("type", "tier");
98-
expect(properties.consolidationPolicy).to.have.property("threshold");
99-
expect(properties.consolidationPolicy.threshold.toFixed(3)).to.equal(
100-
"0.456"
101-
);
84+
expect(properties.cleanupIntervalStep).to.equal(10);
85+
expect(properties.writebufferIdle).to.equal(32);
10286
});
10387
});
10488
describe("view.rename", () => {

src/view.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ export interface ArangoViewResponse {
1616
type: ViewType;
1717
}
1818

19-
type ArangoSearchViewConsolidationType = "bytes_accum" | "tier";
20-
2119
interface ArangoSearchViewCollectionLink {
2220
analyzers?: string[];
2321
fields?: { [key: string]: ArangoSearchViewCollectionLink | undefined };
@@ -29,9 +27,17 @@ interface ArangoSearchViewCollectionLink {
2927
export interface ArangoSearchViewProperties {
3028
cleanupIntervalStep: number;
3129
consolidationIntervalMsec: number;
30+
writebufferIdle: number;
31+
writebufferActive: number;
32+
writebufferSizeMax: number;
3233
consolidationPolicy: {
33-
type: ArangoSearchViewConsolidationType;
34-
threshold: number;
34+
type: "bytes_accum" | "tier";
35+
threshold?: number;
36+
segments_min?: number;
37+
segments_max?: number;
38+
segments_bytes_max?: number;
39+
segments_bytes_floor?: number;
40+
lookahead?: number;
3541
};
3642
links: {
3743
[key: string]: ArangoSearchViewCollectionLink | undefined;
@@ -47,10 +53,22 @@ export interface ArangoSearchViewPropertiesResponse
4753
export interface ArangoSearchViewPropertiesOptions {
4854
cleanupIntervalStep?: number;
4955
consolidationIntervalMsec?: number;
50-
consolidationPolicy?: {
51-
type?: ArangoSearchViewConsolidationType;
52-
threshold?: number;
53-
};
56+
writebufferIdle?: number;
57+
writebufferActive?: number;
58+
writebufferSizeMax?: number;
59+
consolidationPolicy?:
60+
| {
61+
type: "bytes_accum";
62+
threshold?: number;
63+
}
64+
| {
65+
type: "tier";
66+
lookahead?: number;
67+
segments_min?: number;
68+
segments_max?: number;
69+
segments_bytes_max?: number;
70+
segments_bytes_floor?: number;
71+
};
5472
links?: {
5573
[key: string]: ArangoSearchViewCollectionLink | undefined;
5674
};

0 commit comments

Comments
 (0)