Skip to content

How to determine field sizes #183

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

Open
akutz opened this issue Feb 2, 2018 · 3 comments
Open

How to determine field sizes #183

akutz opened this issue Feb 2, 2018 · 3 comments
Assignees
Labels

Comments

@akutz
Copy link
Contributor

akutz commented Feb 2, 2018

#132 adds default field size limits to the spec, but I'm not sure the spec clearly identifies how to determine the size of a thing. For example, if using the gRPC wire protocol, a string takes up a byte per character. Therefore identifying the size a map<string, string> consumes in Go would entail iterating the key/value pairs, converting them to []byte slices, and the summing the lengths of those slices. Since Go string types are just arbitrary bytes, it cannot be assumed a string is always UTF-8 (string literals, however, are).

Still, that's just calculate the size of a map<string, string> in Go, not all other possible languages. I guess the question is, should field size be related to the wire protocol encoding of a field, its elements, a specific encoding, etc.?

@akutz
Copy link
Contributor Author

akutz commented Feb 6, 2018

cc @jdef @saad-ali @jieyu

In addition to determining field sizes, I noticed that the spec calls out string and map<string, string> types, but omits the type repeated string. Is this on purpose? For example:

  // Indicate that the volume will be accessed via the filesystem API.
  message MountVolume {
    // The filesystem type. This field is OPTIONAL.
    // An empty string is equal to an unspecified field value.
    string fs_type = 1;

    // The mount options that can be used for the volume. This field is
    // OPTIONAL. `mount_flags` MAY contain sensitive information.
    // Therefore, the CO and the Plugin MUST NOT leak this information
    // to untrusted entities. The total size of this repeated field
    // SHALL NOT exceed 4 KiB.
    repeated string mount_flags = 2;    
  }

Should the field mount_flags be limited to the same 4KiB size limit that applies to map data?

@saad-ali
Copy link
Member

saad-ali commented Nov 5, 2018

Still, that's just calculate the size of a map<string, string> in Go, not all other possible languages. I guess the question is, should field size be related to the wire protocol encoding of a field, its elements, a specific encoding, etc.?

Yes we should clarify the how size is calculated.

Should the field mount_flags be limited to the same 4KiB size limit that applies to map data?

Yes, that would be good to do.

@saad-ali saad-ali added this to the v1.0 milestone Nov 5, 2018
@saad-ali
Copy link
Member

Not a blocker for 1.0.rc

@saad-ali saad-ali removed this from the v1.0 milestone Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants