ProtocolBuffer generated code works

Made umports public

Added stub createChannel  method and Channel class
This commit is contained in:
Tristan B. Velloza Kildaire 2021-08-30 14:45:35 +02:00
parent 59d64a50df
commit aeec429991
9 changed files with 43 additions and 9 deletions

View File

@ -8,3 +8,18 @@ DNET client library. This library also contains some data structures used by the
There are two _"sets"_, persay, of data structures in the library, there are those generated by ProtocolBuffers and then which are used by the library internally. There are then the OOP data structures used by the user through the API. There are two _"sets"_, persay, of data structures in the library, there are those generated by ProtocolBuffers and then which are used by the library internally. There are then the OOP data structures used by the user through the API.
The former are located in `source/libdnet/protobuf/` and the latter in `source/libdnet/api/types/` The former are located in `source/libdnet/protobuf/` and the latter in `source/libdnet/api/types/`
## Todo
Below is a todo list of what needs to be done. There is a lot of work ahead and many projects that are being used to make this piece of art come to life.
- [ ] ProtocolBuffer definitions
- [ ] Server-side encoding
- [ ] Server-to-client
- [ ] Server-to-server (not urgent)
- [ ] Client-side encoding
- [ ] Encoder/Decoder functions (for the above)
- [ ] Setup eventing system
- [ ] `tristanable` dequeue loop with hooking system into `eventy`
- [ ] Task queuing and completion with `eventy`
- [ ] Asynchronous notifications support via `eventy`

Binary file not shown.

View File

@ -4,7 +4,7 @@
protoCodeFile=source/libdnet/protobuf/dnet.d protoCodeFile=source/libdnet/protobuf/dnet.d
# Fix up # Fix up
cat $protoCodeFile | sed -e "s/source.libdnet.protobuf./ /" > tmpFile cat $protoCodeFile | sed -e "s/import source.libdnet.protobuf./public import /" > tmpFile
# Fix up module header # Fix up module header
cat tmpFile | sed -e "s/dnet/libdnet.protobuf.dnet/" > tmpFile2 cat tmpFile | sed -e "s/dnet/libdnet.protobuf.dnet/" > tmpFile2

View File

@ -17,6 +17,21 @@ import libdnet.protobuf.dnet;
* is mirrored into the library) * is mirrored into the library)
*/ */
public final class Client public final class Client
{
public Channel createChannel(string name)
{
Channel newChannel;
/* TODO: Check if the channel exists firstly */
ChannelMessage d = new ChannelMessage();
d.name = name;
d.type = ChannelMessage.MessageType.CREATE;
return newChannel;
}
}
public final class Channel
{ {
} }

View File

@ -11,7 +11,8 @@ class ChannelMessage
{ {
@Proto(1) MessageType type = protoDefaultValue!MessageType; @Proto(1) MessageType type = protoDefaultValue!MessageType;
@Proto(2) string name = protoDefaultValue!string; @Proto(2) string name = protoDefaultValue!string;
@Proto(3) bytes additionalData = protoDefaultValue!bytes; @Proto(3) string statusCode = protoDefaultValue!string;
@Proto(4) bytes additionalData = protoDefaultValue!bytes;
enum MessageType enum MessageType
{ {

View File

@ -24,6 +24,9 @@ message ChannelMessage
// The channel to which the command applies // The channel to which the command applies
string name = 2; string name = 2;
// (Only for returns)
string statusCode = 3;
// Additional data (dependent on command) // Additional data (dependent on command)
bytes additionalData = 3; bytes additionalData = 4;
} }

View File

@ -1,13 +1,13 @@
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: libdnet.protobuf.dnet.proto // source: source/liblibdnet.protobuf.dnet/protobuf/dnet.proto
module libdnet.protobuf.dnet; module libdnet.protobuf.dnet;
import google.protobuf; import google.protobuf;
import account; public import account;
import channel; public import channel;
import server; public import server;
import property; public import property;
enum protocVersion = 3014000; enum protocVersion = 3014000;