{
  "repo": "tikv/migration",
  "binary": "gc-worker",
  "binary_path": "gc-worker/cmd/main.go",
  "dependencies": {
    "Runtime GCWorker.main": {
      "infrastructure": {
        "etcd": {
          "conditions": [
            "Always after startup completes"
          ],
          "operations": [
            {
              "operation": "ELECT GC LEADER",
              "trigger": "Campaign for gc-worker leadership through etcd",
              "conditions": [
                "The etcd client initializes successfully"
              ],
              "implementation": "startEtcdLoop in gc-worker/server/server.go"
            }
          ]
        },
        "grpc": {
          "conditions": [
            "Always while the worker talks to PD"
          ],
          "operations": [
            {
              "operation": "UPDATE GC SAFEPOINT",
              "trigger": "Use the PD gRPC client to maintain the service safepoint",
              "conditions": [
                "The worker is serving and has an active PD client"
              ],
              "implementation": "createPdClient and update loops in gc-worker/server/server.go"
            }
          ]
        }
      },
      "services": [
        {
          "name": "pd",
          "protocol": "grpc",
          "target_interface": "PD client",
          "purpose": "Read timestamps and update the GC safepoint"
        }
      ]
    }
  }
}
