Link.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { FanOut } from 'thingies/lib/fanout';
  2. import type { Node } from './Node';
  3. import type { Superblock } from './Superblock';
  4. export type LinkEventChildAdd = [type: 'child:add', link: Link, parent: Link];
  5. export type LinkEventChildDelete = [type: 'child:del', link: Link, parent: Link];
  6. export type LinkEvent = LinkEventChildAdd | LinkEventChildDelete;
  7. /**
  8. * Represents a hard link that points to an i-node `node`.
  9. */
  10. export declare class Link {
  11. readonly changes: FanOut<LinkEvent>;
  12. vol: Superblock;
  13. parent: Link | undefined;
  14. children: Map<string, Link | undefined>;
  15. private _steps;
  16. node: Node;
  17. ino: number;
  18. length: number;
  19. name: string;
  20. get steps(): string[];
  21. set steps(val: string[]);
  22. constructor(vol: Superblock, parent: Link | undefined, name: string);
  23. setNode(node: Node): void;
  24. getNode(): Node;
  25. createChild(name: string, node?: Node): Link;
  26. setChild(name: string, link?: Link): Link;
  27. deleteChild(link: Link): void;
  28. getChild(name: string): Link | undefined;
  29. getPath(): string;
  30. getParentPath(): string;
  31. getName(): string;
  32. toJSON(): {
  33. steps: string[];
  34. ino: number;
  35. children: string[];
  36. };
  37. syncSteps(): void;
  38. }