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 7e0fdbd commit 866ba48
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions control-plane-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
from typing import Optional, List, Dict

import uvicorn
from fastapi import FastAPI
from fastapi import FastAPI, Request
from fastapi.security import HTTPBearer
from pydantic import BaseModel

oauth2_scheme = HTTPBearer()

app = FastAPI()


class GenericOption(BaseModel):
"""
Expand Down Expand Up @@ -250,22 +246,28 @@ class AttachHookResponse(BaseModel):
class WelcomeMessage(BaseModel):
message: str

oauth2_scheme = HTTPBearer()
app = FastAPI()


@app.get("/")
def read_root() -> WelcomeMessage:
return WelcomeMessage(message="Control Panel API is running")


#re_attach_request: ReAttachRequest
@app.post("/re-attach")
def re_attach(re_attach_request: ReAttachRequest) -> ReAttachResponse:
async def re_attach(request: Request) -> ReAttachResponse:
"""
Re-attach is called to re-attach a tenant to a page server to aqcuire a new generation number.
"""
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
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


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

0 comments on commit 866ba48

Please sign in to comment.