Skip to content

feat: compact encoding of graph edges #881

Description

@m-hilgendorf

Currently the encoding of graphs looks something like

tg.graph({
    "nodes": [
        {
            "kind": "file",
            "contents": tg.blob("foo.txt"),
            "dependencies": {
                "bar.txt": {
                    "index": 1,
                    "kind": "file"
                },
            }
        },
        {
            "kind": "file",
            "contents": tg.blob("bar.txt"),
            "dependencies": {
                "foo.txt": {
                    "index": 0,
                    "kind": "file"
                },
            }
        },
    ]
})

It is desirable to make this more compact for internal graph pointers where the kind field can be deduced from the rest of the node data, to encode this simply as

tg.graph({
    "nodes": [
        {
            "kind": "file",
            "contents": tg.blob("foo.txt"),
            "dependencies": {
                "bar.txt": 1
            }
        },
        {
            "kind": "file",
            "contents": tg.blob("bar.txt"),
            "dependencies": {
                "foo.txt": 0
            }
        },
    ]
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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