Feature/flow librarian (#361)

* Update librarian to new API

* Implementing new schema with document + processing objects
This commit is contained in:
cybermaggedon 2025-05-04 22:26:19 +01:00 committed by GitHub
parent 6bf485788a
commit ff28d26f4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 1323 additions and 428 deletions

View file

@ -6,16 +6,52 @@ from . types import Error
from . metadata import Metadata
from . documents import Document, TextDocument
# add
# -> (id, document)
# add-document
# -> (document_id, document_metadata, content)
# <- ()
# <- (error)
# list
# -> (user, collection?)
# <- (info)
# remove-document
# -> (document_id)
# <- ()
# <- (error)
# update-document
# -> (document_id, document_metadata)
# <- ()
# <- (error)
# get-document-metadata
# -> (document_id)
# <- (document_metadata)
# <- (error)
# get-document-content
# -> (document_id)
# <- (content)
# <- (error)
# add-processing
# -> (processing_id, processing_metadata)
# <- ()
# <- (error)
# remove-processing
# -> (processing_id)
# <- ()
# <- (error)
# list-documents
# -> (user, collection?)
# <- (document_metadata[])
# <- (error)
# list-processing
# -> (user, collection?)
# <- (processing_metadata[])
# <- (error)
# OLD:
# add(Metadata, Bytes) : error?
# copy(id, user, collection)
# move(id, user, collection)
@ -26,26 +62,24 @@ from . documents import Document, TextDocument
# info(id[]) : DocumentInfo[]
# search(<key,op,value>[]) : id[]
class DocumentPackage(Record):
class DocumentMetadata(Record):
id = String()
document = Bytes()
time = Long()
kind = String()
user = String()
collection = String()
title = String()
comments = String()
time = Long()
metadata = Array(Triple())
user = String()
tags = Array(String())
class DocumentInfo(Record):
class ProcessingMetadata(Record):
id = String()
kind = String()
document_id = String()
time = Long()
flow = String()
user = String()
collection = String()
title = String()
comments = String()
time = Long()
metadata = Array(Triple())
tags = Array(String())
class Criteria(Record):
key = String()
@ -53,17 +87,43 @@ class Criteria(Record):
operator = String()
class LibrarianRequest(Record):
# add-document, remove-document, update-document, get-document-metadata,
# get-document-content, add-processing, remove-processing, list-documents,
# list-processing
operation = String()
id = String()
document = DocumentPackage()
# add-document, remove-document, update-document, get-document-metadata,
# get-document-content
document_id = String()
# add-processing, remove-processing
processing_id = String()
# add-document, update-document
document_metadata = DocumentMetadata()
# add-processing
processing_metadata = ProcessingMetadata()
# add-document
content = Bytes()
# list-documents, list-processing
user = String()
# list-documents?, list-processing?
collection = String()
#
criteria = Array(Criteria())
class LibrarianResponse(Record):
error = Error()
document = DocumentPackage()
info = Array(DocumentInfo())
document_metadata = DocumentMetadata()
content = Bytes()
document_metadatas = Array(DocumentMetadata())
processing_metadatas = Array(ProcessingMetadata())
librarian_request_queue = topic(
'librarian', kind='non-persistent', namespace='request'