Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[_] chore: reconciliate master and windows #440

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"reload-virtual-drive": "yarn add --ignore-scripts ../../../node-win && npm run link-modules"
},
"dependencies": {
"@gcas/fuse": "^2.4.2",
"@rudderstack/rudder-sdk-node": "^1.1.4",
"better-sqlite3": "^8.3.0",
"typeorm": "^0.3.16",
Expand Down
27 changes: 1 addition & 26 deletions release/app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@
enabled "2.0.x"
kuler "^2.0.0"

"@gcas/fuse@^2.4.2":
version "2.4.2"
resolved "https://registry.yarnpkg.com/@gcas/fuse/-/fuse-2.4.2.tgz#149bd97ec8a60988f4868bacd719c7e8a1c41876"
integrity sha512-l/vVd2eXAuzKG4QilN1VRa8za5glndSK+jxcLrzMiXRrvbbCJthwqcBZUE3VzoRL0T/l7197tW+MKR9YeQCtZQ==
dependencies:
nanoresource "^1.3.0"
napi-macros "^2.0.0"

"@ioredis/commands@^1.1.1":
version "1.2.0"
resolved "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz"
Expand Down Expand Up @@ -622,12 +614,7 @@ minimatch@^5.0.1:
dependencies:
brace-expansion "^2.0.1"

minimist@^1.2.0, minimist@^1.2.3:
version "1.2.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==

minimist@^1.2.6:
minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.6:
version "1.2.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
Expand Down Expand Up @@ -682,23 +669,11 @@ mz@^2.4.0:
object-assign "^4.0.1"
thenify-all "^1.0.0"

nanoresource@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/nanoresource/-/nanoresource-1.3.0.tgz#823945d9667ab3e81a8b2591ab8d734552878cd0"
integrity sha512-OI5dswqipmlYfyL3k/YMm7mbERlh4Bd1KuKdMHpeoVD1iVxqxaTMKleB4qaA2mbQZ6/zMNSxCXv9M9P/YbqTuQ==
dependencies:
inherits "^2.0.4"

napi-build-utils@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806"
integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==

napi-macros@^2.0.0:
version "2.2.2"
resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.2.2.tgz#817fef20c3e0e40a963fbf7b37d1600bd0201044"
integrity sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==

node-abi@^3.3.0:
version "3.51.0"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.51.0.tgz#970bf595ef5a26a271307f8a4befa02823d4e87d"
Expand Down
1 change: 0 additions & 1 deletion src/apps/fuse/FuseApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
const fuse = require('@gcas/fuse');

export class FuseApp {
private static readonly SID = 41033;
private _fuse: any;

Check warning on line 21 in src/apps/fuse/FuseApp.ts

View workflow job for this annotation

GitHub Actions / 🧪 Lint and test

Unexpected any. Specify a different type

Check warning on line 21 in src/apps/fuse/FuseApp.ts

View workflow job for this annotation

GitHub Actions / 🧪 Lint and test

Unexpected any. Specify a different type

constructor(
private readonly fuseContainer: FuseDependencyContainer,
Expand Down Expand Up @@ -86,7 +85,7 @@
force: true,
});

this._fuse.mount((err: any) => {

Check warning on line 88 in src/apps/fuse/FuseApp.ts

View workflow job for this annotation

GitHub Actions / 🧪 Lint and test

Unexpected any. Specify a different type

Check warning on line 88 in src/apps/fuse/FuseApp.ts

View workflow job for this annotation

GitHub Actions / 🧪 Lint and test

Unexpected any. Specify a different type
if (err) {
Logger.error(`[FUSE] mount error: ${err}`);
}
Expand All @@ -94,7 +93,7 @@
}

async stop(): Promise<void> {
this._fuse?.unmount((err: any) => {

Check warning on line 96 in src/apps/fuse/FuseApp.ts

View workflow job for this annotation

GitHub Actions / 🧪 Lint and test

Unexpected any. Specify a different type

Check warning on line 96 in src/apps/fuse/FuseApp.ts

View workflow job for this annotation

GitHub Actions / 🧪 Lint and test

Unexpected any. Specify a different type
if (err) {
Logger.error(`[FUSE] unmount error: ${err}`);
}
Expand Down
5 changes: 4 additions & 1 deletion src/apps/fuse/callbacks/MakeDirectoryCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export class MakeDirectoryCallback extends NotifyFuseCallback {
} catch (err: unknown) {
const error = this.resolveError({ path, mode }, err);

this.container.syncFolderMessenger.error();
this.container.syncFolderMessenger.errorWhileCreating(
path,
'unknown error'
);

return this.left(error);
}
Expand Down
7 changes: 1 addition & 6 deletions src/apps/fuse/callbacks/StatFsCallback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { UserDependencyContainer } from '../dependency-injection/user/UserDependencyContainer';
import { FuseCallback } from './FuseCallback';
import Logger from 'electron-log';

Expand All @@ -17,11 +16,7 @@ type StatFsCallbackData = {
};

export class StatFsCallback extends FuseCallback<Partial<StatFsCallbackData>> {
constructor(
private readonly _userContainer: UserDependencyContainer,
private readonly localStats: Partial<StatFsCallbackData>,
private readonly sid: number
) {
constructor(private readonly localStats: Partial<StatFsCallbackData>) {
super('Stat FS');
}

Expand Down
1 change: 1 addition & 0 deletions src/apps/fuse/dependency-injection/user/usage/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export async function buildUsageContainer(): Promise<UsageContainer> {
const { photos } = Photos;

const repository = new CachedHttpUserUsageRepository(
// @ts-ignore
clients.newDrive,
photos
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import { SameFileWasMoved } from '../../../../../context/virtual-drive/files/app
import { File } from '../../../../../context/virtual-drive/files/domain/File';
import { FuseLocalFileSystem } from '../../../../../context/virtual-drive/files/infrastructure/FuseLocalFileSystem';
import { InMemoryFileRepository } from '../../../../../context/virtual-drive/files/infrastructure/InMemoryFileRepository';
import { MainProcessSyncFileMessenger } from '../../../../../context/virtual-drive/files/infrastructure/MainProcessSyncFileMessenger';
import { MainProcessSyncFileMessenger } from '../../../../../context/virtual-drive/files/infrastructure/SyncFileMessengers/MainProcessSyncFileMessenger';
import { SDKRemoteFileSystem } from '../../../../../context/virtual-drive/files/infrastructure/SDKRemoteFileSystem';
import { DependencyInjectionHttpClientsProvider } from '../../common/clients';
import { DependencyInjectionEventBus } from '../../common/eventBus';
import { DependencyInjectionEventRepository } from '../../common/eventRepository';
import { DependencyInjectionStorageSdk } from '../../common/sdk';
Expand All @@ -31,6 +32,7 @@ export async function buildFilesContainer(
const user = DependencyInjectionUserProvider.get();
const sdk = await DependencyInjectionStorageSdk.get();
const { bus: eventBus } = DependencyInjectionEventBus;
const clients = DependencyInjectionHttpClientsProvider.get();

const repositoryPopulator = new RepositoryPopulator(repository);

Expand All @@ -45,7 +47,12 @@ export async function buildFilesContainer(

const filesSearcher = new FilesSearcher(repository);

const remoteFileSystem = new SDKRemoteFileSystem(sdk, crypt, user.bucket);
const remoteFileSystem = new SDKRemoteFileSystem(
sdk,
clients,
crypt,
user.bucket
);
const localFileSystem = new FuseLocalFileSystem(
sharedContainer.relativePathToAbsoluteConverter
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Folder } from '../../../../../context/virtual-drive/folders/domain/Fold
import { FuseLocalFileSystem } from '../../../../../context/virtual-drive/folders/infrastructure/FuseLocalFileSystem';
import { HttpRemoteFileSystem } from '../../../../../context/virtual-drive/folders/infrastructure/HttpRemoteFileSystem';
import { InMemoryFolderRepository } from '../../../../../context/virtual-drive/folders/infrastructure/InMemoryFolderRepository';
import { MainProcessSyncFolderMessenger } from '../../../../../context/virtual-drive/folders/infrastructure/MainProcessSyncFolderMessenger';
import { MainProcessSyncFolderMessenger } from '../../../../../context/virtual-drive/folders/infrastructure/SyncMessengers/MainProcessSyncFolderMessenger';
import { DependencyInjectionHttpClientsProvider } from '../../common/clients';
import { DependencyInjectionEventBus } from '../../common/eventBus';

Expand Down
2 changes: 1 addition & 1 deletion src/apps/fuse/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Logger from 'electron-log';

import { app } from 'electron';
import { getRootVirtualDrive } from '../main/virutal-root-folder/service';
import eventBus from '../main/event-bus';
import { FuseApp } from './FuseApp';
import path from 'path';
import { FuseDependencyContainerFactory } from './dependency-injection/FuseDependencyContainerFactory';
import { HydrationApi } from '../hydration-api/HydrationApi';
import { getRootVirtualDrive } from '../main/virtual-root-folder/service';

let fuseApp: FuseApp;

Expand Down
2 changes: 0 additions & 2 deletions src/apps/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import './auth/handlers';
import './windows/settings';
import './windows/process-issues';
import './windows';
import './background-processes/sync-engine';
import '../fuse/index';
import './background-processes/process-issues';
import './device/handlers';
import './usage/handlers';
Expand Down
1 change: 0 additions & 1 deletion src/apps/main/remote-sync/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { ipcMain } from 'electron';
import { reportError } from '../bug-report/service';
import { sleep } from '../util';
import { broadcastToWindows } from '../windows';
import { updateSyncEngine } from '../background-processes/sync-engine';

let initialSyncReady = false;
const driveFilesCollection = new DriveFilesCollection();
Expand Down
7 changes: 7 additions & 0 deletions src/apps/main/virtual-drive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (process.platform === 'win32') {
import('./background-processes/sync-engine');
}

if (process.platform === 'linux') {
import('../fuse');
}
6 changes: 6 additions & 0 deletions src/apps/shared/IPC/events/sync-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ type FileUpdatePayload = {
export type FolderEvents = {
FOLDER_CREATING: (payload: { name: string }) => void;
FOLDER_CREATED: (payload: { name: string }) => void;
FOLDER_CREATION_ERROR: (payload: { name: string; error: string }) => void;

FOLDER_RENAMING: (payload: { oldName: string; newName: string }) => void;
FOLDER_RENAMED: (payload: { oldName: string; newName: string }) => void;
FOLDER_RENAME_ERROR: (payload: {
oldName: string;
newName: string;
error: string;
}) => void;
};

export type FilesEvents = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import crypt from '../../../../context/shared/infrastructure/crypt';
import { Traverser } from '../../../../context/virtual-drive/items/application/Traverser';
import { DependencyInjectionUserProvider } from './user';
import { ipcRendererSyncEngine } from '../../ipcRendererSyncEngine';

export class DependencyInjectionTraverserProvider {
private static traverser: Traverser;
Expand All @@ -13,11 +12,7 @@ export class DependencyInjectionTraverserProvider {

const user = DependencyInjectionUserProvider.get();

const traverser = Traverser.existingItems(
crypt,
ipcRendererSyncEngine,
user.root_folder_id
);
const traverser = Traverser.existingItems(crypt, user.root_folder_id);

DependencyInjectionTraverserProvider.traverser = traverser;

Expand Down
26 changes: 15 additions & 11 deletions src/apps/sync-engine/dependency-injection/files/builder.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import crypt from '../../../../context/shared/infrastructure/crypt';
import { DependencyInjectionEventBus } from '../common/eventBus';
import { DependencyInjectionEventRepository } from '../common/eventRepository';
import { DependencyInjectionUserProvider } from '../common/user';
import { DependencyInjectionVirtualDrive } from '../common/virtualDrive';
import { FoldersContainer } from '../folders/FoldersContainer';
import { SharedContainer } from '../shared/SharedContainer';
import { FilesContainer } from './FilesContainer';
import { DependencyInjectionStorageSdk } from '../common/sdk';
import { CreateFilePlaceholderOnDeletionFailed } from '../../../../context/virtual-drive/files/application/CreateFilePlaceholderOnDeletionFailed';
import { FileCreator } from '../../../../context/virtual-drive/files/application/FileCreator';
import { FileDeleter } from '../../../../context/virtual-drive/files/application/FileDeleter';
Expand All @@ -19,11 +11,20 @@ import { RepositoryPopulator } from '../../../../context/virtual-drive/files/app
import { RetrieveAllFiles } from '../../../../context/virtual-drive/files/application/RetrieveAllFiles';
import { SameFileWasMoved } from '../../../../context/virtual-drive/files/application/SameFileWasMoved';
import { InMemoryFileRepository } from '../../../../context/virtual-drive/files/infrastructure/InMemoryFileRepository';
import { SDKRemoteFileSystem } from '../../../../context/virtual-drive/files/infrastructure/SDKRemoteFileSystem';
import { NodeWinLocalFileSystem } from '../../../../context/virtual-drive/files/infrastructure/NodeWinLocalFileSystem';
import { SDKRemoteFileSystem } from '../../../../context/virtual-drive/files/infrastructure/SDKRemoteFileSystem';
import { BackgroundProcessSyncFileMessenger } from '../../../../context/virtual-drive/files/infrastructure/SyncFileMessengers/BackgroundProcessSyncFileMessenger';
import { LocalFileIdProvider } from '../../../../context/virtual-drive/shared/application/LocalFileIdProvider';
import { MainProcessSyncFileMessenger } from '../../../../context/virtual-drive/files/infrastructure/MainProcessSyncFileMessenger';
import { ipcRendererSyncEngine } from '../../ipcRendererSyncEngine';
import { DependencyInjectionHttpClientsProvider } from '../common/clients';
import { DependencyInjectionEventBus } from '../common/eventBus';
import { DependencyInjectionEventRepository } from '../common/eventRepository';
import { DependencyInjectionStorageSdk } from '../common/sdk';
import { DependencyInjectionUserProvider } from '../common/user';
import { DependencyInjectionVirtualDrive } from '../common/virtualDrive';
import { FoldersContainer } from '../folders/FoldersContainer';
import { SharedContainer } from '../shared/SharedContainer';
import { FilesContainer } from './FilesContainer';

export async function buildFilesContainer(
folderContainer: FoldersContainer,
Expand All @@ -50,7 +51,10 @@ export async function buildFilesContainer(
virtualDrive,
sharedContainer.relativePathToAbsoluteConverter
);
const syncFileMessenger = new MainProcessSyncFileMessenger();

const syncFileMessenger = new BackgroundProcessSyncFileMessenger(
ipcRendererSyncEngine
);

const repository = new InMemoryFileRepository();

Expand Down
9 changes: 6 additions & 3 deletions src/apps/sync-engine/dependency-injection/folders/builder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { NodeWinLocalFileSystem } from '../../../../context/virtual-drive/folders/infrastructure/NodeWinLocalFileSystem';
import { AllParentFoldersStatusIsExists } from '../../../../context/virtual-drive/folders/application/AllParentFoldersStatusIsExists';
import { FolderByPartialSearcher } from '../../../../context/virtual-drive/folders/application/FolderByPartialSearcher';
import { FolderCreatorFromOfflineFolder } from '../../../../context/virtual-drive/folders/application/FolderCreatorFromOfflineFolder';
Expand All @@ -20,13 +19,15 @@ import { FolderPlaceholderUpdater } from '../../../../context/virtual-drive/fold
import { HttpRemoteFileSystem } from '../../../../context/virtual-drive/folders/infrastructure/HttpRemoteFileSystem';
import { InMemoryFolderRepository } from '../../../../context/virtual-drive/folders/infrastructure/InMemoryFolderRepository';
import { InMemoryOfflineFolderRepository } from '../../../../context/virtual-drive/folders/infrastructure/InMemoryOfflineFolderRepository';
import { NodeWinLocalFileSystem } from '../../../../context/virtual-drive/folders/infrastructure/NodeWinLocalFileSystem';
import { BackgroundProcessSyncFolderMessenger } from '../../../../context/virtual-drive/folders/infrastructure/SyncMessengers/BackgroundProcessSyncFolderMessenger';
import { ipcRendererSyncEngine } from '../../ipcRendererSyncEngine';
import { DependencyInjectionHttpClientsProvider } from '../common/clients';
import { DependencyInjectionEventBus } from '../common/eventBus';
import { DependencyInjectionEventRepository } from '../common/eventRepository';
import { DependencyInjectionVirtualDrive } from '../common/virtualDrive';
import { SharedContainer } from '../shared/SharedContainer';
import { FoldersContainer } from './FoldersContainer';
import { MainProcessSyncFolderMessenger } from '../../../../context/virtual-drive/folders/infrastructure/MainProcessSyncFolderMessenger';

export async function buildFoldersContainer(
shredContainer: SharedContainer
Expand All @@ -38,7 +39,9 @@ export async function buildFoldersContainer(

const repository = new InMemoryFolderRepository();

const syncFolderMessenger = new MainProcessSyncFolderMessenger();
const syncFolderMessenger = new BackgroundProcessSyncFolderMessenger(
ipcRendererSyncEngine
);

const localFileSystem = new NodeWinLocalFileSystem(virtualDrive);
const remoteFileSystem = new HttpRemoteFileSystem(
Expand Down
6 changes: 5 additions & 1 deletion src/context/virtual-drive/files/application/FileCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ export class FileCreator {

const filePath = new FilePath(path);

await this.notifier.error(filePath.name(), filePath.extension(), message);
await this.notifier.errorWhileCreating(
filePath.name(),
filePath.extension(),
message
);

throw error;
}
Expand Down
12 changes: 8 additions & 4 deletions src/context/virtual-drive/files/domain/SyncFileMessenger.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
export interface SyncFileMessenger {
created(name: string, extension: string): Promise<void>;
error(name: string, extension: string, message: string): Promise<void>;
trashing(name: string, type: string, size: number): Promise<void>;
trashed(name: string, type: string, size: number): Promise<void>;
errorWhileCreating(
name: string,
extension: string,
message: string
): Promise<void>;
trashing(name: string, extension: string, size: number): Promise<void>;
trashed(name: string, extension: string, size: number): Promise<void>;
errorWhileTrashing(
name: string,
type: string,
extension: string,
message: string
): Promise<void>;
}
Loading
Loading