forked from ovn-org/libovsdb
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Add Formatters #29
Comments
@hzhou8 @vtolstov This could serve as base for the automatically generated APIs that we're discussing in eBay/go-ovn#29 |
@hzhou8 i like approach with dynamic formatter, mostly naming are bad =)) i'm comment pr, thanks |
@vtolstov I agree agree about the bad naming :) |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, the library does minimum data post-processing. This is a good approach, specially performance wise. However, it has the disadvantage of exposing ovsdb-specific formats (such as
OvsSet
andOvsMap
) to the API clients.I think it would be beneficial to be able to expose the data in more flexible ways. In order to keep backwards compatibility and access to the 'raw' data for clients that require it, I would like to propose adding another 'layer' of structs that can massage the output of
OvsdbClient
.All Formatters should be able to ingest data coming from
OvsdbClient
such asRow
andTransactResponse
and return an arbitrary object with the post-processed data. Similarly, they should be able to consume data in arbitrary format and return structs consumed byOvsdbClient
such asMutation
,Condition
, or more generically,Operation
. Unfortunately, since the returned types are different, it might not be possible to put all Formatters under aninterface
.For instance, I can currently think of two possible Formatters:
NativeFormatter
This formatter could simply hide the ovs-specific fields such as
OvsSet
andOvsMap
(not sure if it would be able to removeUUID
since it would be difficult to distinguish from a normalstring
). For example:DynamicFormatter
This Formatter could accept an additional pointer to a struct that would be populated based on dynamic type inference.
For example, we could define a
ovs
field tag that could be used by the formatter to determine how to populate the fields. For example:I think having this functionality here in libovsdb could make it easier for clients to use it.
What do you think?
The text was updated successfully, but these errors were encountered: