1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-28 08:13:17 +03:00

Rename new objects

This commit is contained in:
Tae Won Ha 2020-01-18 17:42:11 +01:00
parent 523d2e73a2
commit 6309700a3b
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
12 changed files with 119 additions and 119 deletions

View File

@ -428,8 +428,8 @@
4BF70EE223D1B5B3009E51E9 /* FileScanBaton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EDF23D1B5B3009E51E9 /* FileScanBaton.m */; }; 4BF70EE223D1B5B3009E51E9 /* FileScanBaton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EDF23D1B5B3009E51E9 /* FileScanBaton.m */; };
4BF70EE523D1B5EC009E51E9 /* FileService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE323D1B5EC009E51E9 /* FileService.swift */; }; 4BF70EE523D1B5EC009E51E9 /* FileService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE323D1B5EC009E51E9 /* FileService.swift */; };
4BF70EE623D1B5EC009E51E9 /* FileService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE323D1B5EC009E51E9 /* FileService.swift */; }; 4BF70EE623D1B5EC009E51E9 /* FileService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE323D1B5EC009E51E9 /* FileService.swift */; };
4BF70EE723D1B5EC009E51E9 /* FileMonitor2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE423D1B5EC009E51E9 /* FileMonitor2.swift */; }; 4BF70EE723D1B5EC009E51E9 /* FuzzySearchFileMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE423D1B5EC009E51E9 /* FuzzySearchFileMonitor.swift */; };
4BF70EE823D1B5EC009E51E9 /* FileMonitor2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE423D1B5EC009E51E9 /* FileMonitor2.swift */; }; 4BF70EE823D1B5EC009E51E9 /* FuzzySearchFileMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE423D1B5EC009E51E9 /* FuzzySearchFileMonitor.swift */; };
4BF70EEA23D1B5FF009E51E9 /* CoreDataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE923D1B5FF009E51E9 /* CoreDataStack.swift */; }; 4BF70EEA23D1B5FF009E51E9 /* CoreDataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE923D1B5FF009E51E9 /* CoreDataStack.swift */; };
4BF70EEB23D1B5FF009E51E9 /* CoreDataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE923D1B5FF009E51E9 /* CoreDataStack.swift */; }; 4BF70EEB23D1B5FF009E51E9 /* CoreDataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EE923D1B5FF009E51E9 /* CoreDataStack.swift */; };
4BF70EED23D1B618009E51E9 /* ConditionVariable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EEC23D1B618009E51E9 /* ConditionVariable.swift */; }; 4BF70EED23D1B618009E51E9 /* ConditionVariable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BF70EEC23D1B618009E51E9 /* ConditionVariable.swift */; };
@ -723,13 +723,13 @@
4BF70EDF23D1B5B3009E51E9 /* FileScanBaton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FileScanBaton.m; sourceTree = "<group>"; }; 4BF70EDF23D1B5B3009E51E9 /* FileScanBaton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FileScanBaton.m; sourceTree = "<group>"; };
4BF70EE023D1B5B3009E51E9 /* FileScanBaton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileScanBaton.h; sourceTree = "<group>"; }; 4BF70EE023D1B5B3009E51E9 /* FileScanBaton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileScanBaton.h; sourceTree = "<group>"; };
4BF70EE323D1B5EC009E51E9 /* FileService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileService.swift; sourceTree = "<group>"; }; 4BF70EE323D1B5EC009E51E9 /* FileService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileService.swift; sourceTree = "<group>"; };
4BF70EE423D1B5EC009E51E9 /* FileMonitor2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileMonitor2.swift; sourceTree = "<group>"; }; 4BF70EE423D1B5EC009E51E9 /* FuzzySearchFileMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FuzzySearchFileMonitor.swift; sourceTree = "<group>"; };
4BF70EE923D1B5FF009E51E9 /* CoreDataStack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataStack.swift; sourceTree = "<group>"; }; 4BF70EE923D1B5FF009E51E9 /* CoreDataStack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataStack.swift; sourceTree = "<group>"; };
4BF70EEC23D1B618009E51E9 /* ConditionVariable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConditionVariable.swift; sourceTree = "<group>"; }; 4BF70EEC23D1B618009E51E9 /* ConditionVariable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConditionVariable.swift; sourceTree = "<group>"; };
4BF70EF723D1B6D9009E51E9 /* FileItem2+CoreDataProperties.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "FileItem2+CoreDataProperties.m"; sourceTree = "<group>"; }; 4BF70EFB23D36C8C009E51E9 /* FileItem+CoreDataProperties.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "FileItem+CoreDataProperties.m"; sourceTree = "<group>"; };
4BF70EF823D1B6D9009E51E9 /* FileItem2+CoreDataClass.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "FileItem2+CoreDataClass.m"; sourceTree = "<group>"; }; 4BF70EFC23D36C8C009E51E9 /* FileItem+CoreDataClass.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "FileItem+CoreDataClass.m"; sourceTree = "<group>"; };
4BF70EF923D1B6D9009E51E9 /* FileItem2+CoreDataProperties.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FileItem2+CoreDataProperties.h"; sourceTree = "<group>"; }; 4BF70EFD23D36C8C009E51E9 /* FileItem+CoreDataProperties.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FileItem+CoreDataProperties.h"; sourceTree = "<group>"; };
4BF70EFA23D1B6D9009E51E9 /* FileItem2+CoreDataClass.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FileItem2+CoreDataClass.h"; sourceTree = "<group>"; }; 4BF70EFE23D36C8C009E51E9 /* FileItem+CoreDataClass.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FileItem+CoreDataClass.h"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -1197,12 +1197,12 @@
4BF70ECB23D1B40A009E51E9 /* Fuzzy Search */ = { 4BF70ECB23D1B40A009E51E9 /* Fuzzy Search */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4BF70EF723D1B6D9009E51E9 /* FileItem2+CoreDataProperties.m */, 4BF70EFB23D36C8C009E51E9 /* FileItem+CoreDataProperties.m */,
4BF70EF823D1B6D9009E51E9 /* FileItem2+CoreDataClass.m */, 4BF70EFC23D36C8C009E51E9 /* FileItem+CoreDataClass.m */,
4BF70EF923D1B6D9009E51E9 /* FileItem2+CoreDataProperties.h */, 4BF70EFD23D36C8C009E51E9 /* FileItem+CoreDataProperties.h */,
4BF70EFA23D1B6D9009E51E9 /* FileItem2+CoreDataClass.h */, 4BF70EFE23D36C8C009E51E9 /* FileItem+CoreDataClass.h */,
4BF70EE923D1B5FF009E51E9 /* CoreDataStack.swift */, 4BF70EE923D1B5FF009E51E9 /* CoreDataStack.swift */,
4BF70EE423D1B5EC009E51E9 /* FileMonitor2.swift */, 4BF70EE423D1B5EC009E51E9 /* FuzzySearchFileMonitor.swift */,
4BF70EE323D1B5EC009E51E9 /* FileService.swift */, 4BF70EE323D1B5EC009E51E9 /* FileService.swift */,
4BF70ED823D1B591009E51E9 /* FuzzySearch.xcdatamodel */, 4BF70ED823D1B591009E51E9 /* FuzzySearch.xcdatamodel */,
4BF70ED423D1B54F009E51E9 /* ScoredUrl.h */, 4BF70ED423D1B54F009E51E9 /* ScoredUrl.h */,
@ -1581,7 +1581,7 @@
4B2636D0223A487B00021586 /* BufferListReducer.swift in Sources */, 4B2636D0223A487B00021586 /* BufferListReducer.swift in Sources */,
4B2636D1223A487B00021586 /* PrefWindow.swift in Sources */, 4B2636D1223A487B00021586 /* PrefWindow.swift in Sources */,
4B917E552334D52D00752149 /* EonilFSEventStream.swift in Sources */, 4B917E552334D52D00752149 /* EonilFSEventStream.swift in Sources */,
4BF70EE823D1B5EC009E51E9 /* FileMonitor2.swift in Sources */, 4BF70EE823D1B5EC009E51E9 /* FuzzySearchFileMonitor.swift in Sources */,
4B2636D2223A487B00021586 /* PrefPane.swift in Sources */, 4B2636D2223A487B00021586 /* PrefPane.swift in Sources */,
4B2636D3223A487B00021586 /* GeneralPref.swift in Sources */, 4B2636D3223A487B00021586 /* GeneralPref.swift in Sources */,
4B917E522334D52D00752149 /* EonilFSEventStreamEventFlags.swift in Sources */, 4B917E522334D52D00752149 /* EonilFSEventStreamEventFlags.swift in Sources */,
@ -1683,7 +1683,7 @@
1929B4E54E2F13A7F5F2B682 /* BufferListReducer.swift in Sources */, 1929B4E54E2F13A7F5F2B682 /* BufferListReducer.swift in Sources */,
1929BAE4900D72A7877741B1 /* PrefWindow.swift in Sources */, 1929BAE4900D72A7877741B1 /* PrefWindow.swift in Sources */,
4B917E532334D52D00752149 /* EonilFSEventStream.swift in Sources */, 4B917E532334D52D00752149 /* EonilFSEventStream.swift in Sources */,
4BF70EE723D1B5EC009E51E9 /* FileMonitor2.swift in Sources */, 4BF70EE723D1B5EC009E51E9 /* FuzzySearchFileMonitor.swift in Sources */,
1929BEAE0592096BC1191B67 /* PrefPane.swift in Sources */, 1929BEAE0592096BC1191B67 /* PrefPane.swift in Sources */,
1929BEDE1BE950EDA9497363 /* GeneralPref.swift in Sources */, 1929BEDE1BE950EDA9497363 /* GeneralPref.swift in Sources */,
4B917E502334D52D00752149 /* EonilFSEventStreamEventFlags.swift in Sources */, 4B917E502334D52D00752149 /* EonilFSEventStreamEventFlags.swift in Sources */,

View File

@ -9,4 +9,4 @@
#import "FoundationCommons.h" #import "FoundationCommons.h"
#import "ScoredUrl.h" #import "ScoredUrl.h"
#import "FileScanBaton.h" #import "FileScanBaton.h"
#import "FileItem2+CoreDataProperties.h" #import "FileItem+CoreDataProperties.h"

View File

@ -1,8 +1,8 @@
// //
// FileItem2+CoreDataClass.h // FileItem+CoreDataClass.h
// VimR // VimR
// //
// Created by Tae Won Ha on 17.01.20. // Created by Tae Won Ha on 18.01.20.
// Copyright © 2020 Tae Won Ha. All rights reserved. // Copyright © 2020 Tae Won Ha. All rights reserved.
// //
// //
@ -12,10 +12,10 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface FileItem2 : NSManagedObject @interface FileItem : NSManagedObject
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
#import "FileItem2+CoreDataProperties.h" #import "FileItem+CoreDataProperties.h"

View File

@ -0,0 +1,14 @@
//
// FileItem+CoreDataClass.m
// VimR
//
// Created by Tae Won Ha on 18.01.20.
// Copyright © 2020 Tae Won Ha. All rights reserved.
//
//
#import "FileItem+CoreDataClass.h"
@implementation FileItem
@end

View File

@ -0,0 +1,39 @@
//
// FileItem+CoreDataProperties.h
// VimR
//
// Created by Tae Won Ha on 18.01.20.
// Copyright © 2020 Tae Won Ha. All rights reserved.
//
//
#import "FileItem+CoreDataClass.h"
NS_ASSUME_NONNULL_BEGIN
@interface FileItem (CoreDataProperties)
+ (NSFetchRequest<FileItem *> *)fetchRequest;
@property (nonatomic) int16_t direntType;
@property (nonatomic) BOOL isHidden;
@property (nonatomic) BOOL isPackage;
@property (nonatomic) BOOL needsScanChildren;
@property (nullable, nonatomic, copy) NSString *pathStart;
@property (nullable, nonatomic, copy) NSURL *url;
@property (nullable, nonatomic, retain) NSSet<FileItem *> *children;
@property (nullable, nonatomic, retain) FileItem *parent;
@end
@interface FileItem (CoreDataGeneratedAccessors)
- (void)addChildrenObject:(FileItem *)value;
- (void)removeChildrenObject:(FileItem *)value;
- (void)addChildren:(NSSet<FileItem *> *)values;
- (void)removeChildren:(NSSet<FileItem *> *)values;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,27 @@
//
// FileItem+CoreDataProperties.m
// VimR
//
// Created by Tae Won Ha on 18.01.20.
// Copyright © 2020 Tae Won Ha. All rights reserved.
//
//
#import "FileItem+CoreDataProperties.h"
@implementation FileItem (CoreDataProperties)
+ (NSFetchRequest<FileItem *> *)fetchRequest {
return [NSFetchRequest fetchRequestWithEntityName:@"FileItem"];
}
@dynamic direntType;
@dynamic isHidden;
@dynamic isPackage;
@dynamic needsScanChildren;
@dynamic pathStart;
@dynamic url;
@dynamic children;
@dynamic parent;
@end

View File

@ -1,14 +0,0 @@
//
// FileItem2+CoreDataClass.m
// VimR
//
// Created by Tae Won Ha on 17.01.20.
// Copyright © 2020 Tae Won Ha. All rights reserved.
//
//
#import "FileItem2+CoreDataClass.h"
@implementation FileItem2
@end

View File

@ -1,39 +0,0 @@
//
// FileItem2+CoreDataProperties.h
// VimR
//
// Created by Tae Won Ha on 17.01.20.
// Copyright © 2020 Tae Won Ha. All rights reserved.
//
//
#import "FileItem2+CoreDataClass.h"
NS_ASSUME_NONNULL_BEGIN
@interface FileItem2 (CoreDataProperties)
+ (NSFetchRequest<FileItem2 *> *)fetchRequest;
@property (nonatomic) int16_t direntType;
@property (nonatomic) BOOL isHidden;
@property (nonatomic) BOOL isPackage;
@property (nonatomic) BOOL needsScanChildren;
@property (nullable, nonatomic, copy) NSString *pathStart;
@property (nullable, nonatomic, copy) NSURL *url;
@property (nullable, nonatomic, retain) NSSet<FileItem2 *> *children;
@property (nullable, nonatomic, retain) FileItem2 *parent;
@end
@interface FileItem2 (CoreDataGeneratedAccessors)
- (void)addChildrenObject:(FileItem2 *)value;
- (void)removeChildrenObject:(FileItem2 *)value;
- (void)addChildren:(NSSet<FileItem2 *> *)values;
- (void)removeChildren:(NSSet<FileItem2 *> *)values;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,27 +0,0 @@
//
// FileItem2+CoreDataProperties.m
// VimR
//
// Created by Tae Won Ha on 17.01.20.
// Copyright © 2020 Tae Won Ha. All rights reserved.
//
//
#import "FileItem2+CoreDataProperties.h"
@implementation FileItem2 (CoreDataProperties)
+ (NSFetchRequest<FileItem2 *> *)fetchRequest {
return [NSFetchRequest fetchRequestWithEntityName:@"FileItem2"];
}
@dynamic direntType;
@dynamic isHidden;
@dynamic isPackage;
@dynamic needsScanChildren;
@dynamic pathStart;
@dynamic url;
@dynamic children;
@dynamic parent;
@end

View File

@ -79,7 +79,7 @@ class FileService {
) { ) {
let predicate = NSPredicate(format: "direntType != %d", DT_DIR) let predicate = NSPredicate(format: "direntType != %d", DT_DIR)
let countReq = FileItem2.fetchRequest() let countReq = FileItem.fetchRequest()
countReq.predicate = predicate countReq.predicate = predicate
countReq.includesSubentities = false countReq.includesSubentities = false
guard let count = try? context.count(for: countReq) else { guard let count = try? context.count(for: countReq) else {
@ -89,7 +89,7 @@ class FileService {
self.log.info("Scoring \(count) Files for pattern \(matcherPool.pattern)") self.log.info("Scoring \(count) Files for pattern \(matcherPool.pattern)")
let urlSorter = NSSortDescriptor(key: "url", ascending: true) let urlSorter = NSSortDescriptor(key: "url", ascending: true)
let fetchReq = FileItem2.fetchRequest() let fetchReq = FileItem.fetchRequest()
fetchReq.fetchLimit = coreDataBatchSize fetchReq.fetchLimit = coreDataBatchSize
fetchReq.sortDescriptors = [urlSorter] fetchReq.sortDescriptors = [urlSorter]
fetchReq.predicate = predicate fetchReq.predicate = predicate
@ -146,7 +146,7 @@ class FileService {
var saveCounter = 1 var saveCounter = 1
var counter = 1 var counter = 1
guard let folder = context.object(with: folderId) as? FileItem2 else { guard let folder = context.object(with: folderId) as? FileItem else {
self.log.error("Could not convert object with ID \(folderId) to File") self.log.error("Could not convert object with ID \(folderId) to File")
return return
} }
@ -174,7 +174,7 @@ class FileService {
let childFiles = childUrls let childFiles = childUrls
.filter { !$0.isPackage } .filter { !$0.isPackage }
.map { url -> FileItem2 in self.file(fromUrl: url, pathStart: baton.pathStart, in: context) } .map { url -> FileItem in self.file(fromUrl: url, pathStart: baton.pathStart, in: context) }
saveCounter += childFiles.count saveCounter += childFiles.count
counter += childFiles.count counter += childFiles.count
@ -206,7 +206,7 @@ class FileService {
let ids = stack.map { $0.1.objectID } let ids = stack.map { $0.1.objectID }
stack = Array(zip( stack = Array(zip(
stack.map { $0.0 }, stack.map { $0.0 },
ids.map { context.object(with: $0) as! FileItem2 } ids.map { context.object(with: $0) as! FileItem }
)) ))
} }
} }
@ -246,7 +246,7 @@ class FileService {
callback: ([ScoredUrl]) -> () callback: ([ScoredUrl]) -> ()
) { ) {
let files = context.registeredObjects let files = context.registeredObjects
.compactMap { $0 as? FileItem2 } .compactMap { $0 as? FileItem }
.filter { $0.direntType != DT_DIR } .filter { $0.direntType != DT_DIR }
self.log.debug("Scoring \(files.count) Files") self.log.debug("Scoring \(files.count) Files")
@ -255,7 +255,7 @@ class FileService {
private func scoreFiles( private func scoreFiles(
matcherPool: FuzzyMatcherPool, matcherPool: FuzzyMatcherPool,
files: [FileItem2], files: [FileItem],
callback: ScoredUrlsCallback callback: ScoredUrlsCallback
) { ) {
let matchFullPath = matcherPool.pattern.contains("/") let matchFullPath = matcherPool.pattern.contains("/")
@ -290,7 +290,7 @@ class FileService {
) )
self.root = root self.root = root
self.writeContext = self.coreDataStack.newBackgroundContext() self.writeContext = self.coreDataStack.newBackgroundContext()
self.fileMonitor = FileMonitor2(urlToMonitor: root) self.fileMonitor = FuzzySearchFileMonitor(urlToMonitor: root)
self.queue.sync { self.ensureRootFileInStore() } self.queue.sync { self.ensureRootFileInStore() }
try self.fileMonitor.start { [weak self] url in self?.handleChange(in: url) } try self.fileMonitor.start { [weak self] url in self?.handleChange(in: url) }
@ -348,8 +348,8 @@ class FileService {
private func fileFetchRequest( private func fileFetchRequest(
_ format: String, _ format: String,
_ arguments: [Any]? = nil _ arguments: [Any]? = nil
) -> NSFetchRequest<FileItem2> { ) -> NSFetchRequest<FileItem> {
let req: NSFetchRequest<FileItem2> = FileItem2.fetchRequest() let req: NSFetchRequest<FileItem> = FileItem.fetchRequest()
req.predicate = NSPredicate(format: format, argumentArray: arguments) req.predicate = NSPredicate(format: format, argumentArray: arguments)
return req return req
@ -358,7 +358,7 @@ class FileService {
/// Call this in self.queue.(a)sync /// Call this in self.queue.(a)sync
private func deleteAllFiles() { private func deleteAllFiles() {
let delReq = NSBatchDeleteRequest( let delReq = NSBatchDeleteRequest(
fetchRequest: NSFetchRequest(entityName: String(describing: FileItem2.self)) fetchRequest: NSFetchRequest(entityName: String(describing: FileItem.self))
) )
let ctx = self.writeContext let ctx = self.writeContext
@ -405,8 +405,8 @@ class FileService {
fromUrl url: URL, fromUrl url: URL,
pathStart: String, pathStart: String,
in context: NSManagedObjectContext in context: NSManagedObjectContext
) -> FileItem2 { ) -> FileItem {
let file = FileItem2(context: context) let file = FileItem(context: context)
file.url = url file.url = url
file.direntType = Int16(url.direntType) file.direntType = Int16(url.direntType)
file.isHidden = url.isHidden file.isHidden = url.isHidden
@ -442,7 +442,7 @@ class FileService {
private let queue = DispatchQueue(label: "scan-score-queue", qos: .userInitiated) private let queue = DispatchQueue(label: "scan-score-queue", qos: .userInitiated)
private let fileMonitor: FileMonitor2 private let fileMonitor: FuzzySearchFileMonitor
private let writeContext: NSManagedObjectContext private let writeContext: NSManagedObjectContext
private let log = OSLog(subsystem: Defs.loggerSubsystem, category: Defs.LoggerCategory.service) private let log = OSLog(subsystem: Defs.loggerSubsystem, category: Defs.LoggerCategory.service)

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="15702" systemVersion="19C57" minimumToolsVersion="Automatic" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier=""> <model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="15702" systemVersion="19C57" minimumToolsVersion="Automatic" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
<entity name="FileItem2" representedClassName="FileItem2" syncable="YES" codeGenerationType="class"> <entity name="FileItem" representedClassName="FileItem" syncable="YES" codeGenerationType="class">
<attribute name="direntType" attributeType="Integer 16" usesScalarValueType="YES"/> <attribute name="direntType" attributeType="Integer 16" usesScalarValueType="YES"/>
<attribute name="isHidden" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="isHidden" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="isPackage" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="isPackage" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="needsScanChildren" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/> <attribute name="needsScanChildren" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="pathStart" attributeType="String"/> <attribute name="pathStart" attributeType="String"/>
<attribute name="url" attributeType="URI"/> <attribute name="url" attributeType="URI"/>
<relationship name="children" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="FileItem2" inverseName="parent" inverseEntity="FileItem2"/> <relationship name="children" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="FileItem" inverseName="parent" inverseEntity="FileItem"/>
<relationship name="parent" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="FileItem2" inverseName="children" inverseEntity="FileItem2"/> <relationship name="parent" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="FileItem" inverseName="children" inverseEntity="FileItem"/>
<fetchIndex name="byIsDirAndUrlIndex"> <fetchIndex name="byIsDirAndUrlIndex">
<fetchIndexElement property="direntType" type="Binary" order="ascending"/> <fetchIndexElement property="direntType" type="Binary" order="ascending"/>
<fetchIndexElement property="url" type="Binary" order="ascending"/> <fetchIndexElement property="url" type="Binary" order="ascending"/>
@ -19,6 +19,6 @@
</fetchIndex> </fetchIndex>
</entity> </entity>
<elements> <elements>
<element name="FileItem2" positionX="-63" positionY="-18" width="128" height="163"/> <element name="FileItem" positionX="-63" positionY="-18" width="128" height="163"/>
</elements> </elements>
</model> </model>

View File

@ -6,7 +6,7 @@
import Foundation import Foundation
import os import os
class FileMonitor2 { class FuzzySearchFileMonitor {
static let fileSystemEventsLatency = 1.0 static let fileSystemEventsLatency = 1.0
@ -14,7 +14,7 @@ class FileMonitor2 {
self.monitor = try EonilFSEventStream( self.monitor = try EonilFSEventStream(
pathsToWatch: [urlToMonitor.path], pathsToWatch: [urlToMonitor.path],
sinceWhen: EonilFSEventsEventID.getCurrentEventId(), sinceWhen: EonilFSEventsEventID.getCurrentEventId(),
latency: FileMonitor2.fileSystemEventsLatency, latency: FuzzySearchFileMonitor.fileSystemEventsLatency,
flags: [], flags: [],
handler: { [weak self] event in handler: { [weak self] event in
if event.flag == .historyDone { if event.flag == .historyDone {