DCCL Refactored API

Registered by Chris Murphy

Simpler API to DCCL in support of a Standalone Refactored DCCL

Blueprint information

Status:
Complete
Approver:
toby schneider
Priority:
Medium
Drafter:
Chris Murphy
Direction:
Approved
Assignee:
Chris Murphy
Definition:
Superseded
Series goal:
Accepted for 2.1
Implementation:
Not started
Milestone target:
None
Completed by
toby schneider

Related branches

Sprints

Whiteboard

Ugly Draft 0

namespace dccl {
 // Interface TBD - derived from FlexOstream
 class Logger : public std::ostream {
 public:
     Logger();
     ~Logger();
 };

 // TypeRegistry wraps/replaces the functionality of DynamicProtobufManager and
 // FieldCodecManager and the like. Perhaps they still exist, but this is the
 // public API.
 class TypeRegistry {
 public:
     TypeRegistry(Logger& logger);
     ~TypeRegistry();

     // Pass dccl_load() a pointer to this type registry, not a codec.
     void load_shared_library_codecs(void* dl_handle);

     template<typename FieldCodecType>
     void register_field_codec(const std::string& name);

     template<typename ProtobufMessage> void register_message();
     void register_message(const google::protobuf::Descriptor& desc);

     template<typename ProtobufMessage> void info(std::ostream& os) const;
     void info(const google::protobuf::Descriptor& desc, std::ostream& os) const;
     void info_all(std::ostream& os) const;
 };

 class MessageCodec {
 public:
     MessageCodec(TypeRegistry&);
     ~MessageCodec();

     // ID Codec is any field codec in the type registry with type uint32.
     configure(Logger& logger, const TypeRegistry& reg,
               const std::string& idCodec);

     // If crypto string is empty, don't use encryption.
     // There are some limitations to DCCL Crypto and support may change
     // in the future? This is a reasonable place to start.
     void set_crypto_passphrase(const std::string& passphrase);

     // Return the message size in bytes
     unsigned size(const google::protobuf::Message& msg);

     void encode(std::string* bytes, const google::protobuf::Message& msg);
     void decode(const std::string& bytes, google::protobuf::Message* msg);

     template <typename ProtobufMessage> unsigned id() const;
     unsigned id(const google::protobuf::Descriptor* desc) const;
     unsigned id(const std::string& encoded_bytes);
 };
}

(?)

Work Items

Work items:
Agree on API : TODO
Prepare 3.0 codeline : TODO
Refactor 3.0 codeline : TODO
Ship It : TODO

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.