Remove cruft

This commit is contained in:
Cyber MacGeddon 2025-05-04 22:20:17 +01:00
parent c06918a677
commit d5a84ae9e3
3 changed files with 16 additions and 52 deletions

View file

@ -37,7 +37,6 @@ class Librarian:
"Invalid document kind: " + request.document_metadata.kind
)
print("Existence test...")
if await self.table_store.document_exists(
request.document_metadata.user,
request.document_metadata.id
@ -47,11 +46,6 @@ class Librarian:
# Create object ID for blob
object_id = uuid.uuid4()
print("OID", object_id)
print(request.content)
print("CONT", base64.b64decode(request.content))
print("Add blob...")
await self.blob_store.add(
@ -77,7 +71,7 @@ class Librarian:
async def remove_document(self, request):
print("REMOVING...")
print("Removing doc...")
if not await self.table_store.document_exists(
request.user,
@ -111,7 +105,7 @@ class Librarian:
async def update_document(self, request):
print("UPDATING...")
print("Updating doc...")
# You can't update the document ID, user or kind.
@ -135,7 +129,7 @@ class Librarian:
async def get_document_metadata(self, request):
print("GET DOC...")
print("Get doc...")
doc = await self.table_store.get_document(
request.user,
@ -154,15 +148,13 @@ class Librarian:
async def get_document_content(self, request):
print("GET DOC CONTENT...")
print("Get doc content...")
object_id = await self.table_store.get_document_object_id(
request.user,
request.document_id
)
print("Now", object_id)
content = await self.blob_store.get(
object_id
)
@ -179,31 +171,24 @@ class Librarian:
async def add_processing(self, request):
print("LIST PROCESSING")
print("Add processing")
print("Existence test...")
if await self.table_store.processing_exists(
request.processing_metadata.user,
request.processing_metadata.id
):
raise RuntimeError("Processing already exists")
print("Does not already exist")
doc = await self.table_store.get_document(
request.processing_metadata.user,
request.processing_metadata.document_id
)
print("Got doc")
object_id = await self.table_store.get_document_object_id(
request.processing_metadata.user,
request.processing_metadata.document_id
)
print("Got object ID")
content = await self.blob_store.get(
object_id
)
@ -232,7 +217,7 @@ class Librarian:
async def remove_processing(self, request):
print("REMOVING...")
print("Removing processing...")
if not await self.table_store.processing_exists(
request.user,
@ -260,8 +245,6 @@ class Librarian:
docs = await self.table_store.list_documents(request.user)
print(docs)
return LibrarianResponse(
error = None,
document_metadata = None,
@ -272,12 +255,8 @@ class Librarian:
async def list_processing(self, request):
print("LIST PROCESSING")
procs = await self.table_store.list_processing(request.user)
print(procs)
return LibrarianResponse(
error = None,
document_metadata = None,

View file

@ -144,15 +144,9 @@ class Processor(AsyncProcessor):
def __del__(self):
pass
# self.running = False
async def load_document(self, document):
print(document)
print(document.flow)
doc = Document(
metadata = Metadata(
id = document.id,
@ -189,7 +183,7 @@ class Processor(AsyncProcessor):
if v.operation is None:
raise RequestError("Null operation")
print("op", v.operation)
print("requets", v.operation)
impls = {
"add-document": self.librarian.add_document,
@ -206,14 +200,10 @@ class Processor(AsyncProcessor):
if v.operation not in impls:
raise RequestError(f"Invalid operation: {v.operation}")
print("HANDLING...")
return await impls[v.operation](v)
async def on_librarian_request(self, msg, consumer, flow):
print("REQUEST")
v = msg.value()
# Sender-produced ID

View file

@ -437,7 +437,7 @@ class TableStore:
async def list_documents(self, user):
print("LIST")
print("List documents...")
while True:
@ -448,7 +448,6 @@ class TableStore:
(user,)
)
print("OK")
break
except Exception as e:
@ -479,15 +478,13 @@ class TableStore:
for row in resp
]
print("OK3")
print(lst)
print("Done")
return lst
async def get_document(self, user, id):
print("GET")
print("Get document")
while True:
@ -498,7 +495,6 @@ class TableStore:
(user, id)
)
print("OK")
break
except Exception as e:
@ -526,13 +522,15 @@ class TableStore:
tags = row[5],
object_id = row[6],
)
print("Done")
return doc
raise RuntimeError("No such document row?")
async def get_document_object_id(self, user, id):
print("GET")
print("Get document obj ID")
while True:
@ -543,7 +541,6 @@ class TableStore:
(user, id)
)
print("OK")
break
except Exception as e:
@ -553,6 +550,7 @@ class TableStore:
for row in resp:
print("Done")
return row[6]
raise RuntimeError("No such document row?")
@ -627,7 +625,7 @@ class TableStore:
async def list_processing(self, user):
print("LIST processing")
print("List processing objects")
while True:
@ -638,7 +636,6 @@ class TableStore:
(user,)
)
print("OK")
break
except Exception as e:
@ -660,9 +657,7 @@ class TableStore:
for row in resp
]
print("OK3")
print(lst)
print("Done")
return lst