Skip to content

Commit

Permalink
Update control-plane-server.py
Browse files Browse the repository at this point in the history
  • Loading branch information
itsbalamurali committed Nov 13, 2023
1 parent 866ba48 commit e966e74
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions control-plane-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class DeltaOperation(BaseModel):
name: str
new_name: Optional[str] = None


class ComputeMode(Enum):
"""
An enumeration representing the different compute modes.
Expand Down Expand Up @@ -185,7 +186,7 @@ class ControlPlaneSpecResponse(BaseModel):


class ReAttachRequest(BaseModel):
node_id: str
node_id: int


class ReAttachResponseTenant(BaseModel):
Expand Down Expand Up @@ -246,6 +247,7 @@ class AttachHookResponse(BaseModel):
class WelcomeMessage(BaseModel):
message: str


oauth2_scheme = HTTPBearer()
app = FastAPI()

Expand All @@ -254,20 +256,18 @@ class WelcomeMessage(BaseModel):
def read_root() -> WelcomeMessage:
return WelcomeMessage(message="Control Panel API is running")

#re_attach_request: ReAttachRequest

#
@app.post("/re-attach")
async def re_attach(request: Request) -> ReAttachResponse:
async def re_attach(re_attach_request: ReAttachRequest) -> ReAttachResponse:
"""
Re-attach is called to re-attach a tenant to a page server to aqcuire a new generation number.
"""
req = await request.json()
print(req)
return req
# print(f"Re-attaching pageserver node: {re_attach_request.node_id}")
# tenants = []
# tenants.append(ReAttachResponseTenant(id=re_attach_request.node_id, gen=1))
# response = ReAttachResponse(tenants=tenants)
# return response
print(f"Re-attaching pageserver node: {re_attach_request.node_id}")
tenants = []
tenants.append(ReAttachResponseTenant(id=re_attach_request.node_id, gen=1))
response = ReAttachResponse(tenants=tenants)
return response


@app.post("/validate")
Expand Down

0 comments on commit e966e74

Please sign in to comment.