Skip to content

json+struct codec should provide stuff in the public API that is needed by clients #3422

@bhaller

Description

@bhaller

Making a new issue for this at the request of @jeromekelleher since #3306 was merged and closed. Tagging @petrelharp since he'll be a client of this API too, in pyslim.

Copy-paste from #3306:

The stuff in test_core.c that puts together an example for testing would be useful to have in tskit. Most importantly, the JBLB magic bytes should either (a) be exposed in core.h, or (b) should be set up by a tskit function, probably? It's a bit weird for SLiM to duplicate this magic in its own code. Less importantly, it'd be nice to provide set_u64_le() as a utility function. Providing a "write" equivalent of tsk_json_struct_metadata_get_blob() seems tricky since it wouldn't want to do its own malloc for the result, so then the caller needs to know how many bytes of storage will be needed, so life gets complicated and messy. Anyhow, I'll just duplicate the magic and set_u64_le() in SLiM for now, but maybe this is worth thinking about a bit so that every tskit client using this stuff doesn't end up copying those same things into their own codebases?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions