WIP sketch protobuf req/resp types

This commit is contained in:
Oskar Thoren 2019-08-07 16:00:57 +08:00
parent de733f2ff6
commit 736078dbf8
No known key found for this signature in database
GPG Key ID: B2ECCFD3BC2EF77E
2 changed files with 71 additions and 1 deletions

View File

@ -70,3 +70,31 @@ What's in <>?
- This seems mostly relevant for ns_head
- lets just start with json thingy and NS/CAS sep
HASH1 and HASH2, all that matters. HASH1 is native for MVDS message (name?) and
HASH2 native to the remote log CAS.
For NS, we want to know how to update it in/communicate it.
And then actual format with mapping and paging, in a way that's adjustable, and
so on.
Can we generalize this to pack file for backups? Ie type and pointer to more etc
This would allow to go download whole thingy
also support many remote logs kind of thing, default or w/e
can we remove? scrub somehow.
### Protobuf next
Actually use them, and check enum and dispatching etc.
## Deps
Put in Makefile
nimble install https://github.com/PMunch/protobuf-nim

View File

@ -12,6 +12,49 @@ message ExampleMessage {
int32 a_field = 1;
}
}
// Note that some of these are for mocking and might not be part of the spec.
// Assuming only one
message CASPostRequest {
string data = 1;
}
// Respond with hash for success or error
// TODO: Maybe respond with more
message CASPostResponse {
string id = 1;
string data = 2;
}
message CASGetRequest {
string id = 1;
}
message CASGetResponse {
string id = 1;
string data = 2;
}
// TODO: This needs more fleshing out, what data is
message NSPostRequest {
string data = 1;
}
// Ok or error, how best represent?
// Assume ok
message NSPostResponse {
string info = 1;
}
// Needs more detail on topic
message NSGetRequest {
string topic = 1;
}
message NSGetResponse {
string data = 1;
}
"""
parseProto(protoSpec)
@ -35,4 +78,3 @@ if readMsg.has(number, text, nested) and readMsg.nested.has(aField):
echo readMsg.number
echo readMsg.text
echo readMsg.nested.aField