trustgraph/trustgraph-base/trustgraph/schema/library.py

75 lines
1.6 KiB
Python
Raw Normal View History

2025-02-11 16:01:03 +00:00
from pulsar.schema import Record, Bytes, String, Array, Long
2025-02-11 16:01:03 +00:00
from . types import Triple
from . topic import topic
from . types import Error
from . metadata import Metadata
from . documents import Document, TextDocument
# add
# -> (id, document)
# <- ()
# <- (error)
# list
# -> (user, collection?)
# <- (info)
# <- (error)
2025-02-11 16:01:03 +00:00
# add(Metadata, Bytes) : error?
# copy(id, user, collection)
# move(id, user, collection)
# delete(id)
# get(id) : Bytes
# reindex(id)
# list(user, collection) : id[]
# info(id[]) : DocumentInfo[]
# search(<key,op,value>[]) : id[]
class DocumentPackage(Record):
id = String()
2025-02-11 16:01:03 +00:00
document = Bytes()
kind = String()
user = String()
collection = String()
title = String()
comments = String()
time = Long()
metadata = Array(Triple())
2025-02-11 16:01:03 +00:00
class DocumentInfo(Record):
id = String()
2025-02-11 16:01:03 +00:00
kind = String()
user = String()
collection = String()
title = String()
comments = String()
time = Long()
metadata = Array(Triple())
2025-02-11 16:01:03 +00:00
class Criteria(Record):
key = String()
value = String()
operator = String()
class LibrarianRequest(Record):
operation = String()
id = String()
document = DocumentPackage()
user = String()
collection = String()
criteria = Array(Criteria())
class LibrarianResponse(Record):
error = Error()
document = DocumentPackage()
info = Array(DocumentInfo())
librarian_request_queue = topic(
'librarian', kind='non-persistent', namespace='request'
)
librarian_response_queue = topic(
'librarian', kind='non-persistent', namespace='response',
)