Skip to content
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

Schema: Parse column type #28

Closed
wants to merge 4 commits into from
Closed

Commits on Feb 17, 2021

  1. schema: Add full support for OVSDB types

    The way the column types are specified in RFC7047 is not directly
    unmarshallable by the json encoder.
    
    This patch adds the necessary structs and functions to manually
    unmarshal the schema definition.
    
    The result is the possibility of determining the exact time of golang
    structure needed to store each column type.
    
    Several approaches were considering when implementing this:
    A) Multiple rounds of json.Unmarshal storing the partial in in-struct
    json.rawMessage
    B) Single call to json.Unmarshall and manually decoding the rest of the
    message (using reflex to guess the type of incoming data)
    C) Multiple rounds of json.Unmarshal storing partials in private
    temporary structs.
    
    After discarting A) for it's high memory consumption, B) and C) were
    compared:
    B) has lower memory allocation needs but more LOC
    C) has higher memory allocation needs (though after GC, it's the same or
    less than B), and fewer LOC.
    
    This patch implements C) as a good balance between maintainablity and
    memory efficiency.
    
    Signed-off-by: Adrian Moreno <[email protected]>
    amorenoz committed Feb 17, 2021
    Configuration menu
    Copy the full SHA
    d0ce3e0 View commit details
    Browse the repository at this point in the history
  2. schema: add getColumn function

    the special column "_uuid" is not on the schema object. If it is needed,
    generate the ColumnSchema on the fly
    
    Signed-off-by: Adrian Moreno <[email protected]>
    amorenoz committed Feb 17, 2021
    Configuration menu
    Copy the full SHA
    fa06e5d View commit details
    Browse the repository at this point in the history
  3. example: move example to it's own directory

    Signed-off-by: Adrian Moreno <[email protected]>
    amorenoz committed Feb 17, 2021
    Configuration menu
    Copy the full SHA
    1899655 View commit details
    Browse the repository at this point in the history
  4. example: add a simple program to print a schema

    Signed-off-by: Adrian Moreno <[email protected]>
    amorenoz committed Feb 17, 2021
    Configuration menu
    Copy the full SHA
    f94feaa View commit details
    Browse the repository at this point in the history