| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library index; | 5 library index; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/index/store/codec.dart'; | 10 import 'package:analysis_server/src/index/store/codec.dart'; |
| 11 import 'package:analysis_server/src/index/store/separate_file_manager.dart'; | 11 import 'package:analysis_server/src/index/store/separate_file_manager.dart'; |
| 12 import 'package:analysis_server/src/index/store/split_store.dart'; | 12 import 'package:analysis_server/src/index/store/split_store.dart'; |
| 13 import 'package:analyzer/src/generated/ast.dart'; | 13 import 'package:analyzer/src/generated/ast.dart'; |
| 14 import 'package:analyzer/src/generated/element.dart'; | 14 import 'package:analyzer/src/generated/element.dart'; |
| 15 import 'package:analyzer/src/generated/engine.dart'; | 15 import 'package:analyzer/src/generated/engine.dart'; |
| 16 import 'package:analyzer/src/generated/html.dart'; | 16 import 'package:analyzer/src/generated/html.dart'; |
| 17 import 'package:analyzer/src/generated/index.dart'; | 17 import 'package:analyzer/src/generated/index.dart'; |
| 18 import 'package:analyzer/src/generated/source.dart'; | 18 import 'package:analyzer/src/generated/source.dart'; |
| 19 | 19 |
| 20 | 20 |
| 21 Index createLocalFileSplitIndex(Directory directory) { |
| 22 var fileManager = new SeparateFileManager(directory); |
| 23 var stringCodec = new StringCodec(); |
| 24 var nodeManager = new FileNodeManager(fileManager, |
| 25 AnalysisEngine.instance.logger, stringCodec, new ContextCodec(), |
| 26 new ElementCodec(stringCodec), new RelationshipCodec(stringCodec)); |
| 27 return new LocalIndex(nodeManager); |
| 28 } |
| 29 |
| 30 |
| 21 /** | 31 /** |
| 22 * An implementation of [Index] with [SplitIndexStore]. | 32 * A local implementation of [Index]. |
| 23 */ | 33 */ |
| 24 class LocalSplitIndex extends Index { | 34 class LocalIndex extends Index { |
| 25 SplitIndexStore _store; | 35 SplitIndexStore _store; |
| 26 | 36 |
| 27 LocalSplitIndex(Directory directory) { | 37 LocalIndex(NodeManager nodeManager) { |
| 28 var fileManager = new SeparateFileManager(directory); | |
| 29 var stringCodec = new StringCodec(); | |
| 30 var nodeManager = new FileNodeManager(fileManager, | |
| 31 AnalysisEngine.instance.logger, stringCodec, new ContextCodec(), | |
| 32 new ElementCodec(stringCodec), new RelationshipCodec(stringCodec)); | |
| 33 _store = new SplitIndexStore(nodeManager); | 38 _store = new SplitIndexStore(nodeManager); |
| 34 } | 39 } |
| 35 | 40 |
| 36 @override | 41 @override |
| 37 String get statistics => _store.statistics; | 42 String get statistics => _store.statistics; |
| 38 | 43 |
| 39 @override | 44 @override |
| 40 void clear() { | 45 void clear() { |
| 41 _store.clear(); | 46 _store.clear(); |
| 42 } | 47 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 @override | 106 @override |
| 102 void run() { | 107 void run() { |
| 103 // NO-OP if in the same isolate | 108 // NO-OP if in the same isolate |
| 104 } | 109 } |
| 105 | 110 |
| 106 @override | 111 @override |
| 107 void stop() { | 112 void stop() { |
| 108 // NO-OP if in the same isolate | 113 // NO-OP if in the same isolate |
| 109 } | 114 } |
| 110 } | 115 } |
| OLD | NEW |