{
  "repo": "tidbcloud/ffs",
  "binary": "ffs-client",
  "binary_path": "cmd/ffs-client/main.go",
  "dependencies": {
    "ClientLifecycle.RemoveMount": {
      "infrastructure": {},
      "services": [
        {
          "name": "universe",
          "target_interface": "UniverseService.GetZone",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "GetZone",
              "trigger": "Resolve zone endpoints before removing a mount",
              "conditions": ["Always"],
              "implementation": "client/server.go:107"
            }
          ]
        },
        {
          "name": "zone",
          "target_interface": "ZoneService.Locate",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Locate",
              "trigger": "Find realms for the mounted volume before cleanup",
              "conditions": ["Always"],
              "implementation": "client/server.go:121"
            }
          ]
        },
        {
          "name": "realm",
          "target_interface": "RealmControlService.Cleanup",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Located realms > 0"],
          "operations": [
            {
              "operation": "Cleanup",
              "trigger": "Remove realm-side mount data",
              "conditions": ["Located realms > 0"],
              "implementation": "client/server.go:139"
            }
          ]
        },
        {
          "name": "zone",
          "target_interface": "ZoneService.RemoveMount",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "RemoveMount",
              "trigger": "Delete mount metadata from zone",
              "conditions": ["Always"],
              "implementation": "client/server.go:146"
            }
          ]
        }
      ]
    },
    "ClientLifecycle.MustMount": {
      "infrastructure": {},
      "services": [
        {
          "name": "universe",
          "target_interface": "UniverseService.CreateTenant",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "CreateTenant",
              "trigger": "Ensure tenant exists before mount",
              "conditions": ["Always"],
              "implementation": "client/server.go:165"
            }
          ]
        },
        {
          "name": "universe",
          "target_interface": "UniverseService.GetZone",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "GetZone",
              "trigger": "Resolve zone endpoints for mount bootstrap",
              "conditions": ["Always"],
              "implementation": "client/server.go:173"
            }
          ]
        },
        {
          "name": "zone",
          "target_interface": "ZoneService.Locate",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Locate",
              "trigger": "Select realm placement for the mount",
              "conditions": ["Always"],
              "implementation": "client/server.go:187"
            }
          ]
        },
        {
          "name": "realm",
          "target_interface": "RealmControlService.Mount",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["For each located realm"],
          "operations": [
            {
              "operation": "Mount",
              "trigger": "Establish mount token and initial entries on each realm",
              "conditions": ["For each located realm"],
              "implementation": "client/server.go:229"
            }
          ]
        },
        {
          "name": "realm",
          "target_interface": "RealmControlService.Heartbeat",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Periodic background loop after mount"],
          "operations": [
            {
              "operation": "Heartbeat",
              "trigger": "Keep mounted realms alive and remount if needed",
              "conditions": ["Periodic background loop after mount"],
              "implementation": "client/server.go:296"
            }
          ]
        },
        {
          "name": "universe",
          "target_interface": "UniverseService.WatchZones",
          "operation_type": "grpc_stream",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Background loop after mount"],
          "operations": [
            {
              "operation": "WatchZones",
              "trigger": "Refresh zone endpoints when universe metadata changes",
              "conditions": ["Background loop after mount"],
              "implementation": "client/server.go:338"
            }
          ]
        },
        {
          "name": "zone",
          "target_interface": "ZoneService.WatchRealms",
          "operation_type": "grpc_stream",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Background loop per mounted realm"],
          "operations": [
            {
              "operation": "WatchRealms",
              "trigger": "Refresh realm addresses after mount",
              "conditions": ["Background loop per mounted realm"],
              "implementation": "client/server.go:373"
            }
          ]
        },
        {
          "name": "fuse",
          "target_interface": "fs.Mount",
          "operation_type": "fuse",
          "target_repo": "hanwen/go-fuse",
          "conditions": ["Bootstrap completed successfully"],
          "operations": [
            {
              "operation": "Mount",
              "trigger": "Mount the FUSE filesystem into the target path",
              "conditions": ["Bootstrap completed successfully"],
              "implementation": "client/server.go:414"
            }
          ]
        }
      ]
    },
    "ClientLifecycle.ListenForUnmount": {
      "infrastructure": {},
      "services": [
        {
          "name": "fuse",
          "target_interface": "fuse.Server.Unmount",
          "operation_type": "fuse",
          "target_repo": "hanwen/go-fuse",
          "conditions": ["Signal received"],
          "operations": [
            {
              "operation": "Unmount",
              "trigger": "Unmount the FUSE target when process receives a termination signal",
              "conditions": ["Signal received"],
              "implementation": "client/server.go:431"
            }
          ]
        }
      ]
    },
    "ClientLifecycle.Stop": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmControlService.Umount",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["For each mounted realm"],
          "operations": [
            {
              "operation": "Umount",
              "trigger": "Release mount state on all mounted realms during shutdown",
              "conditions": ["For each mounted realm"],
              "implementation": "client/server.go:454"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Readdir": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Readdir",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Not satisfied from merged cache only"],
          "operations": [
            {
              "operation": "Readdir",
              "trigger": "List directory entries from realm",
              "conditions": ["Not satisfied from merged cache only"],
              "implementation": "client/folder.go:174"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Mknod": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Mknod",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Non-merged mode only"],
          "operations": [
            {
              "operation": "Mknod",
              "trigger": "Create special file on realm",
              "conditions": ["Non-merged mode only"],
              "implementation": "client/folder.go:244"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Mkdir": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Mkdir",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Mkdir",
              "trigger": "Create directory on one or all realms",
              "conditions": ["Always"],
              "implementation": "client/folder.go:298"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Rmdir": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Rmdir",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Rmdir",
              "trigger": "Remove directory from one or all realms",
              "conditions": ["Always"],
              "implementation": "client/folder.go:397"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Lookup": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Lookup",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Non-merged mode; merged mode uses cached entries"],
          "operations": [
            {
              "operation": "Lookup",
              "trigger": "Fetch file metadata from realm",
              "conditions": ["Non-merged mode; merged mode uses cached entries"],
              "implementation": "client/folder.go:432"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Create": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Create",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Create",
              "trigger": "Create file and initial inode on realm",
              "conditions": ["Always"],
              "implementation": "client/folder.go:537"
            }
          ]
        },
        {
          "name": "realm",
          "target_interface": "RealmService.BatchCommands",
          "operation_type": "grpc_stream",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Create succeeded and file handle stream is opened"],
          "operations": [
            {
              "operation": "BatchCommands",
              "trigger": "Open batch command stream for subsequent file operations",
              "conditions": ["Create succeeded and file handle stream is opened"],
              "implementation": "client/folder.go:613"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Rename": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Rename",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Non-merged mode only"],
          "operations": [
            {
              "operation": "Rename",
              "trigger": "Rename path inside realm",
              "conditions": ["Non-merged mode only"],
              "implementation": "client/folder.go:662"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Link": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Link",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Non-merged mode only"],
          "operations": [
            {
              "operation": "Link",
              "trigger": "Create hard link in realm",
              "conditions": ["Non-merged mode only"],
              "implementation": "client/folder.go:692"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Symlink": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Symlink",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Non-merged mode only"],
          "operations": [
            {
              "operation": "Symlink",
              "trigger": "Create symlink in realm",
              "conditions": ["Non-merged mode only"],
              "implementation": "client/folder.go:737"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Unlink": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Unlink",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Unlink",
              "trigger": "Delete file from one or all realms",
              "conditions": ["Always"],
              "implementation": "client/folder.go:793"
            }
          ]
        }
      ]
    },
    "FUSEDirectoryService.Statfs": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Statfs",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Statfs",
              "trigger": "Fetch filesystem stats from realm",
              "conditions": ["Always"],
              "implementation": "client/folder.go:847"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Open": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Open",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Open",
              "trigger": "Open file handle on one selected realm or all realms",
              "conditions": ["Always"],
              "implementation": "client/file.go:67"
            }
          ]
        },
        {
          "name": "realm",
          "target_interface": "RealmService.BatchCommands",
          "operation_type": "grpc_stream",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["First active file descriptor for the file handle"],
          "operations": [
            {
              "operation": "BatchCommands",
              "trigger": "Open batch command stream for subsequent file operations",
              "conditions": ["First active file descriptor for the file handle"],
              "implementation": "client/file.go:169"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Read": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Read",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Cache miss or non-immutable cache"],
          "operations": [
            {
              "operation": "Read",
              "trigger": "Read file frames from realm",
              "conditions": ["Cache miss or non-immutable cache"],
              "implementation": "client/file.go:208"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Write": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.BatchCommands",
          "operation_type": "grpc_stream",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Write",
              "trigger": "Write file data through the open batch command stream",
              "conditions": ["Always"],
              "implementation": "client/file.go:298"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Flush": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.BatchCommands",
          "operation_type": "grpc_stream",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Flush",
              "trigger": "Flush pending writes through the batch command stream",
              "conditions": ["Always"],
              "implementation": "client/file.go:436"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Fsync": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Fsync",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Batch stream not used for this file handle"],
          "operations": [
            {
              "operation": "Fsync",
              "trigger": "Synchronize file contents to storage",
              "conditions": ["Batch stream not used for this file handle"],
              "implementation": "client/file.go:504"
            }
          ]
        },
        {
          "name": "realm",
          "target_interface": "RealmService.BatchCommands",
          "operation_type": "grpc_stream",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Batch stream already active for this file handle"],
          "operations": [
            {
              "operation": "Fsync",
              "trigger": "Synchronize file contents via the batch command stream",
              "conditions": ["Batch stream already active for this file handle"],
              "implementation": "client/file.go:531"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Release": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Close",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Close",
              "trigger": "Release remote file handle on realm",
              "conditions": ["Always"],
              "implementation": "client/file.go:584"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Setattr": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Setattr",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["No active batch stream for this file handle"],
          "operations": [
            {
              "operation": "Setattr",
              "trigger": "Update file metadata using unary RPC",
              "conditions": ["No active batch stream for this file handle"],
              "implementation": "client/file.go:730"
            }
          ]
        },
        {
          "name": "realm",
          "target_interface": "RealmService.BatchCommands",
          "operation_type": "grpc_stream",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Active batch stream for this file handle"],
          "operations": [
            {
              "operation": "Setattr",
              "trigger": "Update file metadata through the batch command stream",
              "conditions": ["Active batch stream for this file handle"],
              "implementation": "client/file.go:705"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Getattr": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Lookup",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Root inode metadata not initialized"],
          "operations": [
            {
              "operation": "Lookup",
              "trigger": "Resolve root inode metadata on first getattr",
              "conditions": ["Root inode metadata not initialized"],
              "implementation": "client/file.go:770"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Readlink": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Readlink",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Non-merged mode only"],
          "operations": [
            {
              "operation": "Readlink",
              "trigger": "Read symlink target from realm",
              "conditions": ["Non-merged mode only"],
              "implementation": "client/file.go:815"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Access": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.Access",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Non-merged mode only"],
          "operations": [
            {
              "operation": "Access",
              "trigger": "Check file access permissions through realm",
              "conditions": ["Non-merged mode only"],
              "implementation": "client/file.go:841"
            }
          ]
        }
      ]
    },
    "FUSEFileService.Allocate": {
      "infrastructure": {},
      "services": [
        {
          "name": "realm",
          "target_interface": "RealmService.BatchCommands",
          "operation_type": "grpc_stream",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Fallocate",
              "trigger": "Preallocate space through the batch command stream",
              "conditions": ["Always"],
              "implementation": "client/file.go:865"
            }
          ]
        }
      ]
    }
  },
  "notes": [
    "This binary is a FUSE client and exposes client lifecycle plus FUSE file and directory methods.",
    "Merged mode fans out some operations to multiple realms and can satisfy lookups from merged in-memory entries.",
    "BatchCommands is the main streaming channel for high-frequency file mutations after a handle is opened."
  ]
}
