-
Notifications
You must be signed in to change notification settings - Fork 867
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Zhongnan Su <szhongna@amazon.com>
- Loading branch information
1 parent
4a9d4b0
commit 025dcca
Showing
4 changed files
with
72 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { Logger, OpenSearchClient, SavedObjectsClientContract } from 'src/core/server'; | ||
import { DataSourceClient } from './client'; | ||
import { IDataSourceService } from './types'; | ||
|
||
export class DataSourceService implements IDataSourceService { | ||
private openSearchClientsPool: Map<string, OpenSearchClient>; | ||
constructor() { | ||
this.openSearchClientsPool = new Map<string, OpenSearchClient>(); | ||
} | ||
// TODO: placeholders, need implement when adding global config | ||
isEnabled(): boolean { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getDataSourceClient(logger: Logger, savedObjectClient: SavedObjectsClientContract) { | ||
return new DataSourceClient({ | ||
logger, | ||
dataSourceService: this, | ||
scopedSavedObjectsClient: savedObjectClient, | ||
}); | ||
} | ||
// TODO: placeholders, need implement client pooling strategy | ||
addOpenSearchClient() {} | ||
getOpenSearchClient(): OpenSearchClient { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
// TODO: close all data source clients in the clients pool | ||
stop() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters