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

Change static blob schema format to JSON #100

Merged
merged 5 commits into from
May 5, 2017

Conversation

theprash
Copy link
Contributor

@theprash theprash commented May 4, 2017

I'm not 100% sure about the JSON format here. This is the most concise way I could think of to represent a directory structure with only the folder/file names. However, it does mean that file names are object keys with a null value. Is there a different format preferred?

{
    "samples": {
        "file1.txt": null,
        "file2.txt": null,
        "file3.txt": null,
        "folder": { "childFile.txt": null },
        "folder2": {
            "child": { "descedant4.txt": null }
        }
    },
    "random": {
        "file.txt": null,
        "folder": { "emptyFolder": {} }
    }
}

Once we're happy with the format I'll add documentation to this PR.

@isaacabraham
Copy link
Collaborator

isaacabraham commented May 4, 2017

How about

{
    "samples": {
        "files": [
            "file1.txt",
            "file2.txt",
            "file3.txt"
        ],
        "folder": {
            "files": [ "childFile.txt" ]
        },
        "folder2": {
            "child": {
                "files": [ "descedant4.txt" ]
            }
        }
    },
    "random": {
        "files": [ "file.txt" ],
        "folder": {
            "emptyFolder": {}
        }
    }
}

Don't know if that's any better, mind you.

@isaacabraham
Copy link
Collaborator

Yet another alternative is that we optionally capture the blob type: -

{
    "samples": {
        "file1.txt": null,
        "file2.txt": { "type" : "blockblob" },
        "file3.txt": { "type" : "blockblob" },
        "folder": { "childFile.txt": { "type" : "pageblob" } },
        "folder2": {
            "child": { "descedant4.txt": { "type" : "blockblob" } }
        }
    },
    "random": {
        "file.txt": null,
        "folder": { "emptyFolder": {} }
    }
}

If you leave it as null we just take default of blockblob.

@theprash
Copy link
Contributor Author

theprash commented May 4, 2017

@isaacabraham
The first alternative doesn't allow a folder called files so I guess it's not viable... Maybe an empty string instead of "files"?

The second one could work. I suppose it's an extension to what I've already got and it makes sense if we need to capture the blob type. Is there any chance that in the future we could need to capture extra information about the folders? If so, we should have a design that allows us to add this in a nice way without making a breaking change.

@isaacabraham
Copy link
Collaborator

In the proposed model, how do you distinguish between an empty folder and a file?

@isaacabraham
Copy link
Collaborator

Can you also confirm if with this model you can create "empty" containers (the current schema doesn't support this).

@isaacabraham
Copy link
Collaborator

I think we've settled on this structure: -

{
	"samples": {
		"file1.txt": null,
		"file2.txt": null,
		"file3.txt": null,
		"folder/": { 
			"childFile.txt": null },
		"folder2/": {
			"child/": {
				"descedant4.txt": null }
		}
	},
	"random": {
		"file.txt": null,
		"folder/": {
			"emptyFolder/": null }
	}
}

All folders must end with '/'. The "value" of a file or folder can be null or { }, and for files can also contain the type of blob (this is an added feature so by default the existing code won't support that).

@theprash
Copy link
Contributor Author

theprash commented May 5, 2017

That format looks good. I've made the changes to use that now.

@theprash theprash changed the title [WIP] Change static blob schema format to JSON Change static blob schema format to JSON May 5, 2017
@isaacabraham isaacabraham merged commit 26d50c3 into fsprojects:master May 5, 2017
@theprash theprash deleted the json-blob-schema branch May 8, 2017 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants