_checkShardTable(entityPath, classSet) {
        return __awaiter(this, void 0, void 0, function* () {
            if (typeof (entityPath) === 'function') {
                return;
            }
            const filePaths = glob_1.glob.sync(entityPath);
            for (const filePath of filePaths) {
                if (yield ToolUtils_1.ToolUtils.isCopyFile(filePath)) {
                    continue;
                }
                // find fileName
                const pathParse = LibPath.parse(filePath);
                const fileName = pathParse.name;
                // find rootPath to copy sharding table file
                const rootPath = pathParse.dir;
                const content = yield LibFs.readFile(filePath, 'utf-8');
                let className;
                try {
                    // find className
                    className = yield ToolUtils_1.ToolUtils.getClassName(content);
                }
                catch (error) {
                    debug(`caught finding className error = ${error}`);
                    continue;
                }
                classSet.add(className);
                EntityStorage_1.EntityStorage.instance.shardTableFileStorage[className] = filePath;
                let shardCount = 0;
                try {
                    // find sharding count
                    shardCount = yield ToolUtils_1.ToolUtils.getShardCount(content, className);
                }
                catch (error) {
                    debug(`caught finding table error = ${error}`);
                    continue;
                }
                classSet.delete(className);
                const classHash = new HashRing();
                for (let i = 0; i < shardCount; i++) {
                    try {
                        let newClassName = '';
                        // copy file
                        const { newFileName, newFilePath } = yield ToolUtils_1.ToolUtils.copyNewFile(fileName, filePath, rootPath, i);
                        // rewrite file
                        newClassName = yield ToolUtils_1.ToolUtils.rewriteFile(className, content, newFilePath, i);
                        classSet.add(newClassName);
                        classHash.add(newClassName);
                        EntityStorage_1.EntityStorage.instance.shardTableFileStorage[newClassName] = newFilePath;
                    }
                    catch (error) {
                        debug(`caught sharding table error = ${error}`);
                        continue;
                    }
                }
                this.shardHashMap[className] = classHash;
            }
            return;
        });
    }
/**
     * Read given path to find ShardTable then copy & rewrite shardTableEntity
     * @param {string | Function} entityPath
     * @param {Set<string>} classSet
     */
Read given path to find ShardTable then copy & rewrite shardTableEntity
@param {string | Function} entityPath
@param {Set} classSet
Read given path to find ShardTable then copy & rewrite shardTableEntity @param { string | Function } entityPath @param { Set } classSet
_checkShardTable(entityPath, classSet) {
        return __awaiter(this, void 0, void 0, function* () {
            if (typeof (entityPath) === 'function') {
                return;
            }
            const filePaths = glob_1.glob.sync(entityPath);
            for (const filePath of filePaths) {
                if (yield ToolUtils_1.ToolUtils.isCopyFile(filePath)) {
                    continue;
                }
                const pathParse = LibPath.parse(filePath);
                const fileName = pathParse.name;
                const rootPath = pathParse.dir;
                const content = yield LibFs.readFile(filePath, 'utf-8');
                let className;
                try {
                    className = yield ToolUtils_1.ToolUtils.getClassName(content);
                }
                catch (error) {
                    debug(`caught finding className error = ${error}`);
                    continue;
                }
                classSet.add(className);
                EntityStorage_1.EntityStorage.instance.shardTableFileStorage[className] = filePath;
                let shardCount = 0;
                try {
                    shardCount = yield ToolUtils_1.ToolUtils.getShardCount(content, className);
                }
                catch (error) {
                    debug(`caught finding table error = ${error}`);
                    continue;
                }
                classSet.delete(className);
                const classHash = new HashRing();
                for (let i = 0; i < shardCount; i++) {
                    try {
                        let newClassName = '';
                        const { newFileName, newFilePath } = yield ToolUtils_1.ToolUtils.copyNewFile(fileName, filePath, rootPath, i);
                        newClassName = yield ToolUtils_1.ToolUtils.rewriteFile(className, content, newFilePath, i);
                        classSet.add(newClassName);
                        classHash.add(newClassName);
                        EntityStorage_1.EntityStorage.instance.shardTableFileStorage[newClassName] = newFilePath;
                    }
                    catch (error) {
                        debug(`caught sharding table error = ${error}`);
                        continue;
                    }
                }
                this.shardHashMap[className] = classHash;
            }
            return;
        });
    }
_checkShardTable ( entityPath , classSet ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { if ( typeof ( entityPath ) === 'function' ) { return ; } const filePaths = glob_1 . glob . sync ( entityPath ) ; for ( const filePath of filePaths ) { if ( yield ToolUtils_1 . ToolUtils . isCopyFile ( filePath ) ) { continue ; } const pathParse = LibPath . parse ( filePath ) ; const fileName = pathParse . name ; const rootPath = pathParse . dir ; const content = yield LibFs . readFile ( filePath , 'utf-8' ) ; let className ; try { className = yield ToolUtils_1 . ToolUtils . getClassName ( content ) ; } catch ( error ) { debug ( ` ${ error } ` ) ; continue ; } classSet . add ( className ) ; EntityStorage_1 . EntityStorage . instance . shardTableFileStorage [ className ] = filePath ; let shardCount = 0 ; try { shardCount = yield ToolUtils_1 . ToolUtils . getShardCount ( content , className ) ; } catch ( error ) { debug ( ` ${ error } ` ) ; continue ; } classSet . delete ( className ) ; const classHash = new HashRing ( ) ; for ( let i = 0 ; i < shardCount ; i ++ ) { try { let newClassName = '' ; const { newFileName , newFilePath } = yield ToolUtils_1 . ToolUtils . copyNewFile ( fileName , filePath , rootPath , i ) ; newClassName = yield ToolUtils_1 . ToolUtils . rewriteFile ( className , content , newFilePath , i ) ; classSet . add ( newClassName ) ; classHash . add ( newClassName ) ; EntityStorage_1 . EntityStorage . instance . shardTableFileStorage [ newClassName ] = newFilePath ; } catch ( error ) { debug ( ` ${ error } ` ) ; continue ; } } this . shardHashMap [ className ] = classHash ; } return ; } ) ; }
Read given path to find ShardTable then copy & rewrite shardTableEntity
 @param {string | Function} entityPath
 @param {Set<string>} classSet
Read given path to find ShardTable then copy & rewrite shardTableEntity @param { string | Function } entityPath @param { Set<string > } classSet
// find fileName // find rootPath to copy sharding table file // find className // find sharding count // copy file // rewrite file