{
  "repo": "tidbcloud/ffs",
  "binary": "realm-server",
  "binary_path": "cmd/realm-server/main.go",
  "dependencies": {
    "RealmControlService.Mount": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.MkdirAll",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "CREATE",
              "trigger": "Create mount directory",
              "conditions": ["Directory not exists"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmControlService.Umount": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "syscall.Unmount",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "UNMOUNT",
              "trigger": "Unmount realm filesystem",
              "conditions": ["Realm mounted"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmControlService.Cleanup": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.RemoveAll",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "DELETE",
              "trigger": "Cleanup realm directory",
              "conditions": ["Always"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmControlService.Heartbeat": {
      "infrastructure": {},
      "services": [
        {
          "name": "zone",
          "target_interface": "ZoneService.RealmHeartbeat",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HEARTBEAT",
              "trigger": "Send realm heartbeat to zone server",
              "conditions": ["Always"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Create": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Create",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "CREATE",
              "trigger": "Create file in realm",
              "conditions": ["Always"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Open": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Open",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "OPEN",
              "trigger": "Open file in realm",
              "conditions": ["File exists"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Fallocate": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "syscall.Fallocate",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "ALLOCATE",
              "trigger": "Preallocate disk space for file",
              "conditions": ["File open"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Read": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.File.Read",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "READ",
              "trigger": "Read from file in realm",
              "conditions": ["File open"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Write": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.File.Write",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "WRITE",
              "trigger": "Write to file in realm",
              "conditions": ["File open"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Flush": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.File.Sync",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "FLUSH",
              "trigger": "Flush file buffers",
              "conditions": ["File open"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Unlink": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Remove",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "DELETE",
              "trigger": "Delete file from realm",
              "conditions": ["File exists"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Readdir": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.File.Readdir",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "READ",
              "trigger": "Read directory entries",
              "conditions": ["Directory exists"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Lookup": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Stat",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "GET",
              "trigger": "Lookup file attributes",
              "conditions": ["Always"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Close": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.File.Close",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "CLOSE",
              "trigger": "Close file handle",
              "conditions": ["File open"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Fsync": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "syscall.Fsync",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SYNC",
              "trigger": "Sync file to disk",
              "conditions": ["File open"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Link": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Link",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "LINK",
              "trigger": "Create hard link",
              "conditions": ["Source exists"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Symlink": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Symlink",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "CREATE",
              "trigger": "Create symbolic link",
              "conditions": ["Always"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Readlink": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Readlink",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "READ",
              "trigger": "Read symbolic link target",
              "conditions": ["Symlink exists"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Rename": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Rename",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "MOVE",
              "trigger": "Rename file or directory",
              "conditions": ["Source exists"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Mknod": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "syscall.Mknod",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "CREATE",
              "trigger": "Create special file",
              "conditions": ["Always"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Mkdir": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Mkdir",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "CREATE",
              "trigger": "Create directory",
              "conditions": ["Parent exists"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Rmdir": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Remove",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "DELETE",
              "trigger": "Remove empty directory",
              "conditions": ["Directory empty"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Statfs": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "syscall.Statfs",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "GET",
              "trigger": "Get filesystem statistics",
              "conditions": ["Always"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Setattr": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "os.Chmod/os.Chown/os.Truncate",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SET",
              "trigger": "Set file attributes",
              "conditions": ["File exists"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.Access": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "syscall.Access",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "CHECK",
              "trigger": "Check file access permissions",
              "conditions": ["Always"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmService.BatchCommands": {
      "infrastructure": {},
      "services": [
        {
          "name": "local-filesystem",
          "target_interface": "Multiple file operations",
          "operation_type": "filesystem",
          "target_repo": "local",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "BATCH",
              "trigger": "Execute batch of file operations",
              "conditions": ["Always"],
              "implementation": "realm/server.go"
            }
          ]
        }
      ]
    },
    "RealmLifecycle.BootstrapZoneClient": {
      "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 during realm server bootstrap",
              "conditions": ["Always"],
              "implementation": "realm/server.go:84"
            }
          ]
        }
      ]
    },
    "RealmLifecycle.WatchZoneUpdates": {
      "infrastructure": {},
      "services": [
        {
          "name": "universe",
          "target_interface": "UniverseService.WatchZones",
          "operation_type": "grpc_stream",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Background loop after bootstrap"],
          "operations": [
            {
              "operation": "WatchZones",
              "trigger": "Watch zone endpoint changes and refresh the zone client",
              "conditions": ["Background loop after bootstrap"],
              "implementation": "realm/server.go:119"
            }
          ]
        }
      ]
    },
    "RealmLifecycle.ReportRealmHeartbeat": {
      "infrastructure": {},
      "services": [
        {
          "name": "zone",
          "target_interface": "ZoneService.RealmHeartbeat",
          "operation_type": "grpc_client",
          "target_repo": "tidbcloud/ffs",
          "conditions": ["Periodic background loop"],
          "operations": [
            {
              "operation": "RealmHeartbeat",
              "trigger": "Report realm capacity and software version to zone",
              "conditions": ["Periodic background loop"],
              "implementation": "realm/server.go:167"
            }
          ]
        }
      ]
    }
  }
}
