Link.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. /**
  12. * @deprecated Subscribe to the volume-level `Superblock.changes` bus or use
  13. * `CoreWatcher` instead.
  14. */
  15. readonly changes: FanOut<LinkEvent>;
  16. vol: Superblock;
  17. parent: Link | undefined;
  18. children: Map<string, Link | undefined>;
  19. private _steps;
  20. node: Node;
  21. ino: number;
  22. length: number;
  23. name: string;
  24. get steps(): string[];
  25. set steps(val: string[]);
  26. constructor(vol: Superblock, parent: Link | undefined, name: string);
  27. setNode(node: Node): void;
  28. getNode(): Node;
  29. createChild(name: string, node?: Node): Link;
  30. setChild(name: string, link?: Link): Link;
  31. deleteChild(link: Link): void;
  32. getChild(name: string): Link | undefined;
  33. getPath(): string;
  34. getParentPath(): string;
  35. getName(): string;
  36. toJSON(): {
  37. steps: string[];
  38. ino: number;
  39. children: string[];
  40. };
  41. syncSteps(): void;
  42. }