Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: pkg/analysis_services/lib/src/index/store/temporary_folder_file_manager.dart

Issue 484733003: Import analysis_services.dart into analysis_server.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_services/lib/src/index/store/temporary_folder_file_manager.dart
diff --git a/pkg/analysis_services/lib/src/index/store/temporary_folder_file_manager.dart b/pkg/analysis_services/lib/src/index/store/temporary_folder_file_manager.dart
deleted file mode 100644
index 331da600638d3557027f2d3674df9f4ea63d600e..0000000000000000000000000000000000000000
--- a/pkg/analysis_services/lib/src/index/store/temporary_folder_file_manager.dart
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library services.src.index.store.temporary_folder_file_mananer;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:analysis_services/src/index/store/split_store.dart';
-import 'package:path/path.dart' as pathos;
-
-
-/**
- * An implementation of [FileManager] that keeps each file in a separate file
- * in a temporary folder.
- */
-class TemporaryFolderFileManager implements FileManager {
- Directory _directory;
-
- Directory get test_directory => _directory;
-
- @override
- void clear() {
- if (_directory != null) {
- try {
- _directory.deleteSync(recursive: true);
- } on FileSystemException {
- // For some reason, on Windows this sometimes results in the error:
- // "FileSystemException: Deletion failed, path = '...' (OS Error: The
- // process cannot access the file because it is being used by another
- // process., errno = 32). (Speculation: perhaps createTempSync is not
- // successfully creating a unique name, so multiple processes are
- // trying to access the same file?)
- //
- // For now, work around the problem by ignoring the exception.
- // TODO(paulberry): fix the actual root cause of this bug.
- }
- _directory = null;
- }
- }
-
- @override
- void delete(String name) {
- if (_directory == null) {
- return;
- }
- File file = _getFile(name);
- try {
- file.deleteSync();
- } catch (e) {
- }
- }
-
- @override
- Future<List<int>> read(String name) {
- if (_directory == null) {
- return new Future.value(null);
- }
- File file = _getFile(name);
- return file.readAsBytes().catchError((e) {
- return null;
- });
- }
-
- @override
- Future write(String name, List<int> bytes) {
- _ensureDirectory();
- return _getFile(name).writeAsBytes(bytes);
- }
-
- void _ensureDirectory() {
- if (_directory == null) {
- Directory temp = Directory.systemTemp;
- _directory = temp.createTempSync('AnalysisServices_Index');
- }
- }
-
- File _getFile(String name) {
- String path = pathos.join(_directory.path, name);
- return new File(path);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698