refactor: Core server to support proto3#1844
Merged
JoshuaSBrown merged 8 commits into1837-DAPS-refactor-common-library-to-use-proto3from Feb 7, 2026
Merged
Conversation
Contributor
Reviewer's GuideRefactors the core server to use the new unified proto3 Sequence diagram for unified Envelope message handling in ClientWorkersequenceDiagram
actor Client
participant ClientWorker
participant ProtoBufMap
participant MessageFactory
participant DatabaseAPI
participant RepoServer
Client->>ClientWorker: send Envelope (Request)
activate ClientWorker
ClientWorker->>ProtoBufMap: getMessageType(message_field_name)
ProtoBufMap-->>ClientWorker: msg_type
ClientWorker->>ClientWorker: lookup m_msg_handlers[msg_type]
alt no_handler
ClientWorker->>MessageFactory: createResponseEnvelope(request)
MessageFactory-->>ClientWorker: Envelope (Response)
ClientWorker->>ClientWorker: create NackReply
ClientWorker->>ClientWorker: set err_code BAD_REQUEST
ClientWorker-->>Client: Envelope(NackReply)
else handler_found
ClientWorker->>ClientWorker: deserialize payload to Request message
ClientWorker->>ClientWorker: invoke handler(uid, Request)
alt dbPassThrough handler
ClientWorker->>DatabaseAPI: func(Request, Reply, LogContext)
activate DatabaseAPI
DatabaseAPI->>RepoServer: dbGet/dbPost
RepoServer-->>DatabaseAPI: JSON result
DatabaseAPI-->>ClientWorker: filled Reply
deactivate DatabaseAPI
else local handler
ClientWorker->>ClientWorker: perform local processing
end
ClientWorker->>MessageFactory: createResponseEnvelope(request)
MessageFactory-->>ClientWorker: Envelope (Response)
ClientWorker->>ClientWorker: attach Reply payload
ClientWorker-->>Client: Envelope(Reply)
end
deactivate ClientWorker
Updated class diagram for ClientWorker, DatabaseAPI, and TaskWorker with proto3 EnvelopeclassDiagram
class Envelope {
+string toString()
+void setPayload(google_protobuf_Message payload)
}
class ProtoBufMap {
+uint16_t getMessageType(string message_name)
+bool requiresAuth(string message_name)
+string toString(uint16_t msg_type)
}
class MessageFactory {
+Envelope createRequestEnvelope()
+Envelope createResponseEnvelope(Envelope request)
}
class DatabaseAPI {
+void clientAuthenticateByPassword(string password, SDMS_AuthStatusReply reply, LogContext log_context)
+void clientAuthenticateByToken(string token, SDMS_AuthStatusReply reply, LogContext log_context)
+void checkPerms(SDMS_CheckPermsRequest request, SDMS_CheckPermsReply reply, LogContext log_context)
+void getPerms(SDMS_GetPermsRequest request, SDMS_GetPermsReply reply, LogContext log_context)
+void userSetAccessToken(SDMS_UserSetAccessTokenRequest request, SDMS_AckReply reply, LogContext log_context)
+void userCreate(SDMS_UserCreateRequest request, SDMS_UserDataReply reply, LogContext log_context)
+void recordView(SDMS_RecordViewRequest request, SDMS_RecordDataReply reply, LogContext log_context)
+void generalSearch(SDMS_SearchRequest request, SDMS_ListingReply reply, LogContext log_context)
+void repoList(SDMS_RepoListRequest request, SDMS_RepoDataReply reply, LogContext log_context)
+void schemaSearch(SDMS_SchemaSearchRequest request, SDMS_SchemaDataReply reply, LogContext log_context)
+void dailyMessage(SDMS_DailyMessageRequest request, SDMS_DailyMessageReply reply, LogContext log_context)
+uint32_t parseSearchRequest(SDMS_SearchRequest request, string qry_begin, string qry_end, string qry_filter, string params, LogContext log_context)
-long dbGet(char url_path, vector~pair_string_string~ params, libjson_Value result, LogContext log_context)
-long dbPost(char url_path, vector~pair_string_string~ params, string body, libjson_Value result, LogContext log_context)
}
class ClientWorker {
-map~uint16_t,msg_fun_t~ m_msg_handlers
-ProtoBufMap* m_msg_mapper
-MessageFactory m_msg_factory
-DatabaseAPI* m_db
+void setupMsgHandlers()
+void workerThread(LogContext log_context)
+unique_ptr~IMessage~ procVersionRequest(string uid, VersionRequest request, LogContext log_context)
+unique_ptr~IMessage~ procAuthenticateByPasswordRequest(string uid, AuthenticateByPasswordRequest request, LogContext log_context)
+unique_ptr~IMessage~ procDataGetRequest(string uid, DataGetRequest request, LogContext log_context)
+unique_ptr~IMessage~ procRecordCreateRequest(string uid, RecordCreateRequest request, LogContext log_context)
+unique_ptr~IMessage~ procRepoAuthzRequest(string uid, RepoAuthzRequest request, LogContext log_context)
+unique_ptr~IMessage~ procSchemaCreateRequest(string uid, SchemaCreateRequest request, LogContext log_context)
+void recordCollectionDelete(vector~string~ ids, SDMS_TaskDataReply reply, LogContext log_context)
+void handleTaskResponse(libjson_Value result, LogContext log_context)
+template~Rq,Rp,func~ unique_ptr~IMessage~ dbPassThrough(string uid, Envelope msg_request, LogContext log_context)
}
class TaskWorker {
-map~int,execute_fun_t~ m_execute
-ITaskMgr& m_mgr
+TaskWorker(ITaskMgr mgr, uint32_t worker_id, ICommunicator comm)
+void workerThread(LogContext log_context)
+static ICommunicator_Response cmdRawDataTransfer(TaskWorker me, libjson_Value params, LogContext log_context)
+static ICommunicator_Response cmdRawDataDelete(TaskWorker me, libjson_Value params, LogContext log_context)
+static ICommunicator_Response cmdRawDataUpdateSize(TaskWorker me, libjson_Value params, LogContext log_context)
+static ICommunicator_Response cmdAllocCreate(TaskWorker me, libjson_Value params, LogContext log_context)
+static ICommunicator_Response cmdAllocDelete(TaskWorker me, libjson_Value params, LogContext log_context)
+ICommunicator_Response repoSendRecv(string repo_id, google_protobuf_Message request, LogContext log_context)
}
class SDMS_TaskCommand {
<<enumeration>>
+TC_RAW_DATA_TRANSFER
+TC_RAW_DATA_DELETE
+TC_RAW_DATA_UPDATE_SIZE
+TC_ALLOC_CREATE
+TC_ALLOC_DELETE
+TC_STOP
}
class SDMS_ErrorCode {
<<enumeration>>
+BAD_REQUEST
+INTERNAL_ERROR
+SERVICE_ERROR
+AUTHN_REQUIRED
+CLIENT_ERROR
}
class VersionConstants {
+int release_YEAR
+int release_MONTH
+int release_DAY
+int release_HOUR
+int release_MINUTE
+int protocol_version_MAJOR
+int protocol_version_MINOR
+int protocol_version_PATCH
+int core_version_MAJOR
+int core_version_MINOR
+int core_version_PATCH
}
Envelope --> ClientWorker : used by
ClientWorker --> ProtoBufMap : uses
ClientWorker --> MessageFactory : uses
ClientWorker --> DatabaseAPI : uses
TaskWorker --> DatabaseAPI : uses via repoSendRecv
TaskWorker --> SDMS_TaskCommand : indexes m_execute
ClientWorker --> SDMS_ErrorCode : sets error codes in NackReply
VersionConstants <.. ClientWorker : reads version values
VersionConstants <.. main : prints version info
class main {
+int main(int argc, char** argv)
}
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In DatabaseAPI.cpp you removed
using namespace SDMS::Auth;but several function definitions still use unqualified proto types (e.g.,UserUpdateRequest,UserListAllRequest,UserListCollabRequest,NoteCreateRequest, etc.); these should be fully qualified asSDMS::...(or an explicitusingfor the new namespace) to avoid compilation errors. - DatabaseAPI.cpp includes
common/envelope.pb.htwice at the top; please drop the duplicate include to keep the includes clean.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In DatabaseAPI.cpp you removed `using namespace SDMS::Auth;` but several function definitions still use unqualified proto types (e.g., `UserUpdateRequest`, `UserListAllRequest`, `UserListCollabRequest`, `NoteCreateRequest`, etc.); these should be fully qualified as `SDMS::...` (or an explicit `using` for the new namespace) to avoid compilation errors.
- DatabaseAPI.cpp includes `common/envelope.pb.h` twice at the top; please drop the duplicate include to keep the includes clean.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
….com:ORNL/DataFed into 1843-DAPS-refactor-core-server-to-use-proto3
nedvedba
approved these changes
Feb 6, 2026
96f2dd4
into
1837-DAPS-refactor-common-library-to-use-proto3
5 of 7 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
Description
How Has This Been Tested?
Artifacts (if appropriate):
Tasks
Summary by Sourcery
Update core server to use unified SDMS proto3 envelope and enums across database, client worker, task worker, and Globus integration, including error code refactoring and version constant updates.
Enhancements: