| 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 engine.src.index.local_index; | 5 library services.src.index.local_index; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | |
| 9 | 8 |
| 10 import 'package:analyzer/index/index.dart'; | 9 import 'package:analysis_services/index/index.dart'; |
| 10 import 'package:analysis_services/src/index/index_contributor.dart' as contribut
ors; |
| 11 import 'package:analysis_services/src/index/store/split_store.dart'; |
| 11 import 'package:analyzer/src/generated/ast.dart'; | 12 import 'package:analyzer/src/generated/ast.dart'; |
| 12 import 'package:analyzer/src/generated/element.dart'; | 13 import 'package:analyzer/src/generated/element.dart'; |
| 13 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
| 14 import 'package:analyzer/src/generated/html.dart'; | 15 import 'package:analyzer/src/generated/html.dart'; |
| 15 import 'package:analyzer/src/generated/source.dart'; | 16 import 'package:analyzer/src/generated/source.dart'; |
| 16 import 'package:analyzer/src/index/index_contributor.dart' as contributors; | |
| 17 import 'package:analyzer/src/index/store/codec.dart'; | |
| 18 import 'package:analyzer/src/index/store/memory_node_manager.dart'; | |
| 19 import 'package:analyzer/src/index/store/separate_file_manager.dart'; | |
| 20 import 'package:analyzer/src/index/store/split_store.dart'; | |
| 21 | |
| 22 | |
| 23 Index createLocalFileSplitIndex(Directory directory) { | |
| 24 var fileManager = new SeparateFileManager(directory); | |
| 25 var stringCodec = new StringCodec(); | |
| 26 var nodeManager = new FileNodeManager(fileManager, | |
| 27 AnalysisEngine.instance.logger, stringCodec, new ContextCodec(), | |
| 28 new ElementCodec(stringCodec), new RelationshipCodec(stringCodec)); | |
| 29 return new LocalIndex(nodeManager); | |
| 30 } | |
| 31 | |
| 32 | |
| 33 Index createLocalMemorySplitIndex() { | |
| 34 return new LocalIndex(new MemoryNodeManager()); | |
| 35 } | |
| 36 | 17 |
| 37 | 18 |
| 38 /** | 19 /** |
| 39 * A local implementation of [Index]. | 20 * A local implementation of [Index]. |
| 40 */ | 21 */ |
| 41 class LocalIndex extends Index { | 22 class LocalIndex extends Index { |
| 42 SplitIndexStore _store; | 23 SplitIndexStore _store; |
| 43 | 24 |
| 44 LocalIndex(NodeManager nodeManager) { | 25 LocalIndex(NodeManager nodeManager) { |
| 45 _store = new SplitIndexStore(nodeManager); | 26 _store = new SplitIndexStore(nodeManager); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 @override | 76 @override |
| 96 void run() { | 77 void run() { |
| 97 // NO-OP for the local index | 78 // NO-OP for the local index |
| 98 } | 79 } |
| 99 | 80 |
| 100 @override | 81 @override |
| 101 void stop() { | 82 void stop() { |
| 102 // NO-OP for the local index | 83 // NO-OP for the local index |
| 103 } | 84 } |
| 104 } | 85 } |
| OLD | NEW |