Skip to content

Commit

Permalink
BREAKING: remove filer specific methods from anura.fs (*xattr, mknod)
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammerIn-wonderland committed Oct 5, 2024
1 parent 1a218ad commit a600597
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 155 deletions.
113 changes: 0 additions & 113 deletions src/api/Filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,60 +223,6 @@ abstract class AnuraFSOperations<TStats> {
callback?: (err: Error | null) => void,
): void;

abstract setxattr(
path: string,
name: string,
value: string | object,
flag: "CREATE" | "REPLACE",
callback?: (err: Error | null) => void,
): void;

abstract setxattr(
path: string,
name: string,
value: string | object,
callback?: (err: Error | null) => void,
): void;

abstract fsetxattr(
fd: AnuraFD,
name: string,
value: string | object,
flag: "CREATE" | "REPLACE",
callback?: (err: Error | null) => void,
): void;

abstract fsetxattr(
fd: AnuraFD,
name: string,
value: string | object,
callback?: (err: Error | null) => void,
): void;

abstract getxattr(
path: string,
name: string,
callback?: (err: Error | null, value: string | object) => void,
): void;

abstract fgetxattr(
fd: AnuraFD,
name: string,
callback?: (err: Error | null, value: string | object) => void,
): void;

abstract removexattr(
path: string,
name: string,
callback?: (err: Error | null) => void,
): void;

abstract fremovexattr(
fd: AnuraFD,
name: string,
callback?: (err: Error | null) => void,
): void;

/*
* Asynchronous FS operations
*/
Expand All @@ -290,7 +236,6 @@ abstract class AnuraFSOperations<TStats> {
access(path: string, mode?: number): Promise<void>;
chown(path: string, uid: number, gid: number): Promise<void>;
chmod(path: string, mode: number): Promise<void>;
getxattr(path: string, name: string): Promise<string | object>;
link(srcPath: string, dstPath: string): Promise<void>;
lstat(path: string): Promise<TStats>;
mkdir(path: string, mode?: number): Promise<void>;
Expand All @@ -310,15 +255,8 @@ abstract class AnuraFSOperations<TStats> {
): Promise<string[]>;
readFile(path: string): Promise<Uint8Array>;
readlink(path: string): Promise<string>;
removexattr(path: string, name: string): Promise<void>;
rename(oldPath: string, newPath: string): Promise<void>;
rmdir(path: string): Promise<void>;
setxattr(
path: string,
name: string,
value: string | object,
flag?: "CREATE" | "REPLACE",
): Promise<void>;
stat(path: string): Promise<TStats>;
symlink(srcPath: string, dstPath: string, type?: string): Promise<void>;
truncate(path: string, len: number): Promise<void>;
Expand Down Expand Up @@ -1085,10 +1023,6 @@ class AnuraFilesystem implements AnuraFSOperations<any> {
this.processPath(path).unlink(path, callback);
}

mknod(path: string, mode: number, callback?: (err: Error | null) => void) {
this.processPath(path).mknod(path, mode, callback);
}

rmdir(path: string, callback?: (err: Error | null) => void) {
this.processPath(path).rmdir(path, callback);
}
Expand Down Expand Up @@ -1230,41 +1164,6 @@ class AnuraFilesystem implements AnuraFSOperations<any> {
this.processPath(path).appendFile(path, data, callback);
}

setxattr(path: string, ...rest: any[]) {
// @ts-ignore - Overloaded methods are scary
this.processPath(path).setxattr(path, ...rest);
}

fsetxattr(fd: AnuraFD, ...rest: any[]) {
// @ts-ignore - Overloaded methods are scary
this.processFD(fd).fsetxattr(fd, ...rest);
}

getxattr(
path: string,
name: string,
callback?: (err: Error | null, value: string | object) => void,
) {
this.processPath(path).getxattr(path, name, callback);
}

fgetxattr(fd: AnuraFD, ...rest: any[]) {
// @ts-ignore - Overloaded methods are scary
this.processFD(fd).fgetxattr(fd, ...rest);
}

removexattr(
path: string,
name: string,
callback?: (err: Error | null) => void,
) {
this.processPath(path).removexattr(path, name, callback);
}

fremovexattr(fd: AnuraFD, ...rest: any[]) {
// @ts-ignore - Overloaded methods are scary
this.processFD(fd).fremovexattr(fd, ...rest);
}
// @ts-ignore - This is still being implemented.
promises = {
appendFile: (
Expand All @@ -1288,17 +1187,13 @@ class AnuraFilesystem implements AnuraFSOperations<any> {
this.processPath(path).promises.chown(path, uid, gid),
chmod: (path: string, mode: number) =>
this.processPath(path).promises.chmod(path, mode),
getxattr: (path: string, name: string) =>
this.processPath(path).promises.getxattr(path, name),
link: (srcPath: string, dstPath: string) =>
this.processPath(srcPath).promises.link(srcPath, dstPath),
lstat: (path: string) => this.processPath(path).promises.lstat(path),
mkdir: (path: string, mode?: number) =>
this.processPath(path).promises.mkdir(path, mode),
mkdtemp: (prefix: string, options?: { encoding: string }) =>
this.providers.get("/")!.promises.mkdtemp(prefix, options),
mknod: (path: string, mode: number) =>
this.processPath(path).promises.mknod(path, mode),
open: async (
path: string,
flags: "r" | "r+" | "w" | "w+" | "a" | "a+",
Expand All @@ -1312,17 +1207,9 @@ class AnuraFilesystem implements AnuraFSOperations<any> {
this.processPath(path).promises.readFile(path),
readlink: (path: string) =>
this.processPath(path).promises.readlink(path),
removexattr: (path: string, name: string) =>
this.processPath(path).promises.removexattr(path, name),
rename: (oldPath: string, newPath: string) =>
this.processPath(oldPath).promises.rename(oldPath, newPath),
rmdir: (path: string) => this.processPath(path).promises.rmdir(path),
setxattr: (
path: string,
name: string,
value: string | object,
flag?: "CREATE" | "REPLACE",
) => this.processPath(path).promises.setxattr(path, name, value, flag),
stat: (path: string) => this.processPath(path).promises.stat(path),
symlink: (srcPath: string, dstPath: string, type?: string) =>
this.processPath(srcPath).promises.symlink(srcPath, dstPath, type),
Expand Down
42 changes: 0 additions & 42 deletions src/api/LocalFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,6 @@ class LocalFS extends AFSProvider<LocalFSStats> {
this.stats.set(path, currStats);
await this.promises.saveStats();
},
getxattr: () => {
console.error("Not implemented: getxattr");
throw new Error("Not implemented");
},
link: () => {
console.error("Not implemented: link");
throw new Error("Not implemented");
Expand Down Expand Up @@ -472,14 +468,6 @@ class LocalFS extends AFSProvider<LocalFSStats> {
console.error("Not implemented: readlink");
throw new Error("Not implemented");
},
removexattr: () => {
console.error("Not implemented: removexattr");
throw new Error("Not implemented");
},
setxattr: () => {
console.error("Not implemented: setxattr");
throw new Error("Not implemented");
},
symlink: () => {
console.error("Not implemented: symlink");
throw new Error("Not implemented");
Expand Down Expand Up @@ -646,36 +634,6 @@ class LocalFS extends AFSProvider<LocalFSStats> {
throw new Error("Method not implemented.");
}

setxattr() {
console.error("Not implemented: setxattr");
throw new Error("Method not implemented.");
}

fsetxattr() {
console.error("Not implemented: fsetxattr");
throw new Error("Method not implemented.");
}

getxattr() {
console.error("Not implemented: getxattr");
throw new Error("Method not implemented.");
}

fgetxattr() {
console.error("Not implemented: fgetxattr");
throw new Error("Method not implemented.");
}

removexattr() {
console.error("Not implemented: removexattr");
throw new Error("Method not implemented.");
}

fremovexattr() {
console.error("Not implemented: fremovexattr");
throw new Error("Method not implemented.");
}

utimes() {
console.error("Not implemented: utimes");
throw new Error("Method not implemented.");
Expand Down

0 comments on commit a600597

Please sign in to comment.