[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 8/8] RFC: Sketch constructors, DomainCreateNew



Sorry for the late reply on this one.

> +func NewDomainConfig(t DomainType) (*DomainConfig, error) {
> +       var cconfig C.libxl_domain_config
> +
> +       C.libxl_domain_config_init(&cconfig)
> +       C.libxl_domain_build_info_init_type(&cconfig.b_info, 
> C.libxl_domain_type(t))
> +
> +       gconfig := &DomainConfig{}
> +       err := gconfig.fromC(&cconfig)
> +       if err != nil {
> +               return nil, err
> +       }
> +
> +       return gconfig, nil
> +}

I think this is sufficient for the "New" functions; simple is probably
better here. I appreciate the idea of the `populate func` approach you
mentioned in another email, but I think in practice people will want
to leverage encoding/json or otherwise to unmarshal some data into a
DomainConfig etc. Or, we would hopefully be able to unmarshal an
xl.cfg. All that is to say, I think the approach you have shown here
gives us and package users the most flexibility.

Do you have any thoughts on supporting unmarshaling json, xl.cfg, etc.?

If we stick with this outline for constructors, they will be easy to
generate. I'm happy to work on that, unless you were already planning
on it.

Thanks,
-NR

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.