Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a information about roles to the tt rs status output #849

Open
askalt opened this issue May 24, 2024 · 0 comments
Open

Add a information about roles to the tt rs status output #849

askalt opened this issue May 24, 2024 · 0 comments
Labels

Comments

@askalt
Copy link
Contributor

askalt commented May 24, 2024

Origin

Need to think about the way to output both "sharding roles" and "roles" for cluster config app some acceptable way.

2sp is here because there are existing tests that rely on the current status format.

def parse_status(buf: io.StringIO):
def next():
return buf.readline().rstrip("\n")
def cut(line=None, c=":"):
if line is None:
line = next()
ind = line.find(c)
return line[:ind].strip(), line[ind+1:].strip()
_, orchestrator = cut()
_, state = cut()
next()
replicasets = {}
line = next()
while line.startswith("• "):
replicaset_name = line.lstrip("• ")
replicaset = {}
line = next()
while not line.startswith(" "):
k, v = cut(line)
replicaset[k.lower()] = v
line = next()
instances = {}
while line.startswith(" "):
is_leader = line.startswith(" ★")
line = line[len(" ★ "):]
name, rest = cut(line, " ")
listen, mode = cut(rest, " ")
instances[name] = {
"is_leader": is_leader,
"listen": listen,
"mode": mode,
}
line = next()
replicaset["instances"] = instances
replicasets[replicaset_name] = replicaset
return {
"orchestrator": orchestrator,
"state": state,
"replicasets": replicasets,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants