aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-10-24 06:40:07 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-10-24 06:40:07 +0300
commitadaddad79352c156303e9178a6f172a18af50cd2 (patch)
tree0ff2a59c3007bc9c40b7b543a9a2afe32dbc3d45 /Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore
parent2d803e9410cd383d8e66c300f86fe0f7374c81ea (diff)
downloadTango-adaddad79352c156303e9178a6f172a18af50cd2.tar.gz
Tango-adaddad79352c156303e9178a6f172a18af50cd2.zip
Refactored DataStore Proto.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs
index f11d37659..bf0eadae1 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs
@@ -52,17 +52,18 @@ namespace Tango.PPC.Common.DataStore
[ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStorePutRequest), RequestHandlerLoggingMode.LogRequestName)]
public async Task OnRemoteDataStorePutRequest(RemoteDataStorePutRequest request, String token, ExternalBridgeReceiver receiver)
{
- GetManager().GetCollection(request.Collection).Put(request.Key, request.DataType, request.Value);
+ GetManager().GetCollection(request.Collection).Put(request.Key, request.Value);
await receiver.SendGenericResponse(new RemoteDataStorePutResponse(), token);
}
[ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreGetRequest), RequestHandlerLoggingMode.LogRequestName)]
public async Task OnRemoteDataStoreGetRequest(RemoteDataStoreGetRequest request, String token, ExternalBridgeReceiver receiver)
{
- var value = GetManager().GetCollection(request.Collection).Get(request.Key, request.DefaultValue);
+ var item = GetManager().GetCollection(request.Collection).GetItem(request.Key, request.DefaultValue);
await receiver.SendGenericResponse(new RemoteDataStoreGetResponse()
{
- Value = value
+ DataType = item.Type,
+ Value = item.Value,
}, token);
}
@@ -227,6 +228,11 @@ namespace Tango.PPC.Common.DataStore
case Tango.DataStore.DataType.Bytes:
pmr.BytesValue = Google.Protobuf.ByteString.CopyFrom((byte[])Convert.ChangeType(item.Value, typeof(byte[])));
break;
+ case Tango.DataStore.DataType.Proto:
+ DataStoreProtoObject proto = item.Value as DataStoreProtoObject;
+ pmr.BytesValue = Google.Protobuf.ByteString.CopyFrom(proto.Data);
+ pmr.ProtoType = proto.MessageType;
+ break;
}
return pmr;
@@ -250,6 +256,8 @@ namespace Tango.PPC.Common.DataStore
return item.StringValue;
case PMR.DataStore.DataType.Bytes:
return item.BytesValue.ToByteArray();
+ case PMR.DataStore.DataType.Proto:
+ return DataStoreProtoObject.FromPMRDataStoreItem(item);
}
throw new NotSupportedException("The specified data type if not supported.");