This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
SyncGlobalOptions.ts
68 lines (58 loc) · 1.75 KB
/
SyncGlobalOptions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* @module @raincatcher/datasync-cloud
*/
import * as sync from 'fh-sync';
/**
* List of global options passed to sync on init
*/
export interface SyncGlobalParameters {
/**
* How often the scheduler should check the datasetClients, in ms.
* Default: 500
*/
schedulerInterval?: number;
/**
* The default concurrency value when update dataset clients in the sync API.
* In most case this value should not need to be changed.
* Default is 10
*/
datasetClientUpdateConcurrency?: number;
/**
* If cache the dataset client records using redis.
* This can help improve performance for the syncRecords API.
* Can be turned on if there are no records are shared between many different dataset clients.
* Default is false.
*/
useCache?: boolean;
/**
* Specify the frequency the datasetClient cleaner should run.
* Default every hour ('1h')
*/
datasetClientCleanerCheckFrequency?: string;
}
/**
* Global sync options used to initialize sync
* @field datasetConfiguration - required mongodb and redis configuration
*/
export interface SyncOptions {
datasetConfiguration: SyncDataLayerOptions;
globalSyncOptions?: SyncGlobalParameters;
}
/**
* Required options for sync
*/
export interface SyncDataLayerOptions {
mongoDbConnectionUrl: string;
mongoDbOptions?: any;
redisConnectionUrl: string;
}
/**
* Provide custom hash function to determine if object was changed
*/
export type HashFunction = (object: any) => any;
/**
* Interface for handling collisions
*/
// tslint:disable-next-line:max-line-length
export type CollisionHandler = (datasetId: string, hash: string, timestamp: any, uid: string, pre: any, post: any, metaData: any, callback: sync.StandardCb<any>) => void;
export default SyncOptions;