Skip to content

Commit

Permalink
spline #1155 - code format
Browse files Browse the repository at this point in the history
  • Loading branch information
wajda committed Jul 16, 2024
1 parent a80031d commit 2cf0638
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ indent_brace_style = stroustrup
ij_typescript_else_on_new_line = true
ij_typescript_catch_on_new_line = true
ij_typescript_finally_on_new_line = true
ij_typescript_spaces_within_object_literal_braces = true

# imports
ij_typescript_blank_lines_after_imports = 2
ij_typescript_import_sort_members = true
ij_typescript_spaces_within_imports = true

[*.md]
max_line_length = off
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ former indicates in which application version the given database schema was intr
[^1]: Semantic Versioning - https://semver.org/

### How to measure code coverage

```shell
./mvn verify -Dcode-coverage
```

If module contains measurable data the code coverage report will be generated on path:

```
{local-path}\spline\{module}\target\site\jacoco
```
Expand Down
2 changes: 1 addition & 1 deletion arangodb-foxx-services/__mocks__/@arangodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ exports.aql = function aql(templateStrings, ...args) {
return {
query,
bindVars,
_source: () => ({ strings, args })
_source: () => ({strings, args})
};
};

Expand Down
2 changes: 1 addition & 1 deletion arangodb-foxx-services/src/main/persistence/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@


import { DocumentKey } from '../model'
import Document = ArangoDB.Document
import { ExecutionPlan, Progress } from '../../external/api.model'
import Document = ArangoDB.Document


export enum AuxCollectionName {
Expand Down
8 changes: 4 additions & 4 deletions arangodb-foxx-services/src/main/services/commons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {DocumentKey, LineageOverview, DataSource, LineageGraph} from '../model'
import { DataSource, DocumentKey, LineageGraph, LineageOverview } from '../model'

import {aql, db} from '@arangodb'
import {memoize} from '../utils/common'
import {GraphBuilder} from '../utils/graph'
import { aql, db } from '@arangodb'
import { memoize } from '../utils/common'
import { GraphBuilder } from '../utils/graph'
import { ReadTxInfo } from '../persistence/model'
import { Progress } from '../../external/api.model'

Expand Down
4 changes: 2 additions & 2 deletions arangodb-foxx-services/src/main/services/lineage-overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import {DataSource, DocumentKey, LineageGraph, LineageOverview} from '../model'
import { DataSource, DocumentKey, LineageGraph, LineageOverview } from '../model'

import {observedWritesByRead} from './observed-writes-by-read'
import { observedWritesByRead } from './observed-writes-by-read'
import {
constructLineageOverview,
eventLineageOverviewGraph,
Expand Down
13 changes: 7 additions & 6 deletions arangodb-foxx-services/src/main/services/prune-database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
* limitations under the License.
*/

import {aql, db} from '@arangodb'
import { aql, db } from '@arangodb'
import * as Logger from '../utils/logger'


export function pruneBefore(timestamp) {
Logger.info(`[Spline] Prune data before: ${timestamp}`)
const t0 = Date.now()
Expand Down Expand Up @@ -53,15 +54,15 @@ export function pruneBefore(timestamp) {
const collections = ['executes', 'operation', 'follows', 'uses', 'expression', 'affects', 'depends', 'writesTo', 'readsFrom', 'emits', 'produces', 'consistsOf', 'derivesFrom', 'computedBy', 'takes', 'schema', 'attribute']
for (let i = 0; i < collections.length; i++) {
Logger.info('### Working on', collections[i], 'collection')
const startCount = db._query('RETURN COUNT(@@cols)', {'@cols': collections[i]}).toArray()[0]
const startCount = db._query('RETURN COUNT(@@cols)', { '@cols': collections[i] }).toArray()[0]
db._query('FOR orphanExecPlanID IN @arr FOR collectionEle IN @@cols FILTER collectionEle._belongsTo == orphanExecPlanID && collectionEle._created < @purgeLimitTimestamp REMOVE collectionEle IN @@cols',
{
'arr': orphanExecPlanIDsOlderThanThresholdDaysArray,
'@cols': collections[i],
'purgeLimitTimestamp': timestamp
}
)
const endCount = db._query('RETURN COUNT(@@cols)', {'@cols': collections[i]}).toArray()[0]
const endCount = db._query('RETURN COUNT(@@cols)', { '@cols': collections[i] }).toArray()[0]
Logger.info(startCount - endCount, collections[i], 'objects deleted...')
}

Expand All @@ -71,13 +72,13 @@ export function pruneBefore(timestamp) {
let endCount = 0

Logger.info('### Working on executionPlan collection')
startCount = db._query('RETURN COUNT(@@cols)', {'@cols': 'executionPlan'}).toArray()[0]
startCount = db._query('RETURN COUNT(@@cols)', { '@cols': 'executionPlan' }).toArray()[0]
db._query(aql`
FOR doc IN executionPlan
FILTER doc._id IN ${orphanExecPlanIDsOlderThanThresholdDaysArray}
REMOVE doc IN executionPlan
`)
endCount = db._query('RETURN COUNT(@@cols)', {'@cols': 'executionPlan'}).toArray()[0]
endCount = db._query('RETURN COUNT(@@cols)', { '@cols': 'executionPlan' }).toArray()[0]
Logger.info(startCount - endCount, 'executionPlan objects deleted...')

// Deleted other collections and then the orphanExecPlanIDs
Expand Down Expand Up @@ -117,7 +118,7 @@ export function pruneBefore(timestamp) {
`).toArray()

Logger.info('### Working on dataSource collection')
startCount = db._query('RETURN COUNT(@@cols)', {'@cols': 'dataSource'}).toArray()[0]
startCount = db._query('RETURN COUNT(@@cols)', { '@cols': 'dataSource' }).toArray()[0]
db._query(aql`
FOR source IN dataSource
FILTER source._key IN ${orphanDataSourceKeysOlderThanThresholdDaysArray}
Expand Down
2 changes: 1 addition & 1 deletion arangodb-foxx-services/src/main/services/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import { CollectionName, ReadTxInfo, TxAwareDocument, WriteTxInfo } from '../persistence/model'
import { db } from '@arangodb'
import { DocumentKey } from '../model'
import { TxManager } from './txm'
import Document = ArangoDB.Document
import DocumentMetadata = ArangoDB.DocumentMetadata
import { TxManager } from './txm'


const dbCollections: Record<CollectionName, ArangoDB.Collection> =
Expand Down
5 changes: 2 additions & 3 deletions arangodb-foxx-services/src/main/services/txm/tx-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
* limitations under the License.
*/

import {TxParams, WriteTxInfo} from '../../persistence/model'
import {TxManager} from './index'
import {aql, db} from '@arangodb'
import { TxParams, WriteTxInfo } from '../../persistence/model'
import { TxManager } from './index'


export class TxTemplate {
Expand Down
1 change: 1 addition & 0 deletions arangodb-foxx-services/src/main/utils/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
type TKey = string
type TValue = any

/* eslint-enable @typescript-eslint/no-explicit-any */

class DistinctCollector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test('startRead() should be delegated', () => {
})

test('startWrite() should be delegated', () => {
const dummySID: TxId = "dummy_tx_sid"
const dummySID: TxId = 'dummy_tx_sid'
const dummyTxParams: TxParams = {}
const dummyResult = {}
mockTxManagerImpl.startWrite.mockReturnValue(dummyResult)
Expand Down
2 changes: 1 addition & 1 deletion arangodb-foxx-services/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"esModuleInterop": true,
"esModuleInterop": true
}
}

0 comments on commit 2cf0638

Please sign in to comment.