2022-03-28 13:25:05 +00:00
|
|
|
import { PageMeta } from "../types";
|
|
|
|
import { SysCallMapping } from "../../plugos/system";
|
2022-03-31 12:28:07 +00:00
|
|
|
import { Storage } from "../disk_storage";
|
2022-03-28 13:25:05 +00:00
|
|
|
|
2022-03-31 12:28:07 +00:00
|
|
|
export default (storage: Storage): SysCallMapping => {
|
2022-03-28 13:25:05 +00:00
|
|
|
return {
|
|
|
|
listPages: (ctx): Promise<PageMeta[]> => {
|
2022-03-31 12:28:07 +00:00
|
|
|
return storage.listPages();
|
2022-03-28 13:25:05 +00:00
|
|
|
},
|
|
|
|
readPage: async (
|
|
|
|
ctx,
|
|
|
|
name: string
|
|
|
|
): Promise<{ text: string; meta: PageMeta }> => {
|
2022-03-31 12:28:07 +00:00
|
|
|
return storage.readPage(name);
|
2022-03-28 13:25:05 +00:00
|
|
|
},
|
|
|
|
writePage: async (ctx, name: string, text: string): Promise<PageMeta> => {
|
2022-03-31 12:28:07 +00:00
|
|
|
return storage.writePage(name, text);
|
2022-03-28 13:25:05 +00:00
|
|
|
},
|
|
|
|
deletePage: async (ctx, name: string) => {
|
2022-03-31 12:28:07 +00:00
|
|
|
return storage.deletePage(name);
|
2022-03-28 13:25:05 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|