mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-30 02:46:23 +02:00
Schema structure refactor (#451)
* Write schema refactor spec * Implemented schema refactor spec
This commit is contained in:
parent
f4733021c5
commit
5de56c5dbc
27 changed files with 370 additions and 223 deletions
71
trustgraph-base/trustgraph/schema/services/config.py
Normal file
71
trustgraph-base/trustgraph/schema/services/config.py
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
|
||||
from pulsar.schema import Record, Bytes, String, Boolean, Array, Map, Integer
|
||||
|
||||
from ..core.topic import topic
|
||||
from ..core.primitives import Error
|
||||
|
||||
############################################################################
|
||||
|
||||
# Config service:
|
||||
# get(keys) -> (version, values)
|
||||
# list(type) -> (version, values)
|
||||
# getvalues(type) -> (version, values)
|
||||
# put(values) -> ()
|
||||
# delete(keys) -> ()
|
||||
# config() -> (version, config)
|
||||
class ConfigKey(Record):
|
||||
type = String()
|
||||
key = String()
|
||||
|
||||
class ConfigValue(Record):
|
||||
type = String()
|
||||
key = String()
|
||||
value = String()
|
||||
|
||||
# Prompt services, abstract the prompt generation
|
||||
class ConfigRequest(Record):
|
||||
|
||||
operation = String() # get, list, getvalues, delete, put, config
|
||||
|
||||
# get, delete
|
||||
keys = Array(ConfigKey())
|
||||
|
||||
# list, getvalues
|
||||
type = String()
|
||||
|
||||
# put
|
||||
values = Array(ConfigValue())
|
||||
|
||||
class ConfigResponse(Record):
|
||||
|
||||
# get, list, getvalues, config
|
||||
version = Integer()
|
||||
|
||||
# get, getvalues
|
||||
values = Array(ConfigValue())
|
||||
|
||||
# list
|
||||
directory = Array(String())
|
||||
|
||||
# config
|
||||
config = Map(Map(String()))
|
||||
|
||||
# Everything
|
||||
error = Error()
|
||||
|
||||
class ConfigPush(Record):
|
||||
version = Integer()
|
||||
config = Map(Map(String()))
|
||||
|
||||
config_request_queue = topic(
|
||||
'config', kind='non-persistent', namespace='request'
|
||||
)
|
||||
config_response_queue = topic(
|
||||
'config', kind='non-persistent', namespace='response'
|
||||
)
|
||||
config_push_queue = topic(
|
||||
'config', kind='persistent', namespace='config'
|
||||
)
|
||||
|
||||
############################################################################
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue