Git Product home page Git Product logo

Comments (3)

nguptaopensds avatar nguptaopensds commented on August 21, 2024

@kumarashit @himanshuvar @pravinran @wisererik @sushanthakumar If you people have any information and comments regarding this issue please submit here

from dock.

nguptaopensds avatar nguptaopensds commented on August 21, 2024

Detailed description of issue :
Problem statement: In GRPC client server architecture, the protobuf file is shared which enables them to communicate with each other.In this case, SODA Dock and Controller are separate microservices which has their own proto files and for communication they send/recieve the common structs to gRPC for creating a handshake. The problem is even though the projects are separate, they still have to maintain a continuity in proto in assigning the field number for an attribute. For example:

Here are struct from controller and dock proto for CreateVolumeOpts:
Controller- model.proto
message CreateVolumeOpts {
// The uuid of the volume, optional when creating.
string id = 1;
// The name of the volume, required.
string name = 2;
// The requested capacity of the volume, required.
int64 size = 3;
// The description of the volume, optional.
string description = 4;
// When create volume from snapshot, this field is required.
string snapshotId = 5;
// The locality that volume belongs to, required.
string availabilityZone = 6;
// The service level that volume belongs to, required.
// TODO: This item will be replace by profile, don't use it.
string profileId = 7;
// The uuid of the pool on which volume will be created, required.
string poolId = 8;
// The name of the pool on which volume will be created, required.
string poolName = 9;
}
Dock - model.proto
message CreateVolumeOpts {
// The uuid of the volume, optional when creating.
string id = 1;
// The name of the volume, required.
string name = 2;
// The requested capacity of the volume, required.
int64 size = 3;
// The description of the volume, optional.
string description = 4;
// When create volume from snapshot, this field is required.
string snapshotId = 5;
// The locality that volume belongs to, required.
string availabilityZone = 6;
// The uuid of the pool on which volume will be created, required.
string poolId = 8;
// The name of the pool on which volume will be created, required.
string poolName = 9;
}
Here if attribute "poolID" is tagged field number 8 in controller proto, similarly we had to assign 8 in dock as well missing field number 7 in the struct. This is not a right practice to assign field number in proto as it should be sequential.

Solutions analysis:

To solve the above problems we can have a few ways:

  1. Either we add attribute "profileID" in dock proto as well assigning number "7", to make it sequential. But this is not sanity, because we don't actually need "profileID" in Dock project.
  2. We can make a shared folder in the upper level of both projects where we can have one proto file for all Dock, Controller and API which will be superset for all the projects proto file. In this solution we can use some leverages from protobuf like OneOf or omitempty, where we can make all attributes optional(by default in proto3 version or above)
  3. We can make an agreement between Controller and Dock proto, where only those attributes which are needed for communication between them will be part of the common struct and if any of the projects need some other attributes(private), they can make other struct which can import common struct as base model.But this is also not optimized as, there will be a lot many code changes in both the projects to adapt to this new struct, plus if in future we need to add new attribute , we again have to make other struct which inherits the base struct.
  4. client and server must be agreed on same unique tag number of parameters. so for ex: if client, is sending some parameters on tag number 10(lets say), then server must catch the same parameters on exactly same tag number. because of serialization and deserialization concept.

Conclusion:
We can optimize SODA Dock and SODA Controller where we can check for the client server agreement for these services. If Controller is using/wrapping the dock grpc client, this grpcs client should be capable enough to send the right information/messages to the dock grpc server.

from dock.

kumarashit avatar kumarashit commented on August 21, 2024

Won't fix

from dock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.